1

We look for a solution, to remove parent category from url.

So normally the URL is -> www.mydomain.com/specials/shoes.html

but we need it like www.mydomain.com/shoes.html it should be work for all the subcategories of "specials"

1

Presuming you are using Magento CE 1.x and you want to avoid coding you can set this up by simply adding a custom URL rewrite for a category via Admin/Catalog/URL Rewrite Management.

If you want the cleaned URLs to show up in the Menu etc, you'll have to use an Overwrite (local Version or extended by Module) of Mage_Catalog_Model_Url::getCategoryRequestPath(). Around line 723 the parent Path is inserted, you can simply avoid that by changing

$parentPath = Mage::helper('catalog/category')->getCategoryUrlPath($parentPath,true,$category->getStoreId());

to

$parentPath = '';

If you want to only change it for some category_ids (as your original question was) you can of course apply some Logic here to render $parentPath as empty string only if your Prerequisites are met.

Please be aware that putting some evaluation of Category Properties (like e.g. Product Count) will have a negative Impact on Performance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.