Не удается переиндексировать новые продукты после обновления до версии 1.6 - PullRequest
1 голос
/ 13 ноября 2011

Я обновил свой сайт с версии 1.4.0.1 до версии 1.6. Я удалил все продукты с веб-сайта и сделал «переиндексацию всего», что было успешно завершено Когда я пытаюсь создать новый продукт, а затем снова выполнить переиндексацию, я получаю эту ошибку:

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, но это не помогло.

Как я могу это исправить?

Ответы [ 3 ]

16 голосов
/ 07 ноября 2013

Это только удаляет мошеннические данные, которых там быть не должно.

Я расширил вышеописанное, поскольку это может сэкономить несколько часов копания:

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);
1 голос
/ 07 марта 2012

Я использовал следующие запросы для очистки таблиц каталога:

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_entity_media_gallery` WHERE entity_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)

После этого я смог переиндексировать из панели администратора.

0 голосов
/ 15 ноября 2011

Если вы делаете это на работающем сайте, вам, вероятно, потребуется выполнить процесс переиндексации из командной строки с отключенным Apache.

http://overlycaffeinated.com/2011/02/when-reindexing-in-magento-fails-use-the-command-line/

Это объясняет, как это сделать.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...