I've already done a successful upgrade of another live site by doing the following:
1. Installed a fresh copy of OC 3.0.4.0.
2. Merge, but not overwrite, the 3.0.3.8 live files
3. Connect database and debug any extensions etc.
This worked fine for the previous site I successfully upgraded. However, this second site I am upgrading is being a little bit of a pain.
When I refresh the modifications, I get this error and am unable to get back into admin (unless I delete the modifications folder)
Fatal error: Uncaught Error: Class "Twig_Loader_Array" not found in /home/customer/www/xxxx/storage/modification/system/library/template/twig.php:36 Stack trace: #0 /home/customer/www/xxxx/storage/modification/system/library/template.php(59): Template\Twig->render('common/header', '<!DOCTYPE html>...') #1 /home/customer/www/xxxx/storage/modification/system/engine/loader.php(133): Template->render('common/header', '') #2 /home/customer/www/xxxx/storage/modification/admin/controller/common/header.php(218): Loader->view('common/header', Array) #3 /home/customer/www/xxxx/storage/modification/system/engine/action.php(79): ControllerCommonHeader->index(Array) #4 /home/customer/www/xxxx/storage/modification/system/engine/loader.php(54): Action->execute(Object(Registry), Array) #5 /home/customer/www/xxxx/public_html/admin/controller/marketplace/modification.php(768): Loader->controller('common/header') #6 /home/customer/www/xxxx/public_html/admin/controller/marketplace/modification.php(17): ControllerMarketplaceModification->getList() #7 /home/customer/www/xxxx/storage/modification/system/engine/action.php(79): ControllerMarketplaceModification->index() #8 /home/customer/www/xxxx/public_html/admin/controller/startup/router.php(26): Action->execute(Object(Registry), Array) #9 /home/customer/www/xxxx/storage/modification/system/engine/action.php(79): ControllerStartupRouter->index() #10 /home/customer/www/xxxx/storage/modification/system/engine/router.php(143): Action->execute(Object(Registry)) #11 /home/customer/www/xxxx/storage/modification/system/engine/router.php(132): Router->execute(Object(Action)) #12 /home/customer/www/xxxx/public_html/system/framework.php(179): Router->dispatch(Object(Action), Object(Action)) #13 /home/customer/www/xxxx/public_html/system/startup.php(104): require_once('/home/customer/...') #14 /home/customer/www/xxxx/public_html/admin/index.php(24): start('admin') #15 {main} thrown in /home/customer/www/xxxx/storage/modification/system/library/template/twig.php on line 36
Any Ideas?
Self Taught Opencart User & Developer Since 2010.
So the error is caused by a modification.Rainforest wrote: ↑Sat Sep 21, 2024 8:36 pmWhen I refresh the modifications, I get this error and am unable to get back into admin (unless I delete the modifications folder)
Any Ideas?
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Would this work? Going into the database and disabling mods from the table?
Self Taught Opencart User & Developer Since 2010.
The responsible advise is to delete the modification folder and disable them in the correct place in admin.
I also don’t know if you use events or the built in editor but there can be issues can be there also.
viewtopic.php?t=234476#p873239
** For any users thinking they can save time by this type of upgrade method are advised to follow the link above and spend 10 mins more and have a clean install without rubbish to slow the site or copy anything that should not be there.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84

So, I did disable all my mods and with the help of GPT I zeroed in on lines 36-38 in twig.php
Something is modifying the lines to:
$loader1 = new \Twig_Loader_Array(array($filename . '.twig' => $code));
$loader2 = new \Twig_Loader_Filesystem(array(DIR_TEMPLATE));
$loader = new \Twig_Loader_Chain(array($loader1, $loader2));
When I change that to (thanks GPT):
$loader1 = new \Twig\Loader\ArrayLoader(array($filename . '.twig' => $code));
$loader2 = new \Twig\Loader\FilesystemLoader(array(DIR_TEMPLATE));
$loader = new \Twig\Loader\ChainLoader(array($loader1, $loader2));
the site works. That said, with all my mods disabled...what could be editing that code in the storage?
I'm learning and enjoy doing this on the development server. It may not be the right way but I do learn things from this. Any ideas are always greatly appreciated
Self Taught Opencart User & Developer Since 2010.

So, what I did was.
1. First identified that line 36-38 was being altered.
2. asked chatgpt what the correct code could be. Tried that and worked.
3. refreshed mod and the bad code came back.
4. downloaded my public html to my local
5. Used astrogrep to find the altered code
6.That led me to a rewards xml that was sitting in my system folder. _Disabled the file and all fixed.
<hair toss>

Self Taught Opencart User & Developer Since 2010.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
It was actually a rewards module (mega rewards) which was inserting the lines into the twig, not the theme.
Self Taught Opencart User & Developer Since 2010.
Sorry, yes. Still, there should be no reason for the rewards module to do this modification unless its twig files use include-tags.Rainforest wrote: ↑Sun Sep 22, 2024 7:39 pmThank you for input J.
It was actually a rewards module (mega rewards) which was inserting the lines into the twig, not the theme.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
For further assistance with Opencart Development you can reach me at
asktofaizan@gmail.com | https://asktofaizan.com |
Users browsing this forum: No registered users and 6 guests