In order to optimize the long tail keywords for each category, it’s better remove parent category path from sum category url in Magento.

The followed is the best method to remove parent category path from sum category url in Magento:

Go to app/code/core/Mage/Catalog/Model/Url.php copy this file toapp/code/local/Mage/Catalog/Model/Url.php (Please note don’t modify the Magento core file directly, use local folder)

Arround line 717 inside this function public function getCategoryRequestPath($category, $parentPath) {} comment the followed lines :

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

After you’ve done those changes go to System->Config->Index Management and Reindex Data.

0 Likes
1323 Views

You may also like

1 Response Comment

  • Najib HabebJuly 17, 2016 at 6:01 pm

    Hi there,
    How do I do similar to Magento2 ? it’s different now.

    Reply

Leave A Comment

Please enter your name. Please enter an valid email address. Please enter message.