We just upgraded our Magento website from Magento 1.6.1 community edition to the latest version 1.6.2 and we found some issues but we also figured out how to solve them. We are going to take record of the every possible issues upgrading Magento from version 1.6.1 to 1.6.2. We will update this post with new issues and solutions. If you got any error while upgrading from Magento, let us know by commenting your issue. We will try to solve it as soon as possible. So bookmark this post for future reference.

Follow the steps for upgrading your Magento:

1) Backup database and source
2) Then upgrade Magento from Magento Connect to find most recent upgrade.
3) After successful upgrade, we found one error on indexing process
4) Error is cannot initialize indexing process.
5) After some tracing  found error in database error  description given below

We detected the following issues:

Issue 1:

SQLSTATE [23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`catalog_category_product_index`, CONSTRAINT `FK_CATALOG_CATEGORY_PROD_IDX_CATEGORY_ENTITY FOREIGN KEY (` category_id `) REFERENCES` catalog_category_entity`(` `entity_id)

Solution:
It is because the category is not appropriate in the table “catalog_category_entity”

To solve the problem with fire SQL query in phpMyAdmin:

SELECT cp.category_id
FROM catalog_category_product cp
LEFT JOIN catalog_category_entity c ON cp.category_id = c.entity_id
WHERE ISNULL( c.entity_id );

After this you’ll get some IDs. Delete these IDs from the “catalog_category_product” table.

Issue 2:

Product Data Flat index unknown error process: a foreign key constraint fails (. Usr_xxxxx_1 “ `# sql-xxxxx`, CONSTRAINT `FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CA) ‘

Solution:
To solve the problem with fire SQL query in phpMyAdmin:

SELECT pf1.entity_id
FROM catalog_product_flat_1 pf1
LEFT JOIN catalog_product_entity p ON pf1.entity_id = p.entity_id
WHERE ISNULL( p.entity_id );

After firing this query it will return all id that are not matched and given error for constrains so delete it.

Fire this SQL query as well:

SELECT cp.product_id
FROM `catalog_category_product` cp
LEFT JOIN catalog_product_entity p ON cp.product_id = p.entity_id
WHERE ISNULL( p.entity_id );

Firing this query will return all ids which need to delete from “catalog_category_product” the table.

UPDATE (7th April 2012):

Here is a series of SQL queries which might help you to solve Indexing errors:

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)

We hope that this may help you with your problems you faced while upgrading Magento from 1.6.1 to 1.6.2 or tell us if you find another problems while upgrading. We will love to help you out.

Your comments will be appreciated.

GD Star Rating
loading...

1 Comment


  1. svider
    09-Jun-2012

    Thanks a lot :) In my case I must delete “empty” entries from catalog_product_flat_1, catalog_product_flat_2, catalog_product_flat_3 and this solve my problem :)

    GD Star Rating
    loading...

Leave a comment





Last Tweet

  • "I posted 9 photos on Facebook in the album "Annual Day 2013" http://t.co/0K6PApAzof"
  • " Indieswebs Magento Blog talks about learning, relearning and unlearning coding , designing and development of magento stores one blog at a time. "