tryple Posted August 1, 2017 Share Posted August 1, 2017 (edited) (Solved) Hello everyone, I created an override of the Cart.php class to modify the getSummary function and to be able to retrieve a new variable to display in the cart summary.Well, everything works correctly until from the backoffice I delete the cache. Then it gives me error in eval () of the smarty indicating that the new variable is not created.I enter the hosting and delete the class_index.php file from the cache folder. From here everything begins to work again.It is as if every time I empty the cache I ignored the function modified with the override.In the overloaded function I have copied and pasted as is. I've just added a new variable that reads from an sql query.Do you know some why? Do I have to declare the variable somewhere or have I misconfigured prestashop? Thank you very much in advance. Edited August 1, 2017 by tryple (see edit history) Link to comment Share on other sites More sharing options...
Scully Posted August 28, 2017 Share Posted August 28, 2017 The problem if this behavior is at the end: just faulty code. When class_index.php is deleted, prestashop checks all folders for possible overrides and builds its code. At this stage, any php warning or error results in error in eval () of the smarty. Solution: fix the code of the override or module which causes this error. The name of the variable missing might help to find the piece of code. We usually use a complex grep on linux based systems to search for a specific code context. Link to comment Share on other sites More sharing options...
tryple Posted August 29, 2017 Author Share Posted August 29, 2017 Thank you very much for answering.In the code all I can do is check that the variable exists so that it does not show it in such a case.According to indicas with the grep would be a problem in the hosting of the web?Every time I do a cache empty or change the method of compiling the templates in the prestashop backoffice I have to delete the class_index.php Link to comment Share on other sites More sharing options...
Scully Posted August 29, 2017 Share Posted August 29, 2017 According to indicas with the grep would be a problem in the hosting of the web? this was not understood by me. many of these problems are caused by not using or not using the proper way with isset. Every time I do a cache empty or change the method of compiling the templates in the prestashop backoffice I have to delete the class_index.php And this looks like a buggy installation: Link to comment Share on other sites More sharing options...
tryple Posted August 29, 2017 Author Share Posted August 29, 2017 Ok, i use {if isset($var)}{display $var}{/if}. What is "And this looks like a buggy installation:" ? Link to comment Share on other sites More sharing options...
Scully Posted August 29, 2017 Share Posted August 29, 2017 The file class_index.php must only be deleted when installing new overrides or deleting existing ones. If you have to delete the file after every cache delete, there is some bug in your installation. It's normally not needed to delete this file when you delete the cache. Link to comment Share on other sites More sharing options...
tryple Posted August 29, 2017 Author Share Posted August 29, 2017 I use version 1.6.1.16. I have updated a couple of versions in case it was solved and was a prestashop bug.How could I locate the installation bug? Link to comment Share on other sites More sharing options...
tryple Posted August 29, 2017 Author Share Posted August 29, 2017 I made the override of the class Cart as follows: Class Cart extends CartCoreIt is right? 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