1
1 exception(s): Exception #0 (Exception): Item (Magento\Catalog\Model\Product\Interceptor) with the same ID "860" already exists.
I am using Magento 2.2.2 .

When switched to developer mode, I got this error. I tried searching for solution but found nothing.

How can I solve it? Much appreciated your help.

0

3 Answers 3

3

This problem occurs if you delete a product in backend of your shop and some information about its ID is not deleted.

A common source of this error is a duplicate entry in cataloginventory_stock_item. You can search for an ID if you have one. If you want to find all duplicate product entity_id's, then simply use this SQL statement:

SELECT * FROM cataloginventory_stock_item
WHERE product_id in (
    SELECT product_id 
    FROM cataloginventory_stock_item
    GROUP BY product_id
    HAVING ( COUNT(product_id) > 1 )
)

If it finds duplicates, than you need to delete it.

1
  • Thanks but there is no duplicate ID. So how we can resolve this error? See the screenshot. prnt.sc/26ekl3i Commented Jan 17, 2022 at 5:33
1

Go to admin Marketing > URL Rewrites

Filter by category/860 in the targer_path, If you find same target_path for same store then delete the one.

Now Run php bin/magento indexer:reindex

1
  • You should check for the same request_path. There is no problem when two different request paths pointing to the same target_path.
    – michi-p
    Commented Jan 11, 2021 at 10:24
0

Run SQL

SELECT product_id ,COUNT(*) FROM cataloginventory_stock_status GROUP BY product_id, product_id HAVING COUNT(*) > 1

After run above sql you can get all duplicate ids then run below SQL query.

delete from cataloginventory_stock_status where  product_id = {AddDuplicateId} and website_id != 0 ;

update cataloginventory_stock_status set stock_status = 1 where  product_id = {AddDuplicateId} and qty >= 1 ;

Not the answer you're looking for? Browse other questions tagged or ask your own question.