我有3個在線商店運行在一個單一的Magento安裝。他們共享超過10.000+ SKU(我已將它們設置爲簡單產品),但前臺唯一可見的產品是每個商店的分組產品(其SKU都與其關聯)。如何禁用Magento的簡單產品URL重寫管理?
因此,我的URL重寫表非常繁重,在檢查Varien Profiler時,我遇到了超過5秒鐘完成的「mage :: dispatch :: routers_match」。我認爲這是因爲它是一個如此大的桌子。所以,這使我想到我的問題:
如何指定我要Magento重寫哪個URL。無論如何,我可以告訴它不要重寫簡單的產品URL?僅此一項就會使桌子降至1/3。
PS:Magento的CE 1.7.0.2
編輯:
謝謝托比亞斯指着我在正確的方向。我到應用程序/代碼/核心/法師/目錄/型號/ 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]);
}
}
}
}
感謝您的指針,請檢查我的編輯。這會起作用嗎?我意識到我不應該混淆核心代碼,如果確實有效,我會重寫該類。 – pedropeixoto
是的,這將工作。但是它並不是性能最好的解決方案,你可以嘗試在SQL中使用過濾器,但看起來你也必須重寫url的資源,以擴展getProductsByStore方法 –
是正確的,但是現在就工作了,我已經做了reindex。再次感謝。 – pedropeixoto