magento, error when reindexing Catalog URL Rewrite

2020-03-07 06:47发布

All this afte rupgrading from 1.4.1

I get a quite specific error message:

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'product/19-1-2' for key 'UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID'' in /home/in-due/domains/sb2.in-due.de/public_html/hochzeitsshop/lib/Zend/Db/Statement/Pdo.php:234

problem is, that I don't know how to find the entry, that is making trouble. neither in the backend (catalog|URL Rewrite Management) nor in the db itself (table core_url_rewrite) is an entry

product/19-1-2

any help is appreciated,

PAT ERLER

3条回答
放我归山
2楼-- · 2020-03-07 07:28

Ok, the problem was a duplicate SKU. You shouldn't be able to enter one, but what happened (in magento 1.4.0.1) was, that the client entered a very long SKU which got shortened when saving the product. the shortened part was then identically to another SKU.

so, if yourself have this problem, check you database for duplicate SKUs (can someone post an SQL Query to do this?)

查看更多
Root(大扎)
3楼-- · 2020-03-07 07:40

@perler, here is a MySQL query to detect duplicate SKUs. Remember, if you prefixed your tables, change catalog_product_entity accordingly!

SELECT
    DISTINCT(`sku`) as `sku`,
    COUNT(`sku`) as `skuCount`,
    entity_id
FROM
    catalog_product_entity
GROUP BY
    `sku`
HAVING
    `skuCount` > 1;
查看更多
一纸荒年 Trace。
4楼-- · 2020-03-07 07:40

The duplicate entry is for a key made up from 3 fields, id_path, is_system and store_id, in theory you should be able to use URL Rewrite Management, search for an id_path of product/19 and this is your 'troublesome' field. Deleting that value may solve the issue (but I'd recommend making a backup first, and trying it in a dev environment first).

If you are still in development and haven't used any custom rewrites you could just empty the core_url_rewrite table and re-index to regenerate all the fields. If it is a live site this would be a little more troublesome, it would mean losing a bit of SEO juice if you have renamed products, since you would lose the rewrite.

查看更多
登录 后发表回答