Friday, 2 August 2013

Magento error - Item with the same id already exist

Lot of time we get a Magento error as Item with same id already exist. Basically when we have gone through the upgradation processes.
To resolve this issue to to
lib/Varien/Data/Collection.php

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');
            }
            $this->_items[$itemId] = $item;
        } else {
            $this->_addItem($item);
        }
        return $this;
    }

comment the throw exception line. Enjoy!

2 comments :

  1. Hello I wish to to share a comment here concerning you to definitely be able to inform you just how much i personally Loved this particular study. I have to elope in order to aTurkey Day time Supper but desired to leave ya an easy comment. We preserved you Same goes with be returning subsequent function to read more of yer quality articles. Keep up the quality work.

    ReplyDelete
  2. Thank you Rajiv for your Master Advice ;)

    ReplyDelete