Last Updated a year ago

OVERRIDE PROBLEM during module installation

Problem: Unable to install override: Method ... in class ... has already been overwritten.

The above message indicates that there is a conflict of override files. The module we are trying to install wants to add an override file that is already createn by another module or has been manually overwritten.

If there is no override in your shop, then the first module you install that wants to use the override will install without a problem - it will add the override and no problem will occur.

The problem with override occurs when the second module wants to use existing override. Then the override file in the shop has to be looked into and the override code from the module has to be merged with the override code that is already in the shop.

The module during installation does not know what is in the override file in your shop. In the override files in your shop, there could be code from any other module you have installed before or code from a programmer who has modified the shop through the override files.

Solution

There is no automatic system for merging Override, as the code for the files to be merged is different each time. The PrestaShop documentation indicates to merge the Override files manually. This is the only correct way to solve the Override problem.

We will use an example message to show the Override problem - note the colours used:

Unable to install override: The __construct method in the Order class has already been overwritten.

  1. We recommend you to enable the technical break in the store for the time of solving the problem.
  2. You should rename the file: /override/classes/Order.php to: /override/classes/_Order.php
  3. Install the module at which the problem occurs.
  4. Now you need to merge the two files: /override/classes/Order.php and /override/classes/_Order.php into one file: /override/classes/Order.php
    1. If you are not familiar with this - I recommend contacting a programmer or sending us both files as a ticket to helpdesk.prestashow.pl
    2. After merging, you can delete the file: /override/classes/_Order.php
  5. To make PrestaShop refresh the cache - delete the file: /cache/classes_index.php
  6. Enter the store and check if everything works well and there are no messages.
  7. Turn off the technical break in the store.

Please Wait!

Please wait... it will take a second!

Kliknij by skopiować