2
votes

I am using Magento 1.8 and I want sub-categories url's without parent/root category into it or want every url to be on root without putting redirects.

For e.g

Appreal -> Women

  1. Tops
  2. Bottoms

Appreal -> Men

  1. Formals
  2. Casuals

Now I want url's to be : Women

mysite.com/womens.html instead of mysite.com/appreals/womens.html

Tops

mysite.com/tops.html instead of mysite.com/appreals/womens/tops.html

Formals

mysite.com/formals.html instead of mysite.com/appreals/mens/formals.html

Is there any setting in default Magento 1.8 to achieve this ?

2

2 Answers

6
votes

Open the class Mage_Catalog_Model_Url and comment the below line

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

under function getCategoryRequestPath($category, $parentPath)

and re-index the Catalog URL Rewrites from Index Management.

You should overwrite getCategoryRequestPath() function in your local codePool.

1
votes

Yes you can do this in the admin

Admin -> System -> Config -> Catalog -> Search Engine Optimizations -> Search Engine Optimizations (set to NO)