Prestashop Core Application V1.5

Enhance override interface for modules

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Labels:
    None
  • Similar issues:
    PSCFV-7022 Improvements on shop setting interfaces
    PSCFV-7050 Perf enhancement : in modules contructor, avoid contruction specific for back_office
    PSCFV-5999 cant't install Module override because of override file doesn't exists
    PSCFV-7406 Override mail template from module
    PSCFV-4906 Override module templates can't translate
    PSCFV-5512 Automatic override from a module deletes duplicate if any
    PSCFV-9105 On module install, overrided pdf class don't create a copy to override/pdf
    PSCFV-7370 Override back office templates when a module is installed

Description

Module X needs to override FrontController (and it is already overriden/customized)

Option a) Go ahead and override... in the process cloberring any other overrides or customizations
Option b) Notice that it is already overriden and abort, failing install
Option c) Painstakingly parse the override trying to make sense of what was overriden and work aroud it

Can we have an option d please?

Create table overrides - class, member, overrider
Module (or Tools)::isOverriden(class, member)
Module::addOverride(class, member)
Module::removeOverride(class, member)

or even Module->overrides = array { classA =. member, classB =>member }

Or alternatively provide per module overrides in modules/module/overrides/...

pretty please?

Activity

Hide
Raphaël MALIE added a comment - 11/May/12 2:44 PM

Hello,
your idea is now implemented
You can add a folder override/ in your module where you put the files you want to override, and all method of these files will be imported in the original override/ folder. For example do a test module with a file modules/test/override/classes/Product.php, add a method in your file, and when the module will be installed open the file override/classes/Product.php, you will see that the code is copied in

Regards

Show
Raphaël MALIE added a comment - 11/May/12 2:44 PM Hello, your idea is now implemented You can add a folder override/ in your module where you put the files you want to override, and all method of these files will be imported in the original override/ folder. For example do a test module with a file modules/test/override/classes/Product.php, add a method in your file, and when the module will be installed open the file override/classes/Product.php, you will see that the code is copied in Regards
Hide
phrasespot added a comment - 24/May/12 10:45 AM

Great, but what happens if two modules both override the same method of Product class e.g.?

Show
phrasespot added a comment - 24/May/12 10:45 AM Great, but what happens if two modules both override the same method of Product class e.g.?
Hide
Raphaël MALIE added a comment - 25/May/12 9:48 AM

If two modules add the same method, the second one will return false during install, so you can't install two modules with same override.

Show
Raphaël MALIE added a comment - 25/May/12 9:48 AM If two modules add the same method, the second one will return false during install, so you can't install two modules with same override.
Hide
DevNet added a comment - 25/Oct/12 1:50 PM

This conflict implement erase the previous method and don't install the new, see http://forge.prestashop.com/browse/PSCFV-5252

Show
DevNet added a comment - 25/Oct/12 1:50 PM This conflict implement erase the previous method and don't install the new, see http://forge.prestashop.com/browse/PSCFV-5252

People

Vote (0)
Watch (0)

Dates

  • Created:
    15/Mar/12 9:40 AM
    Updated:
    25/Oct/12 1:50 PM
    Resolved:
    28/Jun/12 9:16 AM