My problem is the following: Magento creates URL rewrites for new products and uses different URLs on different listings. If my product is in two categories Foo
and Bar
, Magento will use two URLs on top of the one I actually want.
Foo => /store/type/foo/product.html
Bar => /store/type/bar/product.html
/store/product.html
I want/need to get Magento to use only the URL /store/product.html
throughout the entire store. I have not found any setting in the admin pages for that.
Using Magento 1.5.1.0
.
For some reason, Magento ignored the setting for all the stores. After searching the code, I found that the method Mage_Catalog_Model_Product_Url::getUrl()
checks this setting with $product->getDoNotUseCategoryId()
. I called this method, and it returned NULL
for all the products.
To solve this, I overloaded this method in my own product class:
public function getDoNotUseCategoryId(){
return true;
}
This works.
It might be a problem with a non-existent attribute or something, but as long as this works I'll use it.