ContextErrorException注意:未定义索引:ps_sharebuttons.php第138行中的产品
当我启用模式DePub时,我的prestashop 1.7项目中出现以下错误: ContextErrorException注意:未定义索引:ps_sharebuttons.php第138行中的产品 第138行看起来像: $key='ps_sharebuttons |'$参数['product']['id_product'] 完整代码:ContextErrorException注意:未定义索引:ps_sharebuttons.php第138行中的产品,php,prestashop-1.7,Php,Prestashop 1.7,当我启用模式DePub时,我的prestashop 1.7项目中出现以下错误: ContextErrorException注意:未定义索引:ps_sharebuttons.php第138行中的产品 第138行看起来像: $key='ps_sharebuttons |'$参数['product']['id_product'] 完整代码: public function renderWidget($hookName, array $params) { $key = 'ps_sharebutt
public function renderWidget($hookName, array $params)
{
$key = 'ps_sharebuttons|' . $params['product']['id_product'];
if (!empty($params['product']['id_product_attribute'])) {
$key .= '|' . $params['product']['id_product_attribute'];
}
if (!$this->isCached($this->templateFile, $this->getCacheId($key))) {
$this->smarty->assign($this->getWidgetVariables($hookName, $params));
}
请帮忙 这似乎是ps_sharebuttons模块的问题,请检查是否有最新版本,也许 如果您只是想消除警告,只需修改代码,如下所示:
public function renderWidget($hookName, array $params)
{
if (isset($params['product'])) {
$key = 'ps_sharebuttons|' . $params['product']['id_product'];
rest of the code here ...
}