Jump to content

Recommended Posts

I am using Prestashop 1.6.1.4 with custom template, my website home page giving 500 error.

Thanks for help

 

[PrestaShopException]

Invalid product vars
at line 106 in file classes/Link.php

101.             if (is_array($product) && isset($product['id_product'])) {102.                 $product = new Product($product['id_product'], false, $id_lang, $id_shop);103.             } elseif ((int)$product) {104.                 $product = new Product((int)$product, false, $id_lang, $id_shop);105.             } else {106.                 throw new PrestaShopException('Invalid product vars');107.             }108.         }109. 110.         // Set available keywords111.         $params = array();
  • LinkCore->getProductLink - [line 78 - cache/smarty/compile/9c/d8/96/9cd896c29bb14ff463b19598e27d5983009e7b8d.file.productcomments_reviews.tpl.cache.php] - [1 Arguments]
    73. 		</div>74. 	</div>75. <?php } else { ?>76. 	<div class="comments_note" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">77. 		<div class="star_content clearfix">78. 			<a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['link']->value->getProductLink($_smarty_tpl->tpl_vars['product']->value), ENT_QUOTES, 'UTF-8', true);?>79. #idTab5"><span class="nb-comments"><?php echo smartyTranslate(array('s'=>'Review','mod'=>'productcomments'),$_smarty_tpl);?>80. </span></a>81. 		</div>82. 	</div>83. <?php }?>
  • content_57187192140d41_11426827 - [line 188 - tools/smarty/sysplugins/smarty_internal_templatebase.php] - [1 Arguments]
    183.                         }184.                         array_unshift($_template->_capture_stack, array());185.                         //186.                         // render compiled template187.                         //188.                         $_template->properties['unifunc']($_template);189.                         // any unclosed {capture} tags ?190.                         if (isset($_template->_capture_stack[0][0])) {191.                             $_template->capture_error();192.                         }193.                         array_shift($_template->_capture_stack);
  • Smarty_Internal_TemplateBase->fetch - [line 308 - classes/SmartyCustom.php] - [7 Arguments]
    303.     public $smarty = null;304. 305.     public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)306.     {307.         if ($this->smarty->caching) {308.             $tpl = parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);309.             if (property_exists($this, 'cached')) {310.                 $filepath = str_replace($this->smarty->getCacheDir(), '', $this->cached->filepath);311.                 if ($this->smarty->is_in_lazy_cache($this->template_resource, $this->cache_id, $this->compile_id) != $filepath) {312.                     $this->smarty->update_filepath($filepath, $this->template_resource, $this->cache_id, $this->compile_id);313.                 }
  • Smarty_Custom_Template->fetch - [line 2309 - classes/module/Module.php]
    2304. 2305.             if ($cache_id !== null) {2306.                 Tools::enableCache();2307.             }2308. 2309.             $result = $this->getCurrentSubTemplate($template, $cache_id, $compile_id)->fetch();2310. 2311.             if ($cache_id !== null) {2312.                 Tools::restoreCacheSettings();2313.             }2314. 
  • ModuleCore->display - [line 772 - modules/productcomments/productcomments.php] - [3 Arguments]
    767. 				'averageTotal' => round($average['grade']),768. 				'ratings' => ProductComment::getRatings($id_product),769. 				'nbComments' => (int)ProductComment::getCommentNumber($id_product)770. 			));771. 		}772. 		return $this->display(__FILE__, 'productcomments_reviews.tpl', $this->getCacheId($id_product));773. 	}774. 775. 	public function hookDisplayRightColumnProduct($params)776. 	{777. 		require_once(dirname(__FILE__).'/ProductComment.php');
  • ProductComments->hookDisplayProductListReviews - [line 587 - classes/Hook.php] - [1 Arguments]
    582.             }583.         }584. 585.         // Immediately return the result if we do not log performances586.         if (!Module::$_log_modules_perfs) {587.             return $module->{$method}($params);588.         }589. 590.         // Store time and memory before and after hook call and save the result in the database591.         $time_start = microtime(true);592.         $memory_start = memory_get_usage(true);
  • HookCore::coreCallHook - [line 542 - classes/Hook.php] - [3 Arguments]
    537.                     Tools::waitUntilFileIsModified($moduleInstance->push_filename, $moduleInstance->push_time_limit);538.                 }539. 540.                 // Call hook method541.                 if ($hook_callable) {542.                     $display = Hook::coreCallHook($moduleInstance, 'hook'.$hook_name, $hook_args);543.                 } elseif ($hook_retro_callable) {544.                     $display = Hook::coreCallHook($moduleInstance, 'hook'.$retro_hook_name, $hook_args);545.                 }546. 547.                 // Live edit
  • HookCore::exec - [line 205 - config/smarty.config.inc.php] - [3 Arguments]
    200.                 $id_module = $module->id;201.             }202.             unset($hook_params['mod']);203.         }204.         unset($hook_params['h']);205.         return Hook::exec($params['h'], $hook_params, $id_module);206.     }207. }208. 209. function smartyCleanHtml($data)210. {
  • smartyHook - [line - ] - [2 Arguments]
    Argument [0]Array(    [h] => displayProductListReviews    [product] => )Argument [1]
  • call_user_func_array - [line 268 - config/smarty.config.inc.php] - [2 Arguments]
    263.                 } else {264.                     $args[] = &$arguments[$a];265.                 }266.             }267. 268.             return call_user_func_array($item, $args);269.         }270.     }271. 272.     public static function getInstance()273.     {
  • SmartyLazyRegister->__call - [line 86 - cache/smarty/compile/ac/a4/45/aca4450121af6a685a816faad27137513406f5dd.file.wtspecials.tpl.cache.php] - [2 Arguments]
    81. 										<a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['link'], ENT_QUOTES, 'UTF-8', true);?>82. " title="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['legend'], ENT_QUOTES, 'UTF-8', true);?>83. "><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER]['truncate'][0][0]->smarty_modifier_truncate(htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['name'], ENT_QUOTES, 'UTF-8', true),18,'');?>84. </a>85. 									</h5>86. 									<?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['hook'][0][0]->smartyHook(array('h'=>'displayProductListReviews','product'=>$_smarty_tpl->tpl_vars['product']->value),$_smarty_tpl);?>87. 88. 									<p class="product-desc" itemprop="description">89. 										<?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER]['truncate'][0][0]->smarty_modifier_truncate(htmlspecialchars(preg_replace('!<[^>]*?>!', ' ', $_smarty_tpl->tpl_vars['product']->value['description_short']), ENT_QUOTES, 'UTF-8', true),90,'...');?>90. 91. 									</p>
  • SmartyLazyRegister->smartyHook - [line 86 - cache/smarty/compile/ac/a4/45/aca4450121af6a685a816faad27137513406f5dd.file.wtspecials.tpl.cache.php] - [2 Arguments]
    81. 										<a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['link'], ENT_QUOTES, 'UTF-8', true);?>82. " title="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['legend'], ENT_QUOTES, 'UTF-8', true);?>83. "><?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER]['truncate'][0][0]->smarty_modifier_truncate(htmlspecialchars($_smarty_tpl->tpl_vars['product']->value['name'], ENT_QUOTES, 'UTF-8', true),18,'');?>84. </a>85. 									</h5>86. 									<?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['hook'][0][0]->smartyHook(array('h'=>'displayProductListReviews','product'=>$_smarty_tpl->tpl_vars['product']->value),$_smarty_tpl);?>87. 88. 									<p class="product-desc" itemprop="description">89. 										<?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER]['truncate'][0][0]->smarty_modifier_truncate(htmlspecialchars(preg_replace('!<[^>]*?>!', ' ', $_smarty_tpl->tpl_vars['product']->value['description_short']), ENT_QUOTES, 'UTF-8', true),90,'...');?>90. 91. 									</p>
  • content_57187192563646_69638354 - [line 188 - tools/smarty/sysplugins/smarty_internal_templatebase.php] - [1 Arguments]
    183.                         }184.                         array_unshift($_template->_capture_stack, array());185.                         //186.                         // render compiled template187.                         //188.                         $_template->properties['unifunc']($_template);189.                         // any unclosed {capture} tags ?190.                         if (isset($_template->_capture_stack[0][0])) {191.                             $_template->capture_error();192.                         }193.                         array_shift($_template->_capture_stack);
  • Smarty_Internal_TemplateBase->fetch - [line 308 - classes/SmartyCustom.php] - [7 Arguments]
    303.     public $smarty = null;304. 305.     public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)306.     {307.         if ($this->smarty->caching) {308.             $tpl = parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);309.             if (property_exists($this, 'cached')) {310.                 $filepath = str_replace($this->smarty->getCacheDir(), '', $this->cached->filepath);311.                 if ($this->smarty->is_in_lazy_cache($this->template_resource, $this->cache_id, $this->compile_id) != $filepath) {312.                     $this->smarty->update_filepath($filepath, $this->template_resource, $this->cache_id, $this->compile_id);313.                 }
  • Smarty_Custom_Template->fetch - [line 2309 - classes/module/Module.php]
    2304. 2305.             if ($cache_id !== null) {2306.                 Tools::enableCache();2307.             }2308. 2309.             $result = $this->getCurrentSubTemplate($template, $cache_id, $compile_id)->fetch();2310. 2311.             if ($cache_id !== null) {2312.                 Tools::restoreCacheSettings();2313.             }2314. 
  • ModuleCore->display - [line 208 - modules/wtspecials/wtspecials.php] - [3 Arguments]
    203. 				'new_products' => $products,204. 				'wtconfig' => $this->_config,205. 				'banner_path' => $this->_path.'views/img/banner/',206. 			));207. 		}208. 		return $this->display(__FILE__, 'wtspecials.tpl', $this->getCacheId());209. 	}210. 	public function hookDisplayTopHome()211. 	{212. 		return $this->hookDisplayHome();213. 	}
  • WtSpecials->hookDisplayHome - [line 587 - classes/Hook.php] - [1 Arguments]
    582.             }583.         }584. 585.         // Immediately return the result if we do not log performances586.         if (!Module::$_log_modules_perfs) {587.             return $module->{$method}($params);588.         }589. 590.         // Store time and memory before and after hook call and save the result in the database591.         $time_start = microtime(true);592.         $memory_start = memory_get_usage(true);
  • HookCore::coreCallHook - [line 542 - classes/Hook.php] - [3 Arguments]
    537.                     Tools::waitUntilFileIsModified($moduleInstance->push_filename, $moduleInstance->push_time_limit);538.                 }539. 540.                 // Call hook method541.                 if ($hook_callable) {542.                     $display = Hook::coreCallHook($moduleInstance, 'hook'.$hook_name, $hook_args);543.                 } elseif ($hook_retro_callable) {544.                     $display = Hook::coreCallHook($moduleInstance, 'hook'.$retro_hook_name, $hook_args);545.                 }546. 547.                 // Live edit
  • HookCore::exec - [line 40 - controllers/front/IndexController.php] - [1 Arguments]
    35.     public function initContent()36.     {37.         parent::initContent();38.         $this->addJS(_THEME_JS_DIR_.'index.js');39. 40.         $this->context->smarty->assign(array('HOOK_HOME' => Hook::exec('displayHome'),41.             'HOOK_HOME_TAB' => Hook::exec('displayHomeTab'),42.             'HOOK_HOME_TAB_CONTENT' => Hook::exec('displayHomeTabContent')43.         ));44.         $this->setTemplate(_PS_THEME_DIR_.'index.tpl');45.     }
  • IndexControllerCore->initContent - [line 189 - classes/controller/Controller.php]
    184.             if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {185.                 $this->initHeader();186.             }187. 188.             if ($this->viewAccess()) {189.                 $this->initContent();190.             } else {191.                 $this->errors[] = Tools::displayError('Access denied.');192.             }193. 194.             if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className))) {
  • ControllerCore->run - [line 367 - classes/Dispatcher.php]
    362.             if (isset($params_hook_action_dispatcher)) {363.                 Hook::exec('actionDispatcher', $params_hook_action_dispatcher);364.             }365. 366.             // Running controller367.             $controller->run();368.         } catch (PrestaShopException $e) {369.             $e->displayMessage();370.         }371.     }372. 
  • DispatcherCore->dispatch - [line 28 - index.php]
Edited by centralparkbikerent (see edit history)
Link to comment
Share on other sites

Hi

I didn't modified anything, I am adding the product from backend yesterday  and this happened, still backend works also all links works on the front end, only home page gives this error, any easy solution reinstall the modules or backup the temp and install again?

Thanks

Edited by centralparkbikerent (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

after a small analysis the issue could come from module wtspecials, where in the tpl, the value for $_smarty_tpl->tpl_vars['product']->value is empty(possibly in the  file productcomments_reviews.tpl ), it should contain a product object.

You could try to disable the wtspecials module,to be sure that this module is the problem, or talk directly with the theme developer to fix this module.

Regards, Leo

Link to comment
Share on other sites

  • 2 weeks later...
  • 6 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...