سؤال

I am using dresscode template of magento.It has a module to display products in home page like carousel.If i have click on the product image means the page which redirects shows the breadcrumb as Home -> product name.

I need to change this breadcrumb path to Home -> category -> product name.

How to get this?

My function used to get the breadcrumb path

 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;
    }
هل كانت مفيدة؟
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top