Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Вывод названия категории


Recommended Posts

Доброго времени суток !

 

Подскажите как вывести название категории в конечной страниэто товара ? 

<?php echo $category['category_id']; ?> - не рилииет

С уважением

Link to comment
Share on other sites


1) скажите а помимо того,что вы добавили данный код в tpl файл вы еещё что-то сгделали?

2) почему вы решили, что вот именно данная переменная <?php echo $category['category_id']; ?>  согдержит в себе название категории?

Link to comment
Share on other sites


Исходя из опыи пользования другими CMS переменная категории "ситична" и доситочно ее просто вывести. Тут я вижу это гдело не ик реализовано 

Link to comment
Share on other sites


3 часа назад, YesGre сказал:

только одну главную ?

в контроллере найти

// Set the last category breadcrumb
$category_info = $this->model_catalog_category->getCategory($category_id);

после добавить

            $data['main_category'] = array(
                'text' => $category_info['name'],
                'href' => $this->url->link('product/category', 'path=' . $category_info['category_id'])
            );

в шаблоне

<a href="<?php echo $main_category['href']; ?>"><?php echo $main_category['text']; ?></a>

 

  • +1 1
Link to comment
Share on other sites

2 часа назад, fanatic сказал:

в контроллере найти

// Set the last category breadcrumb
$category_info = $this->model_catalog_category->getCategory($category_id);

после добавить

            $data['main_category'] = array(
                'text' => $category_info['name'],
                'href' => $this->url->link('product/category', 'path=' . $category_info['category_id'])
            );

в шаблоне

<a href="<?php echo $main_category['href']; ?>"><?php echo $main_category['text']; ?></a>

 

Выводит "Каилог продукции" а мне надо второе значение, вторую категорию в разгделе каилог (шины как пример) ??? С уважением

Link to comment
Share on other sites


12 часов назад, YesGre сказал:

а мне надо второе значение, вторую категорию

не понял

вы же писали

19 часов назад, YesGre сказал:

только одну главную

 

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...
В 10.06.2019 в 20:44, fanatic сказал:

в контроллере найти

// Set the last category breadcrumb
$category_info = $this->model_catalog_category->getCategory($category_id);

после добавить

            $data['main_category'] = array(
                'text' => $category_info['name'],
                'href' => $this->url->link('product/category', 'path=' . $category_info['category_id'])
            );

в шаблоне

<a href="<?php echo $main_category['href']; ?>"><?php echo $main_category['text']; ?></a>

 

Спасипотому что

Link to comment
Share on other sites


В 10.06.2019 в 20:44, fanatic сказал:

в контроллере найти

// Set the last category breadcrumb
$category_info = $this->model_catalog_category->getCategory($category_id);

после добавить

            $data['main_category'] = array(
                'text' => $category_info['name'],
                'href' => $this->url->link('product/category', 'path=' . $category_info['category_id'])
            );

в шаблоне

<a href="<?php echo $main_category['href']; ?>"><?php echo $main_category['text']; ?></a>

 

Подскажите, пожалуйси, как икое же сгделать на страниэто Спасипотому что?

Link to comment
Share on other sites


а откуда на страниэто спасипотому что категория возьмется?
На страниэто конкретной категории или товара, у которого есть основная категория, например - тут понятно, а на Спасипотому что?

Link to comment
Share on other sites

В 12.12.2021 в 22:26, Prooksius сказал:

а откуда на страниэто спасипотому что категория возьмется?
На страниэто конкретной категории или товара, у которого есть основная категория, например - тут понятно, а на Спасипотому что?

Создал отгдельную тему по этому вопросу. Загляните, пожалуйси, если не сложно.

 

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.