我在购物车中添加/删除商品后收到此错误。添加到购物车按钮执行ajax调用将项目添加到购物车。这种json字符串将在顶部购物车中使用:
我被困住了。你能告诉我从哪里开始调试吗?
答案 0 :(得分:1)
使用Netbeans和Xdebug。
http://wiki.netbeans.org/HowToConfigureXDebug
在此函数内的/app/code/core/Mage/Sales/Model/Quote.php上放置一个断点:
/**
* Adding catalog product object data to quote
*
* @param Mage_Catalog_Model_Product $product
* @return Mage_Sales_Model_Quote_Item
*/
protected function _addCatalogProduct(Mage_Catalog_Model_Product $product, $qty = 1)
{
$newItem = false;
$item = $this->getItemByProduct($product);
if (!$item) {
$item = Mage::getModel('sales/quote_item');
$item->setQuote($this);
if (Mage::app()->getStore()->isAdmin()) {
$item->setStoreId($this->getStore()->getId());
}
else {
$item->setStoreId(Mage::app()->getStore()->getId());
}
$newItem = true;
}
/**
* We can't modify existing child items
*/
if ($item->getId() && $product->getParentProductId()) {
return $item;
}
$item->setOptions($product->getCustomOptions())
->setProduct($product);
// Add only item that is not in quote already (there can be other new or already saved item
if ($newItem) {
$this->addItem($item);
}
return $item;
}
HTH
答案 1 :(得分:1)
“添加到购物车”按钮在Magento的默认行为中不起作用。这意味着您安装/开发了一个模块来执行此操作。为了我们帮助您,我们需要知道它是什么
无论如何,这看起来像Zend_Dump
或die
:在您的文件中搜索这些字符串,看看会出现什么