Magento異常:Item (Mage_catalog_Model_Product) with the same id "###" already exist

這兩天在工作中碰到一個問題,當登錄會員賬號的時候,提示Item (Mage_catalog_Model_Product) with the same id “###” already exist.
首先這是個異常,肯定是操作產品的過程中數據庫有重複值。
我們找到拋出異常的代碼段
文件:/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php

public function addItem(Varien_Object $object)
    {
        if (get_class($object) !== $this->_itemObjectClass) {
            throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Attempt to add an invalid object'));
        }
        return parent::addItem($object);
    }

這裏將異常註釋掉,然後就正常了。。。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章