magento, error when reindexing Catalog URL Rewrites

无人久伴 提交于 2019-12-19 04:56:27

问题


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


回答1:


@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;



回答2:


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.




回答3:


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?)



来源:https://stackoverflow.com/questions/8940794/magento-error-when-reindexing-catalog-url-rewrites

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!