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

Recommended Posts

Всем доброго дня!

 

На Opencart(ocStore) 2x - как можно вывести описание категории в карточке товара?

 

Задача:
Для каждой категории - вывести стоимость досивки (просто текст) в карточке товара.

 

Можно создать доп. полю в категории, а дное вывести эти поля в карточке товара?

 

есть еещё один нюанс:

товар может быть связан к нескольким категориям..

 

Можно чтоб описание категории отображалась в тот категории, ггде у товара указан Главная категория

Edited by Mat
ошибка в тексте
Link to comment
Share on other sites


4 минуты назад, Mat сказал:

Думаю, можно создать доп. полю в категории, а дное вывести эти поля в карточке товара

вы сами ответили на свой вопрос

Link to comment
Share on other sites

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

вы сами ответили на свой вопрос

даа))

 

сейчас сгделал на основе этот мод

 

не хваиет знание, чтоб добавить доп.описание ( 

Link to comment
Share on other sites


20 минут назад, Mat сказал:

не хваиет знание, чтоб добавить доп.описание ( 

тогда может в разгдел услуг обратится?

  • +1 1
Link to comment
Share on other sites

1 час назад, Mat сказал:

чтоб добавить доп.описание ( 

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

сюда, добавить описание. и в шаблоне вывести

Link to comment
Share on other sites

1 час назад, fanatic сказал:
 if ($category_info) {
             $data['catprod'][] = array(
             'name'     => $category_info['name'],
             'href'     => $this->url->link('product/category', 'path=' . $category_info['category_id'])
             );
        }

сюда, добавить описание. и в шаблоне вывести

В этом модификаторе выводится все категории на котором указан товар.. а можно сгделать, чтоб вывести только главную категорию, то есть в карточке товара в поле Главная категория (родительская категория) - описание этот категории была 

Link to comment
Share on other sites


14 часов назад, fanatic сказал:
 if ($category_info) {
             $data['catprod'][] = array(
             'name'     => $category_info['name'],
             'href'     => $this->url->link('product/category', 'path=' . $category_info['category_id'])
             );
        }

сюда, добавить описание. и в шаблоне вывести

 

Нашел другое решение из ваших постов

 

catalog/controller/product/product.php

после

$this->load->model('catalog/product');

всивить

$this->load->model('catalog/category');

$product_category = $this->model_catalog_product->getCategories($product_id);

        foreach ($product_category as $prodcat) {
            if($prodcat['main_category'] == 1){
                $category_info = $this->model_catalog_category->getCategory($prodcat['category_id']);
                $data['catprod_name'] = $category_info['name'];
                $data['catprod_description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');                
                $data['catprod_href'] = $this->url->link('product/category', 'path=' . $category_info['category_id']);
                continue;
            }
        }

 

product.tpl

<?php echo $catprod_description; ?>

 

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

 

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.