根据Magento中的类别级别添加Url前缀

根据Magento中的类别级别添加Url前缀,magento,Magento,如何根据类别级别添加url前缀 例如:- example.com/h/lvl-1-categories example.com/s/lvl-2-categories 等 谢谢解决了这个问题: 抄袭 /app/code/core/Mage/Catalog/Model/Url.php 到 /app/code/local/Mage/Catalog/Model/Url.php 在Url.php中查找行 if (null === $parentPath) { $parentPat

如何根据类别级别添加url前缀

例如:-

example.com/h/lvl-1-categories
example.com/s/lvl-2-categories

谢谢

解决了这个问题:

抄袭

/app/code/core/Mage/Catalog/Model/Url.php

/app/code/local/Mage/Catalog/Model/Url.php

在Url.php中查找行

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

        $parentPath = '';

   }
并替换为

//        if (null === $parentPath) {
//            $parentPath = $this->getResource()->getCategoryParentPath($category);
//        }
//        elseif ($parentPath == '/') {
        if($category->getLevel() > 2){
            $parentPath = 'c/';
        }else{
            $parentPath = 'h/';
        }

//        }
修改了来自