2016-11-09 224 views
1

升级后出现此错误。有谁能够帮助我。opencart 2.0.3.1至2.3.0.2错误

Fatal error: Uncaught exception 'Exception' with message 'Error: Could not load model total!' in C:\xampp\htdocs\deleteme\system\engine\loader.php:169 Stack trace: #0 [internal function]: Loader->{closure}(Array, Array) #1 C:\xampp\htdocs\deleteme\system\engine\proxy.php(25): call_user_func_array(Object(Closure), Array) #2 C:\xampp\htdocs\deleteme\catalog\controller\common\cart.php(37): Proxy->__call('getTotal', Array) #3 C:\xampp\htdocs\deleteme\catalog\controller\common\cart.php(37): Proxy->getTotal(Array) #4 [internal function]: ControllerCommonCart->index(Array) #5 C:\xampp\htdocs\deleteme\system\engine\action.php(51): call_user_func_array(Array, Array) #6 C:\xampp\htdocs\deleteme\system\engine\loader.php(24): Action->execute(Object(Registry), Array) #7 C:\xampp\htdocs\deleteme\catalog\controller\common\header.php(129): Loader->controller('common/cart') #8 [internal function]: ControllerCommonHeader->index(Array) #9 C:\xampp\htdocs\deleteme\system\engine\action.php(51): call_user_func_array(Array, Array) #10 C:\xampp\ in C:\xampp\htdocs\deleteme\system\engine\loader.php on line 169

回答

2

升级问题报告和解决方案在他们的论坛,here解释的错误。

摘要(用于posternity复制/粘贴):

BUG: Error: Could not load model total!

Two-part bug. Part one: Event Compatibility cuts off too many parts of the route when trying to load the older extension format. ex. "extension/total/sub_total/getTotal" route gets turned into "total/sub_total" instead of "total/sub_total/getTotal". This causes it to try and load a model with no name throwing the exception. Part Two, this compatibility is being loaded fine when the route is "extension/total/subtotal" but is also loading when the route is "extension/total/sub_total/getTotal". I think this event should not be triggered for compatibility because it is a getTotal is a function call, not a model load. This causes the verification to fail and try to load the 2.2.x version which has other bits missing and throws different errors. Haven't figured out why the function call is going down the event path. But basically the attempt to support backwards compatibility with 2.2 mods is causing problems.

2 Solutions

FIX 1: Give up on 2.2.x compatibility and delete the following left-over folders:

 catalog/model/total 
    catalog/model/payment 
    catalog/controller/payment 
    catalog/model/shipping 
    catalog/controller/module 
    admin/controller/total 
    admin/controller/payment 
    admin/controller/shipping 
    admin/controller/module 

FIX 2: Add a hack to bypass the event when the function call for "getTotal", "getMethod", or "getQuote" are passed in. This is experimental but should at least restore support for 2.2.x mods for now. This is NOT a permanent fix. Just a work around. EDIT: catalog/controller/event/compatibility.php FIND:

'model/' . $route. '.php' 

REPLACE WITH:

'model/' . ((strpos($route,'get') !== false) ? dirname($route) : $route) . '.php' 

This should let routes like "extension/total/sub_total" work but block "extension/total/sub_total/getTotal" calls which fail on the directory check.