3

I am exporting products from Wordpress to Magento. In Wordpress url structure is like this:

www.mysite.com/sub-category/product/

but when I am opening this in Magento product url is like this:

www.mysite.com/category/sub-category/product/

Its also opening if I remove category from url:

www.mysite.com/product/

But I want subcategory in url like in Wordpress (www.mysite.com/sub-category/product/)

Any ideas?

  • Can you please be precise on what page exactly you are referring to in Magento? For instance, there are product listing page, product view page – Mr_Green May 8 '14 at 5:30
  • Product view page – user3150977 May 8 '14 at 5:43
1

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.

You may also use Admin -> System -> Config -> Catalog -> Search Engine Optimizations -> Search Engine Optimizations (set to NO)

  • Hi Amit I made changes on Mage_Catalog_Model_Url and reindexed the URL rewrites. Now url structure is right but Its giving me error "This webpage has a redirect loop". Any more changes to do..? – user3150977 May 8 '14 at 5:58
  • would: You may also use Admin -> System -> Config -> Catalog -> Search Engine Optimizations -> Search Engine Optimizations (set to NO) be the complete answer? Or does this disable many more things? – snh_nl Aug 25 '14 at 15:24

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.