I am on Magento CE 2.2.6 and I am starting to see this error more and more on my products making it impossible to edit them.
Item (Magento\Catalog\Model\Product\Interceptor) with the same ID "419" already exists.
How do I fix the products with this error code and how do I stop this from happening?
Hello @Goad
are you using enterprise edition of magento?
No, as stated I am on CE 2.2.6
Hello @Goad
it happen if same entry into exist into catalog_product_entity or some other table
vendor/magento/framework/Data/Collection.php
public function addItem(\Magento\Framework\DataObject $item)
{
$itemId = $this->_getItemId($item);
if ($itemId !== null) {
if (isset($this->_items[$itemId])) {
throw new \Exception(
'Item (' . get_class($item) . ') with the same ID "' . $item->getId() . '" already exists.'
);
}
$this->_items[$itemId] = $item;
} else {
$this->_addItem($item);
}
return $this;
}into thrown
if (isset($this->_items[$itemId])) {
echo $itemId;exit;
throw new \Exception(
'Item (' . get_class($item) . ') with the same ID "' . $item->getId() . '" already exists.'
);
}by using you will get itemId that contain such an issue
hope it will help you.
I think a lot of what you are saying is lost in translation.
Are you saying I should modify my collection.php? If so, can you be a bit more clear what needs to be changed?
i give the file name and debug which product id create issue