musicmaster Posted August 19, 2017 Share Posted August 19, 2017 (edited) I recently added a tool to Prestools that shows you which overrides your webshop has. To do that I look for files. If a modules has an override directory then I can find which overrides it has and when I find the same overrides in the main override directory I know where they cam from. Problem is that I found that the OnePageCheckout module of PresTeamShop does not has an override directory in its root but instead has an override subdirectory beneath a "public" directory. That raises the questions whether other modules have their overrides somewhere else too and what the rules are for that. Can anyone enlighten me? Edited August 19, 2017 by musicmaster (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted August 20, 2017 Share Posted August 20, 2017 before prestashop automatically installed overrides, it was the modules job to copy the override file to the correct location. And since there was no folder standard, a module author could store their override files in any directory in the module that they wanted to. A module might also include overrides, but not want them installed automatically. Perhaps there is an optional feature that requires an override, and if the merchant wants to use it, then they would need to manually install the overrides. again in this case, the module author could put these files anywhere. So if you are looking for overrides that were installed automatically, then just check for the overrides folder in the module. 2 Link to comment Share on other sites More sharing options...
Scully Posted August 21, 2017 Share Posted August 21, 2017 Bellini is right. Or in short words: Before module installation, the override files can be anywhere. After installation they are copied to the /override path into the corresponding directories. 1 Link to comment Share on other sites More sharing options...
musicmaster Posted August 21, 2017 Author Share Posted August 21, 2017 Hi Bellini and Scully, Thank you for your reply. One additional question: what are in your experience the most common locations for modules to store their overrides? Link to comment Share on other sites More sharing options...
Scully Posted August 21, 2017 Share Posted August 21, 2017 It can by everywhere. But a good coder might use the same path structure within the modules path as prestashop uses in general. so the modules base path, /classes, /controllers, /override would be choices, following the sub path in these directories as well. But it's not fixed and accordidng to what I know there is also no directive from prestashop. Link to comment Share on other sites More sharing options...
Scully Posted August 21, 2017 Share Posted August 21, 2017 BTW - why don't you read the file ./cache/class_index.php ? There you should find all information on installed overrides. Link to comment Share on other sites More sharing options...
pedepot Posted August 21, 2017 Share Posted August 21, 2017 As per the documentation Prestashop will look for the override files the module's folders /override/classes or /override/controllers. Usually Prestashop developers have their own module framework that could move the files accordingly. Don't get deceived! Link to comment Share on other sites More sharing options...
musicmaster Posted August 21, 2017 Author Share Posted August 21, 2017 (edited) BTW - why don't you read the file ./cache/class_index.php ? There you should find all information on installed overrides. Thank you for the suggestion. It sounded like a good idea. Until I tested... I made a copy of class_index.php. Then I enabled a module with overrides. But although class_index.php was regenerated its content stayed exactly the same. Also, it doesn't mention which module owns an override. Edited August 21, 2017 by musicmaster (see edit history) Link to comment Share on other sites More sharing options...
easy-it Posted August 30, 2017 Share Posted August 30, 2017 Hello I just migrated my site to 1.6.1.16 One of my overrides (ProductSale.php) no longer works. If I look at the contents of class_index.php I have this: 'ProductSaleCore' => Array ( 'Path' => 'override/classes/ProductSale.php', 'Type' => 'class', 'Override' => false, Is there a problem generating the file class_index.php ? Thank you for your comeback. Link to comment Share on other sites More sharing options...
easy-it Posted August 30, 2017 Share Posted August 30, 2017 Another question: when you want to override a file in a module, should you copy the entire module into the override/modules directory or just the file whose contents you want to modify ? Thank you again for your help. Link to comment Share on other sites More sharing options...
Scully Posted August 30, 2017 Share Posted August 30, 2017 Is there a problem generating the file class_index.php ? Thank you for your comeback. Not that I am aware of. Another question: when you want to override a file in a module, should you copy the entire module into the override/modules directory or just the file whose contents you want to modify ? Typically we try to override with the minimum of changes and the minimum of code. If for example we have only one small function modified, we create an override only for this and not an entire class or module. If you copy all or many files or function, you don't see differences betweeen original setup and override without doing many file compares. Link to comment Share on other sites More sharing options...
easy-it Posted August 30, 2017 Share Posted August 30, 2017 Thanks for your return. My question on file class_index.php was on the override parameter which is false while the path is correct. Link to comment Share on other sites More sharing options...
Scully Posted August 30, 2017 Share Posted August 30, 2017 All our override parameters are also false. I don't care since the overrides all work as intended. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now