我正在使用magento一页签出的快速签出过程。
如果将产品添加到购物车中,则会引发致命错误。在j2t中,ajax和头购物车区域显示了致命错误,但是在重新加载页面错误之后,页面错误消失了,产品添加到购物车中。
在PHP错误日志中显示以下错误
PHP Fatal error: Call to a member function addLink() on a non-object in /home/public_html/app/code/community/IWD/Opc/Block/Links.php on line 17在第17行
$parentBlock->addLink($text, 'onepage', $text, true, array('_secure'=>true), 60, null, 'class="top-link-checkout"');我尝试过禁用ajax购物车,并将其编译为禁用的,但仍然抛出错误。
知道为什么会出现错误吗?
(预先谢谢:)
发布于 2014-05-31 10:23:17
我自己解决了这个问题。不管怎样,谢谢你。
如果有人有这个问题。这里是它的解决方案
转至: folder/app/code/community/IWD/Opc/Block/Links.php /Magento
查找:
if (Mage::helper('opc')->isEnable()){
$parentBlock->addLink($text, 'onepage', $text, true, array('_secure'=>true), 60, null, 'class="top-link-checkout"');
}
else{
$parentBlock->addLink($text, 'checkout', $text, true, array('_secure'=>true), 60, null, 'class="top-link-checkout"');
}
return $this;
}将其替换为:
if ($parentBlock = $this->getParentBlock()) {
$text = $this->__('Checkout');
$parentBlock->addLink($text, 'checkout', $text, true, array(), 60, null, 'class="top-link-checkout"');
}
return $this;
}清除缓存和cookie,您就完成了:)
发布于 2014-06-28 17:48:39
一种稍微好一些的方法(在IWD修复之前,也就是)是做Muk建议的事情,并将整个块包装在一个"is_object“检查中。
if (is_object($parentBlock)) {
$text = $this->__('Checkout');
if (Mage::helper('opc')->isEnable()){
$parentBlock->addLink($text, 'onepage', $text, true, array('_secure'=>true), 60, null, 'class="top-link-checkout"');
} else {
$parentBlock->addLink($text, 'checkout', $text, true, array('_secure'=>true), 60, null, 'class="top-link-checkout"');
}
}https://stackoverflow.com/questions/23968226
复制相似问题