简体   繁体   中英

how can i remove main-category from the URL of sub-category in magento

嗨,我在magento中有一个网站,其中包含类似mydomain / Parent-category / sub-category的url,但是我喜欢该URL的子类别,例如mydomain / Subcategory ..请帮助我如何从中删除URL的main-category magento中的子类别...我将非常满意...非常感谢...我想要类似http://www.Sofasshopping.com的 URL

Does this work? Not taking credit for it at all. I am looking for a solution as well and found it (possibly) at www.n2ndevelopers.com

http://www.n2ndevelopers.com/magento/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 (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.

Now refresh your cache to see the effect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM