Magento1.x站点报错Item (Mage_Catalog_Model_Product) with the same id “***” already exist

作者:admi... 点击数: 0 收藏到会员中心
最后编辑时间: 2020-06-25 00:04

20200624001.jpg

默认的网站系统用着用着就出这个错误,很奇怪,只需要做以下操作就可以完成解决。

付费内容限时免费中...

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;
    }


    public function addItem(Varien_Object $item)
    {
        $itemId = $this->_getItemId($item);

        if (!is_null($itemId)) {
          if (isset($this->_items[$itemId])) {
            $this->_items[] = $item;
            //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;
    }


内容说明:
如您需要转载本文请保留以下信息是对作者发文的支持与尊重:

Magento1.x站点报错Item (Mage_Catalog_Model_Product) with the same id “***” already exist 来源于 https://www.magentola.com/news-read-87.html
上一篇:没有了
下一篇:M1.x产品页面报Invalid method Mage_Catalog_Block_Product_View_Type_Simple::displayProductStockStatus
相关内容
产品推荐