Magento CE 1.8 的新 UNIQUE 索引更改了 URL 重写表中的 URL 键。如果您有多个商店视图并导入您的产品(以便为每个商店视图保存 URL 密钥),您将自动拥有重复的密钥。更新脚本足够聪明,不会抛出错误,而是重命名所有键,因此您最终会得到如下内容:
- http://de.example.com/someproduct.html
- http://en.example.com/someproduct1.html
- http://nl.example.com/someproduct2.html
为避免这种情况,必须在更新之前修复 URL 重写,以便每个产品和 URL 键有一次重写,并且商店视图使用“使用默认值”。您可以在更新之前使用单个 SQL 查询来管理它:
DELETE nondefault
FROM catalog_product_entity_varchar AS nondefault
INNER JOIN catalog_product_entity_varchar AS def ON def.value = nondefault.value
AND def.entity_id = nondefault.entity_id
WHERE def.attribute_id =86
AND nondefault.attribute_id =86
AND nondefault.store_id <>0
AND def.store_id =0
请注意,86 是 URL 键属性的 ID。如果您在没有先运行此查询的情况下更新了系统,则必须先删除错误创建的 URL 键。这可以通过以下查询来完成:
DELETE url_table
FROM catalog_product_entity_url_key url_table
INNER JOIN catalog_product_entity_varchar old_url_table ON url_table.store_id = old_url_table.store_id
AND url_table.store_id <>0
AND old_url_table.store_id <>0
AND url_table.attribute_id = old_url_table.attribute_id
AND url_table.entity_id = old_url_table.entity_id;
我希望这有帮助!如果您还有其他问题,以下链接可能会对您有所帮助:http:
//www.code4business.de/update-magento-enterprise-edition-1-13-0-2/