Post by jpedroza2k » Thu Oct 19, 2017 10:24 am

I am attempting to update from 3.0.1.1 to 3.0.2.0 to try and fix an issue. I downloaded the newer files, copied the contents of the upload folder to my server, overwriting duplicate files. Now when I attempt to load the main page or the install directory, I get the following:

Code: Select all

PHP Fatal error:  Uncaught Twig_Error_Loader: Unable to find template "common/column_left.twig" (looked into: /var/www/opencart/catalog/view/theme)
I have reset the default theme, tried creating a new theme and setting it as default. It looks as if default/ is not getting appended to the path for twig templates for some reason.

Any help would be appreciated.

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am

Post by straightlight » Thu Oct 19, 2017 9:59 pm

Restore backups and database. If you have cPanel, use the file manager to deflat the files with the extract button rather than using FTP. FTP can cause missing files during the upload since it uses UDP compared to the file manager of your host console that uses TCP for file transmission.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jpedroza2k » Tue Nov 28, 2017 8:45 am

Did this, issue was still there, so I reverted back to 3.0.1.1 and lived with it, but now I am up against a bug in the affiliate portion of 3.0.1.1 and need to get this addressed. This seems to be an issue reading in the custom theme.

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am

Post by jpedroza2k » Tue Nov 28, 2017 10:10 am

If I go in and manually add the theme directory to "system/library/template/Twig/Loader/Filesystem.php" in the foreach block that starts on line 199, then it loads the template correctly. Obviously this is not ideal, but it would be much better to have the template directory getting read correctly out of the database. Where is this field supposed to be loaded from, from which table?

Edit: The variable $this->paths[$namespace] is not getting the correct path for some reason.

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am

Post by straightlight » Tue Nov 28, 2017 10:35 am

Based on your first request on this topic, this solution should help you to restore the default theme: viewtopic.php?f=202&t=199582&p=703462#p703462

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jpedroza2k » Tue Nov 28, 2017 10:59 am

Unfortunately that did not fix the issue.
I updated: UPDATE `oc_theme_default_status` SET `value` = '1' WHERE `key` = 'theme_default_status';
The other columns in that thread were already set to default.

Edit: Here is the full text of the error: [Tue Nov 28 02:59:25.546121 2017] [php7:error] [pid 23532] [client 70.180.203.29:64538] PHP Fatal error: Uncaught Twig_Error_Loader: Unable to find template "common/column_left.twig" (looked into: /var/www/virtual-hosts/hostname/opencart/catalog/view/theme). in /var/www/virtual-hosts/hostname/opencart/system/library/template/Twig/Loader/Filesystem.php:215\nStack trace:\n#0 /var/www/virtual-hosts/hostname/opencart/system/library/template/Twig/Loader/Filesystem.php(139): Twig_Loader_Filesystem->findTemplate('common/column_l...')\n#1 /var/www/virtual-hosts/hostname/opencart/system/library/template/Twig/Environment.php(312): Twig_Loader_Filesystem->getCacheKey('common/column_l...')\n#2 /var/www/virtual-hosts/hostname/opencart/system/library/template/Twig/Environment.php(378): Twig_Environment->getTemplateClass('common/column_l...', NULL)\n#3 /var/www/virtual-hosts/hostname/storage/modification/system/library/template/twig.php(45): Twig_Environment->loadTemplate('common/column_l...')\n#4 /var/www/virtual-hosts/hostname/opencart/system/library/template.php(51): Templat in /var/www/virtual-hosts/hostname/opencart/system/library/template/Twig/Loader/Filesystem.php on line 215
Last edited by jpedroza2k on Tue Nov 28, 2017 11:04 am, edited 1 time in total.

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am

Post by straightlight » Tue Nov 28, 2017 11:01 am

If you cannot revert to the default theme and since you replaced core files already, restore backups as suggested previously.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jpedroza2k » Tue Nov 28, 2017 11:06 am

I have reverted to 3.0.1.1 and it works just fine. As soon as I move it over to 3.0.2.0 it breaks twig. The affiliate saving is broken in 3.0.1.1 and I need that to work, so leaving it at 3.0.1.1 is not an option going forward.

Edit: This is all on my staging server, not on production.

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am

Post by straightlight » Tue Nov 28, 2017 11:11 am

Follow this topic but the step-by-step guidance. If one user can do it, we all can upgrade without issues: viewtopic.php?f=199&t=199983

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jpedroza2k » Tue Nov 28, 2017 11:48 am

