ManuelAva Posted August 13, 2021 Share Posted August 13, 2021 Hello there, I've been working on some modifications. So far, no problem. However, I am experiencing an odd situation: Problem: I've been trying to override CustomerPersisterCore (/classes/form/CustomerPersister.php). However, the override is being ignored - not happening for the other ones, jsut in this particular case. I am placing it in the correct place and using the standard way of doing it CustomerPersister extends CustomerPersisterCore{ functionIwantTooverride(){ .... } } I've been reading the docs and these forums but have been unable to find/fix the problem. All my others overrides are working as expected. Things I've tried: ensuring that my cache is deleted, trying "CustomerPersisterOverride" instead of "CustomerPersister" for the class name (suggested by a colleague), double checking my folder structure, and checking that there are no problems in my function, among other things I cant remember now. The parent method is still being invoked instead of the overriden one. The most similar case I've found is this one: although it is not the same class we are stuck in. At this point, what I have done is coyping the whole class in /override/classes/form/CustomerPersister.php and modifyin the method there. Then, it is "accepting" the override -although the override of the whole class so to speak. At least, I didnt have to modify the source class itself. Any help is welcome. Thanks for reading! Link to comment Share on other sites More sharing options...
SmartDataSoft Posted August 13, 2021 Share Posted August 13, 2021 Hello, Which version of PrestaShop you are using. Did you clear the cache from /var/cache/pro and /var/cache/dev Also please check the class name. the new overwrite class name will be without core and it will extended the core class. If their is any full code to check. I will try to review the code Thank you 1 Link to comment Share on other sites More sharing options...
ManuelAva Posted August 17, 2021 Author Share Posted August 17, 2021 On 8/13/2021 at 4:56 PM, SmartDataSoft said: Hello, Which version of PrestaShop you are using. Did you clear the cache from /var/cache/pro and /var/cache/dev I am using 1.7.7.5. Yes, we did clear the cache many times. On 8/13/2021 at 4:56 PM, SmartDataSoft said: Also please check the class name. the new overwrite class name will be without core and it will extended the core class. Yes, we double (or three or four times) checked that the naming convention was correct. On 8/13/2021 at 4:56 PM, SmartDataSoft said: If their is any full code to check. I will try to review the code Very kind of you, I am attaching the pàrent files (CustomerPersister.php), how we tried to override it (CustomerPersister_override.php*) and how we "faked" the override (CustomerPersister_fakeOverride) Note that ubication for the overriden file is: /override/classes/form/CustomerPersister.php (/classes/form/CustomerPersister.php for the parent class) Kind regards *Just using this name here for people to differentiate the files, in the real version we named it as CustomerPersister.php, just as the parent file. CustomerPersister_fakeOverride.php CustomerPersister.php CustomerPersister_overrid.php 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