Page 1 of 1

class index and Fatal error : call to undefined method abc()

PostPosted: Tue Mar 12, 2013 1:50 am
by shokinro
The PrestaShop 1.5x class auto-loader caches the classes and their override information in following file
/cache/class_index.php

When a page file is executed, it will automatically load required class information based on above file. This file is usually updated automatically when a new class or new override class is installed. However, if for any reason the index file does not update (most likely permission issues), then your new override classes will not take effect even if you have copied all files to the correct location. If this happens, usually you will get error message such as:

Fatal Error: Call to undefined method BlaBlaBla().

or
Fatal Error: Class xxxx is not defined.


In this case, you should check the above class index file to make sure the class information has been correctly updated.

The file should be formatted in the following way, with each class having two lines, one line for the Core class and another line for override class:

Code: Select all
  'Address' => 'override/classes/Address.php',
  'AddressController' => 'override/controllers/front/AddressController.php',
  'AddressControllerCore' => 'controllers/front/AddressController.php',
  'AddressCore' => 'classes/Address.php',
  'AddressFormat' => 'override/classes/AddressFormat.php',
  'AddressFormatCore' => 'classes/AddressFormat.php',
....


You can manually correct the file to make each class has the proper two line format as noted above, but it is usually better to find out why the class index file did not update automatically and correct the issue that way.

Hope this helps...