在Magento中添加产品时,我会得到以下错误。
1062 Duplicate entry '24678-1' for key 'UNQ_MAGE_CATALOGINVENTORY_STOCK_ITEM_PRODUCT_ID_STOCK_ID
我遵循了这里解释的解决方案,Integrity constraint violation in Magento custom module
即使像上面解释的那样,从表中删除条目之后,我也会得到相同的错误。
我使用的是企业版本1.11.0.0
发布于 2016-11-08 07:27:29
我已经面临同样的问题,并调试了两天。最后,我找到了解决办法,解决了这个问题。这是由于数据库表中的不一致造成的。
cataloginventory_stock_item
catalog_product_entity
我使用以下查询删除了所有不一致的数据:
DELETE FROM cataloginventory_stock_item where product_id NOT IN (select entity_id from catalog_product_entity)
在执行删除之前,您可以检查记录的数量。
select count(*) from cataloginventory_stock_item where product_id NOT IN (select entity_id from catalog_product_entity)
https://stackoverflow.com/questions/28695199
复制相似问题