Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Вывод категорий в карточке товара OpenCart 2.3


Recommended Posts

Отображает принадлежность товара к категориям в карточке товара.

Не знаю было ли что подобное на форуме наверняка наверное было, но на всякий случай выложу модификатор.

 

В строке <file path="catalog/view/theme/ВАША ТЕМА/template/product/product.tpl" error="log">

ВАША ТЕМА заменить на тему установленную у вас.

 

Заходим в модификаторы, нажимаем на + копируем, вставляем и сохраняем, делаем обновление и радуемся категориям в карточке товара.

 

 

<?xml version="1.0" encoding="utf-8"?>
<modification>
<code>Product Categories OpenCart 2.3</code>
<name>Product Categories OpenCart 2.3</name>
<version>2.3</version>
<author>[email protected]</author>

<file path="catalog/view/theme/ВАША ТЕМА/template/product/product.tpl" error="log">
<operation error="log">
<search><![CDATA[<?php echo $stock; ?></span></li>]]></search>
<add position="after"><![CDATA[<li class="p-brand">Категории товара: </span><?php foreach ($catprod as $catp) { ?> <a href="<?php echo $catp['href']; ?>"><?php echo $catp['name']; ?></a> \<?php } ?></li>]]></add>
</operation>
</file>

<file path="catalog/controller/product/product.php" error="log">
<operation error="log">
<search><![CDATA[if ($product_info) {]]></search>
<add position="before"><![CDATA[
    $this->load->model('catalog/category');
        $data['catprod'] = array();          
        $product_category = $this->model_catalog_product->getCategories($product_id);          
        foreach ($product_category as $prodcat) {
        $category_info = $this->model_catalog_category->getCategory($prodcat['category_id']);
        if ($category_info) {
             $data['catprod'][] = array(
             'name'     => $category_info['name'],
             'href'     => $this->url->link('product/category', 'path=' . $category_info['category_id'])
             );
        }
        } 
]]></add>
</operation>
</file>

</modification>

kategory.JPG

  • +1 2
Link to comment
Share on other sites


  • 1 year later...
  • 2 years later...
В 03.12.2018 в 11:01, oligarhist сказал:

Не сработало! 
OCStore 2.3 + шаблон UniShop

 

 

Потому что сделано это для Шаблона Journal, если присмотреться то нужно у себя искать то что в твоём шаблоне и заменить в ocmode, я у себя так сделал и всё заработала 

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.