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

In this board, we will periodically list various tips and tricks we find that may help in your use of PrestaShop. This will also include tips on the use of Agile modules. If you have a great tip, fix, or workaround for a PrestaShop feature, feel free to post it here...

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

Postby shokinro » Tue Mar 12, 2013 1:50 am

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...
Follow us at Twitter Like us on Facebook Watch our Tutorial Videos on YouTube
shokinro
Site Admin
 
Posts: 3091
Joined: Sat Jun 25, 2011 3:08 pm

Return to Tips and Tricks for PrestaShop and Agile Modules

Who is online

Users browsing this forum: No registered users and 2 guests