vansrv7 Posted May 9, 2014 Share Posted May 9, 2014 (edited) I have a bug in my blockspecial module (PS 1.5.6.1, module v. 1.0) If I log-in as a foreign user registered with VAT ID, I correctly see the prices without taxes. By the way, if there are products on offer shown in the blockspecial module, i get the error: Notice: Undefined index: priceWithoutReduction_tax_excl inC:\xampp\htdocs\prestashop\cache\smarty\compile\50\97\54\509754be458c82ea8c05f115388675b1b9c82496.file.blockspecials.tpl.phpon line 79 Notice: Trying to get property of non-object inC:\xampp\htdocs\prestashop\cache\smarty\compile\50\97\54\509754be458c82ea8c05f115388675b1b9c82496.file.blockspecials.tpl.phpon line 79 Note that the message is shown inside the special offers products (not visible in f12 console, debug mode activated). If I log out (or if I login as a non-VAT rgistered user) everything works correctly. My deduction is that the problem is caused by the combination of discounted products and prices shown without taxes. Do someone is able to help? Edited May 12, 2014 by vansrv7 (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted May 10, 2014 Share Posted May 10, 2014 Are you using a custom template? Or the default one? Link to comment Share on other sites More sharing options...
vansrv7 Posted May 10, 2014 Author Share Posted May 10, 2014 Hi Nemo, thank you for your reply. I'm using a custom template. Link to comment Share on other sites More sharing options...
NemoPS Posted May 12, 2014 Share Posted May 12, 2014 Can you try switching to the default one and seeing if it still happens? Link to comment Share on other sites More sharing options...
vansrv7 Posted May 12, 2014 Author Share Posted May 12, 2014 Hi Nemo, yes, it's the same with default theme also. Link to comment Share on other sites More sharing options...
NemoPS Posted May 12, 2014 Share Posted May 12, 2014 Hm, ok, open blockspecials.php and see if you have this: $this->smarty->assign(array( 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); In hookRightColumn Link to comment Share on other sites More sharing options...
vansrv7 Posted May 12, 2014 Author Share Posted May 12, 2014 Hi Nemo, the code exists, by the way, for some reason, the 3rd line was commented (/* ... */). I removed the comment but I still have an error on the same line: Notice: Undefined index: price_without_reduction in C:\xampp\htdocs\prestashop\modules\blockspecials\blockspecials.php on line 121 Now the error is shown even if I'm not logged as a foreign customer (ie. not only for non-vat discounted products). More, if I'm logged in, the old price (without discount) is 0.00 Link to comment Share on other sites More sharing options...
NemoPS Posted May 12, 2014 Share Posted May 12, 2014 Did you have someone edit that file? that hooking method should look like public function hookRightColumn($params) { if (Configuration::get('PS_CATALOG_MODE')) return; // We need to create multiple caches because the products are sorted randomly $random = date('Ymd').'|'.round(rand(1, max(Configuration::get('BLOCKSPECIALS_NB_CACHES'), 1))); if (!Configuration::get('BLOCKSPECIALS_NB_CACHES') || !$this->isCached('blockspecials.tpl', $this->getCacheId('blockspecials|'.$random))) { if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; $this->smarty->assign(array( 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); } return $this->display(__FILE__, 'blockspecials.tpl', (Configuration::get('BLOCKSPECIALS_NB_CACHES') ? $this->getCacheId('blockspecials|'.$random) : null)); } Link to comment Share on other sites More sharing options...
vansrv7 Posted May 12, 2014 Author Share Posted May 12, 2014 No, I don't remeber I ever modified that file. By the way, it looks exactly like the one you posted except for the line if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) that in my case is if (!($special= Product::getPricesDrop((int)$params['cookie']->id_lang,0,5)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) If I modify this, I get a new world of error messages Warning: Illegal string offset 'specific_prices' in C:\xampp\htdocs\prestashop\cache\smarty\compile\50\97\54\509754be458c82ea8c05f115388675b1b9c82496.file.blockspecials.tpl.php on line 64 Warning: Illegal string offset 'specific_prices' in C:\xampp\htdocs\prestashop\cache\smarty\compile\50\97\54\509754be458c82ea8c05f115388675b1b9c82496.file.blockspecials.tpl.php on line 65Warning: Illegal string offset 'reduction_type' in C:\xampp\htdocs\prestashop\cache\smarty\compile\50\97\54\509754be458c82ea8c05f115388675b1b9c82496.file.blockspecials.tpl.php on line 66 - See more at: http://127.0.0.1/prestashop/sherline/index.php?id_product=9&controller=product&id_lang=1#sthash.Y8w8jkJz.dpuf and so on.... (maybe 50-60 messages) Link to comment Share on other sites More sharing options...
vansrv7 Posted May 12, 2014 Author Share Posted May 12, 2014 Ok, solved. Don't know exactly where the problem was, I simply copied blockspecial.php and blockspecial.tpl from downloaded PS installation back to the relative folder in my installation. Now it works. Thank you for your help. Link to comment Share on other sites More sharing options...
NemoPS Posted May 14, 2014 Share Posted May 14, 2014 It seems like you (or someone else) adapted my tutorial there, as it's only supposed to show 1 special, not multiple, by default Link to comment Share on other sites More sharing options...
kirubanidhi Posted June 29, 2017 Share Posted June 29, 2017 I'm also facing this notice undefined index problem. "28 Jun 2017 02:12:35","/home2/science/public_html/shop/cache/smarty/compile/f9/fb/48/f9fb48946cee513553c5f40617986411256da877.file.search.tpl.php:138","(Notice) Undefined index: search_query" "28 Jun 2017 02:12:35","/home2/science/public_html/shop/cache/smarty/compile/f9/fb/48/f9fb48946cee513553c5f40617986411256da877.file.search.tpl.php: 138","(Notice) Trying to get property of non-object" Please give me any idea to resolve this problem. Link to comment Share on other sites More sharing options...
Recommended Posts