Post by HAO » Fri Jul 28, 2017 2:35 am

I have compared the difference between 2.3.0.2 and 3.0.2.0, The general difference, I can judge it.

The only thing I do not know is how the changes between * tpl and * twig are modified, Can someone tell me how to upgrade?

Thank you!

Attachments


HAO
Active Member

Posts

Joined
Fri Jun 03, 2011 2:52 pm

Post by kestas » Tue Aug 01, 2017 3:01 am

Hi,
not only tpl to twig conversion needed... You need to edit controller files also... :)

Good luck.

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by HAO » Tue Aug 01, 2017 5:26 am

I got an error message:

Code: Select all

Fatal error: Uncaught exception 'Twig_Error_Loader' with message 'Unable to find template "extension/shipping/ecpaylogistic.twig" (looked into: /home/*.*/public_html/demo/3020/admin/view/template).' in /home/*.*/public_html/demo/3020/system/library/template/Twig/Loader/Filesystem.php:215 Stack trace: #0 /home/*.*/public_html/demo/3020/system/library/template/Twig/Loader/Filesystem.php(139): Twig_Loader_Filesystem->findTemplate('extension/shipp...') #1 /home/*.*/public_html/demo/3020/system/library/template/Twig/Environment.php(312): Twig_Loader_Filesystem->getCacheKey('extension/shipp...') #2 /home/*.*/public_html/demo/3020/system/library/template/Twig/Environment.php(378): Twig_Environment->getTemplateClass('extension/shipp...', NULL) #3 /home/*.*/public_html/demo/3020/system/library/template/twig.php(33): Twig_Environment->loadTemplate('extension/shipp...') #4 /home/*.*/public_html/demo/3020/system/library/template.php(51): Template\Twig->render('extension/shipp...', '1') #5 /home/open in /home/*.*/public_html/demo/3020/system/library/template/Twig/Loader/Filesystem.php on line 215
I have tried to make changes, But I'm not sure how the code about the error message is modified.

Original file:
<div class="form-group">
<label class="col-sm-2 control-label" for="input-name"><?php echo $entry_mid; ?></label>
<div class="col-sm-10">
<input type="text" name="ecpaylogistic_mid" value="<?php echo $ecpaylogistic_mid; ?>" placeholder="<?php echo $entry_mid; ?>" id="input-name" class="form-control" />
<?php if (!empty($error_mid)) { ?>
<div class="text-danger"><?php echo $error_mid; ?></div>
<?php } ?>
</div>
</div>
Change file:
<div class="form-group">
<label class="col-sm-2 control-label" for="input-name{{ entry_mid }}</label>
<div class="col-sm-10">
<input type="text" name="shipping_ecpaylogistic_mid" value="{{ ecpaylogistic_mid }}" placeholder="{{ entry_mid }}" id="input-name" class="form-control" />
<?php if (!empty($error_mid)) { ?>
<div class="text-danger{{ error_mid }}</div>
<?php } ?>
</div>
</div>
Based on fedex.tpl code, The error message is controlled by the following code:

Original file:
<?php if ($error_key) { ?>
<div class="text-danger"><?php echo $error_key; ?></div>
<?php } ?>
Change file:
{% if error_key %}
<div class="text-danger">{{ error_key }}</div>
{% endif %}
In my code more than a "(!empty($error_mid))" sign, How should I modify this?

In addition, The following code, how to modify?

Original file:
<div class="form-group">
<label class="col-sm-2 control-label" for="input-ecpaylogistic-type"><?php echo $entry_type; ?></label>
<div class="col-sm-10">
<select name="ecpaylogistic_type" id="input-ecpaylogistic-type" class="form-control">
<?php foreach ($ecpaylogistic_types as $ecpayl_type) { ?>
<?php if ($ecpayl_type['value'] == $ecpaylogistic_type) { ?>
<option value="<?php echo $ecpayl_type['value']; ?>" selected="selected"><?php echo $ecpayl_type['text']; ?></option>
<?php } else { ?>
<option value="<?php echo $ecpayl_type['value']; ?>"><?php echo $ecpayl_type['text']; ?></option>
<?php } ?>
<?php } ?>

</select>
</div>
</div>
Change file:
<div class="form-group">
<label class="col-sm-2 control-label" for="input-ecpaylogistic-type{{ entry_type }}</label>
<div class="col-sm-10">
<select name="shipping_ecpaylogistic_type" id="input-ecpaylogistic-type" class="form-control">
{% for ecpaylogistic_types in ecpayl_type %}
<?php if ($ecpayl_type['value'] == $ecpaylogistic_type) { ?>
<option value="{{ ecpayl_type['value'] }}" selected="selected{{ ecpayl_type['text'] }}</option>
{% else %}
<option value="{{ ecpayl_type['value'] }}{{ ecpayl_type['text'] }}</option>
{% endif %}
<?php } ?>
</select>
</div>
</div>
Text color description:
red Represents a modified code by comparing the differences.
blue Represents a Do not know how to modify or is not sure the code.

Would you understand what I mean?

If you can please advise!

HAO
Active Member

Posts

Joined
Fri Jun 03, 2011 2:52 pm

Post by linetrace » Mon Aug 21, 2017 10:43 pm

The error you appear to be getting is regarding it not being able to find the .twig file.

As someone already mentioned, you need to modify your controller too. I give a rough overview of what needs to be changed in the controllers & views in the second part of my thread on How to successfully upgrade from OpenCart 2.3.02 to 3.0.2.0. I hope it helps.

Newbie

Posts

Joined
Sat Aug 05, 2017 4:42 am
Location - Winooski, VT, US
Who is online

Users browsing this forum: No registered users and 7 guests