首页 文章

如何更改Magento主页产品的痕迹路径

提问于
浏览
0

我正在使用magento的dresscode模板 . 它有一个模块在主页上显示产品,如carousel . 如果我点击产品图片意味着重定向的页面显示面包屑为Home - >产品名称 .

我需要将此痕迹路径更改为主页 - >类别 - >产品名称 .

怎么弄这个?

我的函数用于获取痕迹路径

public function getBreadcrumbPath()
    {
        if (!$this->_categoryPath) {

            $path = array();
            if ($category = $this->getCategory()) {
                $pathInStore = $category->getPathInStore();
                $pathIds = array_reverse(explode(',', $pathInStore));

                $categories = $category->getParentCategories();

                // add category path breadcrumb
                foreach ($pathIds as $categoryId) {
                    if (isset($categories[$categoryId]) && $categories[$categoryId]->getName()) {
                        $path['category'.$categoryId] = array(
                            'label' => $categories[$categoryId]->getName(),
                            'link' => $this->_isCategoryLink($categoryId) ? $categories[$categoryId]->getUrl() : ''
                        );
                    }
                }
            }

            if ($this->getProduct()) {
if($this->getProduct()->getproduct_title()!='')
{

$path['product'] = array('label'=>$this->getProduct()->getproduct_title());
}
else
{
$path['product'] = array('label'=>$this->getProduct()->getName());

}
            }

            $this->_categoryPath = $path;
        }
        return $this->_categoryPath;
    }

1 回答

相关问题