хлебные крошки Opencart

Функция для хлебных крошек

	$category_info = $this->model_catalog_category->getCategory($category_id);
        $data['breadcrumbs'] = $this->breadcrumb($category_info['parent_id']);


private function breadcrumb ($parent_id) {

        $data[] = array(
            'text' => $this->language->get('text_home'),
            'href' => $this->url->link('common/home')
        );
        $this->load->model('catalog/category');
        $parent_category_info = $this->model_catalog_category->getCategory($parent_id);
        if ($parent_category_info['parent_id']) {
          $data =  $this->breadcrumb($parent_category_info['parent_id']);
        }
            if ($parent_category_info) {
                $data[] = array(
                    'text' => $parent_category_info['name'],
                    'href' => $this->url->link('product/category', 'path=' . $parent_category_info['category_id'])
                );
            }



        return $data;



    }

Отправить комментарий

Другие статьи рубрики "Модули и дополнения"