How can I disable URL rewriting control with Magento?
I have 3 online stores running on one Magento installation.
They share over 10.000+ SKUs (I set them as simple products), but the only products visible on the interface are Grouped Products for each store (which have a SKU associated with them). In the meantime, there is no need to know about it. ”
So the URL rewrite table is very heavy and while checking the Varien Profiler I came across "mage :: dispatch :: routers_match" which takes over 5 seconds. I believe this is because it is such a large table. So this brings me to my question:
How do I specify which url I cannot rewrite Magento. Anyway, can I say NOT to rewrite simple product URLs? This alone will reduce the table to 1/3.
PS: Magento CE 1.7.0.2
Edit:
Thank you Tobias for pointing me in the right direction. I went to app / code / core /Mage/Catalog/Model/Url.php and edited the function refreshProductRewrites
like this:
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]);
}
}
}
}
source to share
Another solution is to simply ignore products with an empty URL key.
protected function _refreshProductRewrite(Varien_Object $product, Varien_Object $category)
{
if ($category->getId() == $category->getPath()) {
return $this;
}
if ($product->getUrlKey() != '') {
$urlKey = $this->getProductModel()->formatUrlKey($product->getUrlKey());
You can clean up URL keys for simple products (check the attribute id):
DELETE FROM catalog_product_entity_varchar WHERE entity_id IN (SELECT entity_id FROM catalog_product_entity
WHERE type_id = 'simple' AND attribute_id = '97 ');
source to share