10/27/2010

How to remove parent category path from sub category url in Magento

Go to app/code/core/Mage/Catalog/Model/

Open Url.php and go to line no 632 and comment(//) the below line

If you are using Magento 1.5 then please go to line number 797 instead of 632

//if (null === $parentPath) {
//$parentPath = $this->getResource()->getCategoryParentPath($category);
//}
//elseif ($parentPath == '/') {
$parentPath = ''; //('Don't comment it')
//}

Now save and upload it.

Now login to admin panel of your site then go to System->Config->Index Management and click on select all then select Reindex Data from the Action Dropdown then click on submit.

8 comments:

  1. Anonymous11/24/2010

    Does this really work? Do you have an example of a site where it is working?

    Do you do freelance Magento work?

    Thanks

    ReplyDelete
  2. Anonymous2/23/2011

    works perfectly. tested on magento 1.4.1.1!!
    great job!

    ReplyDelete
  3. Anonymous2/28/2011

    Hi!

    This is really great! However, what I need is to remove only the very first main cat and still leave the subcats. For example: /main_cat/sub_cat/another_subcat/page.html, how can I remove only the "main_cat" so I can have /sub_cat/another_subcat/page.html

    Your help is highly appreciated!

    Thanks

    ReplyDelete
  4. Doesnt work in 1.5. The code is all different. Anyone have a fix for 1.5??

    ReplyDelete
  5. I need the reindex steps for 1.3.2. There is not a System->Config->Reindex Data dropdown menu option.

    Please tell me where to go to reindex data on my version.

    ReplyDelete
  6. is there any alternate of editing the core? I don't want the code change is there any other option to do this?

    ReplyDelete
  7. Anonymous2/07/2014

    This solution is not working for Magento 1.13.1.0.
    Has anyone got success to make it working with Magento 1.13.1.0. ?

    Thanks

    ReplyDelete