問題描述
我已將我的網(wǎng)站從 1.4.0.1 版升級到 1.6 版.我已經(jīng)從網(wǎng)站上刪除了所有產(chǎn)品,并成功完成了重新索引所有".當(dāng)我嘗試創(chuàng)建新產(chǎn)品而不是再次重新編制索引時,我收到此錯誤:
I've upgraded my site from version 1.4.0.1 to version 1.6. I've deleted all the products from the website and did "reindex all" that was finished successfully. When I try to create a new product and than do a re-index again I get this error :
Product Attributes index process unknown error:
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`.../catalog_product_index_eav`, CONSTRAINT `FK_CAT_PRD_IDX_EAV_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CAS)' in .../lib/Zend/Db/Statement/Pdo.php:228
我曾嘗試TRUNCATE TABLE catalog_product_index_eav
,但沒有幫助.
I've tried to TRUNCATE TABLE catalog_product_index_eav
but it didn't help.
我該如何解決這個問題?
How can I fix this?
推薦答案
這只會刪除不應(yīng)該存在的惡意數(shù)據(jù).
This only removes rogue data that shouldn't be there.
我已經(jīng)擴(kuò)展了上面的內(nèi)容,因為它可以節(jié)省幾個小時的挖掘時間:
I've expanded the above as it may save some hours of digging:
delete FROM `catalog_product_entity_datetime` where entity_id not in (select entity_id from catalog_product_entity);
delete FROM `catalog_product_entity_decimal` where entity_id not in (select entity_id from catalog_product_entity);
delete FROM `catalog_product_entity_gallery` where entity_id not in (select entity_id from catalog_product_entity);
delete FROM `catalog_product_entity_group_price` where entity_id not in (select entity_id from catalog_product_entity);
delete FROM `catalog_product_entity_int` where entity_id not in (select entity_id from catalog_product_entity);
delete FROM `catalog_product_entity_media_gallery` where entity_id not in (select entity_id from catalog_product_entity);
delete FROM `catalog_product_entity_text` where entity_id not in (select entity_id from catalog_product_entity);
delete FROM `catalog_product_entity_tier_price` where entity_id not in (select entity_id from catalog_product_entity);
delete FROM `catalog_product_entity_varchar` where entity_id not in (select entity_id from catalog_product_entity);
#originals with formatting fixed:
delete from `catalog_category_product` WHERE product_id not in(select entity_id from catalog_product_entity);
delete from `catalog_category_product` WHERE category_id not in(select entity_id from catalog_category_entity);
delete from `catalog_product_website` WHERE product_id not in(select entity_id from catalog_product_entity);
delete from `catalog_product_index_eav_idx` WHERE entity_id not in(select entity_id from catalog_product_entity);
delete from `catalog_product_index_eav` WHERE entity_id not in(select entity_id from catalog_product_entity);
delete from `catalog_product_link` WHERE product_id not in(select entity_id from catalog_product_entity);
delete from `catalog_product_relation` WHERE parent_id not in(select entity_id from catalog_product_entity);
這篇關(guān)于升級到 1.6 版后無法重新索引新產(chǎn)品的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!