我在EE中使用magento部分重建索引时遇到问题。当索引器设置为保存时(在system-> configuration->(高级)索引管理中),url_rewrites不会更新。
如果我在后端保存产品,那么查看表enterprise_catalog_product_rewrite没有该产品的条目,我想因为这样,enterprise_url_rewrite中没有条目,这意味着它不起作用。
我可以看到列表中的产品,但网址不是SEO友好的,如果在浏览器中输入了网址密钥,则不会显示产品。
我一直在搜索有关这部分索引如何工作的信息,但除了它有多好之外似乎什么都没有。
我已经尝试手动截断url重写相关表(like this),但它只是弄乱了所有内容,所以我还原了数据库。
答案 0 :(得分:4)
我遇到了同样的问题:catalog_product_entity_url_key
包含每个商店的正确数据,enterprise_url_rewrite
包含正确的request_path > target_path
对。但是不会发生匹配,因为enterprise_catalog_product_rewrite
缺少给定产品的条目,或者有一个条目指向url_rewrite_id
中不再存在的enterprise_url_rewrite
。< / p>
我的解决方案是使用此查询重建enterprise_catalog_product_rewrite
表:
REPLACE INTO enterprise_catalog_product_rewrite
(`product_id`, `store_id`, `url_rewrite_id`)
(SELECT cpeuk.entity_id as product_id, cpeuk.store_id, eur.url_rewrite_id
FROM catalog_product_entity_url_key cpeuk
INNER JOIN enterprise_url_rewrite eur
ON cpeuk.value = eur.identifier)
答案 1 :(得分:0)
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。 如果您已经更新了系统而未先运行此查询,则必须先删除错误创建的网址密钥。这可以通过以下查询完成:
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/