yaniv14 Posted January 21, 2016 Share Posted January 21, 2016 (edited) I am using Prestashop 1.6.1.4 and all seem to be working fine except escaping json returned data from ajax call. Using blocklayered navigation giving error 500 when trying to render/escape json data from server to product-list.tpl. Regular pages which use the same file (product-list.tpl) working just fine. The error I am getting is: Undefined index: escape in/home/xxx/public_html/cache/smarty/compile/e4/a1/fd/e4a1fd2f5285aae65055ce86ad9af69b31b94166.file.product-list.tpl.php on line 95Fatal error: Call to a member function escape() on a non-object in/home/xxx/public_html/cache/smarty/compile/e4/a1/fd/e4a1fd2f5285aae65055ce86ad9af69b31b94166.file.product-list.tpl.php on line 95 This is a brand new server and at the beginning I had also an issue when trying to truncate chars so I had to install mbstring thru EasyApache 3 and everything was fixed. My guess is that I am missing some mod/extension/plugin for Apache or PHP. Any help will be apreciated. Edited February 25, 2016 by yaniv14 (see edit history) Link to comment Share on other sites More sharing options...
JFCS Posted February 11, 2016 Share Posted February 11, 2016 HI, I have the same problem. Can you explain what did you do to solve it exactly? Thanks! Link to comment Share on other sites More sharing options...
yaniv14 Posted February 11, 2016 Author Share Posted February 11, 2016 I am still struggling with this module on different sever and it seems that it has some issues with smarty cache. Try to disable Smart cache in BO and clear all cache and check if its working for you. For now I disabled the smarty cache to get this module working but it slows down the page loading time because the templates are not cached. Link to comment Share on other sites More sharing options...
JFCS Posted February 12, 2016 Share Posted February 12, 2016 Thanks!!! I have disabled Smart Cache and clear all caches and now is working! I don't understand, yesterday i did it and not work. I will proof and investigate to look for a better solution. Link to comment Share on other sites More sharing options...
Kerm Posted February 20, 2016 Share Posted February 20, 2016 (edited) Hello, i have same issue too, i dont understand what do to, help me pls. I google this: http://stackoverflow.com/questions/34916901/smarty3-escape-not-working-with-json/34934014But i dont have apache on my server, nginx+php-fpm.... [20-Feb-2016 15:48:14 Europe/Moscow] PHP Notice: Undefined index: escape in /var/www/www/data/www/dev.wwwwear.com/cache/smarty/compile/2a/75/b0/2a75b02d6db6ad53f61cd17d971a0547e0319100.file.product-list.tpl.php on line 92 [20-Feb-2016 15:48:14 Europe/Moscow] PHP Fatal error: Call to a member function escape() on a non-object in /var/www/www/data/www/dev.wwwwear.com/cache/smarty/compile/2a/75/b0/2a75b02d6db6ad53f61cd17d971a0547e0319100.file.product-list.tpl.php on line 92 PS.: I have two site on this server, one on 1.6.0.14 (where is problem) and one one 1.6.1.4....on newest version no problem... Edited February 20, 2016 by Kerm (see edit history) Link to comment Share on other sites More sharing options...
yaniv14 Posted February 20, 2016 Author Share Posted February 20, 2016 I posted that question on stackoverflow and I thought he was fixed but I still get that issue. I have 2 shops on ps 1.6.1.4 one with nginx and one with apache and both have the same issue. So I still don't have any lead. Link to comment Share on other sites More sharing options...
Kerm Posted February 24, 2016 Share Posted February 24, 2016 I have on one server installed 1.4....1.6.0.14 and 1.6.1.4 versions, and only 1.6.0.14 have this issue... Link to comment Share on other sites More sharing options...
yaniv14 Posted February 24, 2016 Author Share Posted February 24, 2016 Are you using one page checkout module? Link to comment Share on other sites More sharing options...
Kerm Posted February 25, 2016 Share Posted February 25, 2016 Are you using one page checkout module? I use onepagecheckoutps module http://addons.prestashop.com/ru/8503-one-page-checkout-ps-easy-fast-intuitive.html On both versions 1.6.0.14 and 1.6.1.4 Link to comment Share on other sites More sharing options...
yaniv14 Posted February 25, 2016 Author Share Posted February 25, 2016 Replace the file classes/OnePageCheckoutPSCore.php with the one I attached here and let me know if its working for you. Make backup of the file just in case. OnePageCheckoutPSCore.php Link to comment Share on other sites More sharing options...
Kerm Posted February 25, 2016 Share Posted February 25, 2016 Replace the file classes/OnePageCheckoutPSCore.php with the one I attached here and let me know if its working for you. Make backup of the file just in case. OnePageCheckoutPSCore.php You think this file can somehow cause these errors in product-list.tpl file? Link to comment Share on other sites More sharing options...
yaniv14 Posted February 25, 2016 Author Share Posted February 25, 2016 Yes, look at the original file and you can see the smarty escape override. Link to comment Share on other sites More sharing options...
Kerm Posted February 25, 2016 Share Posted February 25, 2016 Yes, look at the original file and you can see the smarty escape override. I have newest version of this module and my file is different from yours. look please: OnePageCheckoutPSCore.php I try use your file, but got errors. Link to comment Share on other sites More sharing options...
yaniv14 Posted February 25, 2016 Author Share Posted February 25, 2016 And is it working? Link to comment Share on other sites More sharing options...
Kerm Posted February 25, 2016 Share Posted February 25, 2016 Ok i think is done, i change on this: public function __construct($name = null, $context = null) { $this->errors = array(); $this->warnings = array(); $this->params_back = array(); $this->globals = new stdClass(); $this->fillGlobalVars(); parent::__construct($name, $context); $file_smarty_config = _PS_ROOT_DIR_.'/config/smarty.config.inc.php'; if (is_file($file_smarty_config)) { if (is_writable($file_smarty_config)) { $content = Tools::file_get_contents($file_smarty_config); if (!strstr($content, 'escapePTS')) { $content .= ' //CODE MODULES PRESTEAMSHOP - PLEASE NOT REMOVE //-------------------------------------------------------------------------------------------------------- smartyRegisterFunction($smarty, "modifier", "escape", "escapePTS"); function escapePTS($string, $esc_type = "html", $char_set = null, $double_encode = true, $as_html = false) { $smarty_escape = SMARTY_PLUGINS_DIR."modifier.escape.php"; include_once $smarty_escape; if (!$as_html && is_callable("smarty_modifier_escape")) { $string = call_user_func("smarty_modifier_escape", $string, $esc_type, $char_set, $double_encode); } else { $string = html_entity_decode($string); } return $string; } //-------------------------------------------------------------------------------------------------------- '; file_put_contents($file_smarty_config, $content); } } } $this->smarty = $this->context->smarty; $this->cookie = $this->context->cookie; $this->fillConfigVars(); } And remove escape function at end of file.... 2 Link to comment Share on other sites More sharing options...
Kerm Posted February 25, 2016 Share Posted February 25, 2016 (edited) And is it working? Yes, thx! PS.: I have installed this module on 1.6.1.4 also, and here i dont see any problem. For me, problem only on 1.6.0.14 Edited February 25, 2016 by Kerm (see edit history) Link to comment Share on other sites More sharing options...
zanpo Posted March 24, 2016 Share Posted March 24, 2016 (edited) Ok i think is done, i change on this: public function __construct($name = null, $context = null) { $this->errors = array(); $this->warnings = array(); $this->params_back = array(); $this->globals = new stdClass(); $this->fillGlobalVars(); parent::__construct($name, $context); $file_smarty_config = _PS_ROOT_DIR_.'/config/smarty.config.inc.php'; if (is_file($file_smarty_config)) { if (is_writable($file_smarty_config)) { $content = Tools::file_get_contents($file_smarty_config); if (!strstr($content, 'escapePTS')) { $content .= ' //CODE MODULES PRESTEAMSHOP - PLEASE NOT REMOVE //-------------------------------------------------------------------------------------------------------- smartyRegisterFunction($smarty, "modifier", "escape", "escapePTS"); function escapePTS($string, $esc_type = "html", $char_set = null, $double_encode = true, $as_html = false) { $smarty_escape = SMARTY_PLUGINS_DIR."modifier.escape.php"; include_once $smarty_escape; if (!$as_html && is_callable("smarty_modifier_escape")) { $string = call_user_func("smarty_modifier_escape", $string, $esc_type, $char_set, $double_encode); } else { $string = html_entity_decode($string); } return $string; } //-------------------------------------------------------------------------------------------------------- '; file_put_contents($file_smarty_config, $content); } } } $this->smarty = $this->context->smarty; $this->cookie = $this->context->cookie; $this->fillConfigVars(); } And remove escape function at end of file.... Thanks it's working for me. I'm on Prestashop 1.6.1.1 with onepagecheckoutps v2.1.4. I was having errors in admin, when using the search function, received error 500: Undefined index: escape in cache/smarty/compile/c9/c5/9d/c9c59dbc5a2d699170b6a31908f00d90b430ac61.file.blockcart.tpl.php on line 70 It only worked if I cleared the cache. But now I don't see these errors anymore. Thanks! Edited March 24, 2016 by zanpo (see edit history) 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