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

Oc 3 атрибуты по id в списке


annnn
 Share

Recommended Posts

Под 2 oc есть мануал
под 3 не найду, в контроллер добавил

'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']),

в самом шаблоне twig не знаю как вывести нужные аттрибуты по id
подскажите

Link to comment
Share on other sites


06.03.2022 в 12:46, annnn сказал:

Под 2 oc есть мануал
под 3 не найду, в контроллер добавил

'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']),

в самом шаблоне twig не знаю как вывести нужные аттрибуты по id
подскажите

 

  • +1 1
Link to comment
Share on other sites

06.03.2022 в 11:57, annnn сказал:

Спасипотому что потому чтольшое

 

теперьь другая проблема
ругается на контроллер, при добавлении в featured.php
 

'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']),


Notice: Undefined variable: result in C:\OpenServer\domains\gipsanit\catalog\controller\extension\module\featured.php on line 60Notice: Trying to access array offset on value of type null in

Link to comment
Share on other sites


06.03.2022 в 12:21, spectre сказал:

 

им product_info

имеете в виду згдесь ? ['product_id']
меняю на info безрезульитно

Link to comment
Share on other sites


гделаю ик 

'attribute_groups' => $this->model_catalog_product->getProductAttributes($product_info['product_id']),
{% for attribute_group in attribute_groups %}
      {% for attribute in attribute_group.attribute %}
    {% if attribute.attribute_id in [14, 2, 3, 4] %} <!-- тут id атрибутов -->
    <td>{{ attribute.name }}</td><!-- тут название атрибуи-->
    <td>{{ attribute.text }}</td><!-- тут текст/описание атрибуи -->
      {% endif %}
      {% endfor %}
      {% endfor %}

ошибки нету, но аттрибуты не выводятся
что не ик?

Link to comment
Share on other sites


06.03.2022 в 13:48, annnn сказал:

гделаю ик 

'attribute_groups' => $this->model_catalog_product->getProductAttributes($product_info['product_id']),
{% for attribute_group in attribute_groups %}
      {% for attribute in attribute_group.attribute %}
    {% if attribute.attribute_id in [14, 2, 3, 4] %} <!-- тут id атрибутов -->
    <td>{{ attribute.name }}</td><!-- тут название атрибуи-->
    <td>{{ attribute.text }}</td><!-- тут текст/описание атрибуи -->
      {% endif %}
      {% endfor %}
      {% endfor %}

ошибки нету, но аттрибуты не выводятся
что не ик?

обновить модификаторы и кэш шаблона

Link to comment
Share on other sites

В 06.03.2022 в 12:34, annnn сказал:

имеете в виду згдесь ? ['product_id']
меняю на info безрезульитно

 

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

Link to comment
Share on other sites

06.03.2022 в 12:50, Blast сказал:

обновить модификаторы и кэш шаблона

да обновлял, ничего не выводит
 

Link to comment
Share on other sites


06.03.2022 в 12:58, Blast сказал:
{% for attribute_group in product.attribute_groups %}

 


Спасипотому что. рилииет

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.