我有 3 个在线商店在一个 Magento 安装上运行。
他们共享超过 10.000 多个 SKU(我将它们设置为简单产品),但前端唯一可见的产品是每个商店的分组产品(与它们相关联的 SKU)。
因此,我的 URL 重写表非常繁重,在检查 Varien Profiler 时,我遇到了“mage::dispatch::routers_match”,它需要超过 5 秒才能完成。我想这是因为它太大了。这让我想到了我的问题:
如何指定我不想让 Magento 重写的 URL。无论如何我可以告诉它不要重写简单的产品 URL 吗?仅此一项就会使表格下降到 1/3。
附言:Magento CE 1.7.0.2
编辑:
感谢 Tobias 为我指明了正确的方向。我转到 app/code/core/Mage/Catalog/Model/Url.php 并将函数 refreshProductRewrites
编辑为:
foreach ($products as $product) {
if($product->getTypeId() == "simple"){
continue;
}
else {
$this->_refreshProductRewrite($product, $this->_categories[$storeRootCategoryId]);
foreach ($product->getCategoryIds() as $categoryId) {
if ($categoryId != $storeRootCategoryId && isset($this->_categories[$categoryId])) {
if (strpos($this->_categories[$categoryId]['path'], $storeRootCategoryPath . '/') !== 0) {
continue;
}
$this->_refreshProductRewrite($product, $this->_categories[$categoryId]);
}
}
}
}
最佳答案
存储在 core_url_rewrite
中的产品集合在 Mage_Catalog_Model_Url
refreshProductRewrites 中生成。
您可以重写此类并实现您自己的实现,它只存储分组的产品。
关于php - 如何禁用 Magento 的简单产品 URL 重写管理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14711099/