So that I understand, that link has a path to install 3.0.2.0 into a new folder, and then reinstall any custom extensions and the theme, and them import in the database. Is that correct? Is that a standard update path for OpenCart, even for dot updates?

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am

Post by jpedroza2k » Tue Nov 28, 2017 12:47 pm

I went into config.php and edited the value for DIR_TEMPLATE to include the full path and once again the site works fine. There is somewhere that the custom template is not being loaded and appended to the end of the DIR_TEMPLATE in order to get the correct template.

EDIT: I am not trying to be difficult, but it seems a bit silly to start over from scratch every time I need to do a version update. I tried installing in a completely new directory, and then importing the database, and I get the same issue. I think I will simply hack the theme directory into the config file until I have time to figure out what the problem is, or I will back port the changes that fixed the affiliate saving issue and stay on 3.0.1.1 (possibly making my own fork of the project).

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am

Post by jpedroza2k » Tue Nov 28, 2017 11:15 pm

I did a new install, with a fresh database, and I think I have identified the cause of the twig error. If I rename the override function in catalog/controller/event/theme.php on the fresh install, instead of an error that the override() function is not found, the exact same twig error happens. This would also explain why any debugging messages I placed into theme.php never fired when I was first having this issue.

Just documenting my process in case someone else ever runs into something like this, plus this is an excuse for me to get to know the codebase that much better.

Edit: If anyone knows when the override method is called, feel free to chime in, as I am having a heck of a time finding it. :)
Last edited by jpedroza2k on Tue Nov 28, 2017 11:32 pm, edited 1 time in total.

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am

Post by straightlight » Tue Nov 28, 2017 11:23 pm

If you are tweaking the event controller, the best suggestion would be to post your enquiry on Github Opencart - > Pull Requests.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jpedroza2k » Tue Nov 28, 2017 11:36 pm

I am not really modifying it just yet, just testing some theories. It looks like if the override method is not called correctly the TwigError is triggered. I am trying to find where that method is being called, so I changed the name hoping to trigger an error that would point me in the right direction. Instead I got the Twig error.

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am

Post by straightlight » Tue Nov 28, 2017 11:56 pm

Which line of code are you wanting to modify and from which controller? Without providing any results on what you're trying to customize, it will only be harden to provide an accurate solution to this problem.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jpedroza2k » Tue Nov 28, 2017 11:59 pm

The call to the override method in catalog/controller/event/theme.php is the one that is not firing and causing the Twig error. I am still trying to figure out why it is not being called correctly, but I can't find where the method call is. That is why I changed the method name, hoping that it would trigger a method not found error, but instead I got the twig error.

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am

Post by straightlight » Wed Nov 29, 2017 12:03 am

jpedroza2k wrote:
Tue Nov 28, 2017 11:59 pm
The call to the override method in catalog/controller/event/theme.php is the one that is not firing and causing the Twig error. I am still trying to figure out why it is not being called correctly, but I can't find where the method call is. That is why I changed the method name, hoping that it would trigger a method not found error, but instead I got the twig error.
But, yet again, the line of code you wish to modify has not been posted along with the controller file.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jpedroza2k » Wed Nov 29, 2017 12:11 am

Not sure I can say this any more succinctly, I am not trying to modify a line of code. I am trying to locate where code is being called from. If I modify the method name for the override method (public function override(&$route, &$args, &$template) {) on line 52 of controller/event/theme.php that will trigger the same Twig error I have been getting from the beginning of the update process. What I need to find is when in the process of loading a page is ControllerEventTheme->override() being called and from where.

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am

Post by straightlight » Wed Nov 29, 2017 12:17 am

Not sure I can say this any more succinctly, I am not trying to modify a line of code. I am trying to locate where code is being called from. If I modify the method name for the override method (public function override(&$route, &$args, &$template) {) on line 52 of controller/event/theme.php
Not trying to modify what you are modifying, I understand.

Although:

Code: Select all

public function override(&$route, &$args, &$template) {
of that file is on line 27 and line 52 is:

Code: Select all

}
the ended class statement. As for the path, it's the catalog/controller/event

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jpedroza2k » Wed Nov 29, 2017 12:21 am

Yes, line 27. Mea culpa.

And I am not modifying that line. I need to know when it is called, and from where. That is all I need from it. It is not being called for some reason.

Again, I AM NOT MODIFYING THAT FILE AT ALL. It is exactly as it is in the current master branch. No changes at all, and none planned. I just need to find where it is being used. Not sure why this is such a sticking point.

New member

Posts

Joined
Wed Jul 12, 2017 1:45 am
Who is online

Users browsing this forum: No registered users and 155 guests