Fix for Magento error – Item (Mage_Customer_Model_Customer) with the same id already exist

After upgrading to Magento 1.9.3.10 I kept getting the following error when trying to go to the Customers screen. A similar error can also happen on other screens. It's when a Collection is being built, BUT there are duplicate entity_ids in the SQL results. To fix it, turn off the throw error.

Item (Mage_Customer_Model_Customer) with the same id "XXXX" already exist

Edit lib/Varien/Data/Collection.php
Find the addItem function and comment out the "throw" line :
public function addItem(Varien_Object $item)
    {
        $itemId = $this->_getItemId($item);
        if (!is_null($itemId)) {
            if (isset($this->_items[$itemId])) {
                // throw new Exception('Item ('.get_class($item).') with the same id "'.$item->getId().'" already exist');
            } else {
                $this->_items[$itemId] = $item;
            }
        }
        else {
            $this->_items[] = $item;
        }
        return $this;
    }
DONE!


Got this from
https://support.webcto.eu/index.php/Knowledgebase/Article/View/50/8/item-mage_catalog_model_product-with-the-same-id-already-exist

 

Leave a Reply