helen2014 Posted September 18, 2019 Share Posted September 18, 2019 Здравствуйте! ocStore 3.0.2.0 Помогите вывести атрибуты по id. {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options...
Blast Posted September 18, 2019 Share Posted September 18, 2019 16 минут назад, helen2014 сказал: Здравствуйте! ocStore 3.0.2.0 Помогите вывести атрибуты по id. вывод названия и значения только атрибута с id=3 {% if attribute.attribute_id == 3 %} <tr> <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> </tr> {% endif %} 2 Link to comment Share on other sites More sharing options... PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 Типа такого что-то? {% if attribute.id == '1' or attribute.id == '2' %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 Спасибо! Но этот вариант не работает. Выводится только группа атрибута. Сам атрибут и значения атрибута нет. Link to comment Share on other sites More sharing options... PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 @helen2014 покажите код полностью плиз. Не может не работать, обязано. 1 Link to comment Share on other sites More sharing options... PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 да, и у меня не правильно там, сорри - не attribute.id, а attribute.attribute_id, как писал @Blast Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 2 минуты назад, PaulKravchenko сказал: @helen2014 покажите код полностью плиз. Не может не работать, обязано. {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id == '13' or attribute.id == '13' %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options... Blast Posted September 18, 2019 Share Posted September 18, 2019 (edited) {% if attribute.attribute_id == '13' %} если нужно несколько атрибутов, то можно так: {% if attribute.attribute_id in [13, 14, 15] %} Edited September 18, 2019 by Blast 1 Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 1 минуту назад, Blast сказал: {% if attribute.attribute_id == '13' %} Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} Link to comment Share on other sites More sharing options... PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 1 минуту назад, helen2014 сказал: добавляем через запятую? не прокатит, через or Link to comment Share on other sites More sharing options... Blast Posted September 18, 2019 Share Posted September 18, 2019 6 минут назад, helen2014 сказал: Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} {% if attribute.attribute_id in [13, 14, 15] %} Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 8 минут назад, Blast сказал: {% if attribute.attribute_id in [13, 14, 15] %} Все работает! Link to comment Share on other sites More sharing options... 10 months later... nibbl Posted July 21, 2020 Share Posted July 21, 2020 вставил не работает, надо еще что то вставлять в контроллере? Link to comment Share on other sites More sharing options... 4 months later... kuripka2222 Posted December 3, 2020 Share Posted December 3, 2020 В 21.07.2020 в 12:16, nibbl сказал: вставил не работает, надо еще что то вставлять в контроллере? {% for attribute_group in attribute_groups %} {% for attribute in attribute_group.attribute %} {% if attribute.attribute_id in [1, 2, 3, 4] %} <!-- тут id атрибутов --> <td>{{ attribute.name }}</td><!-- тут название атрибута--> <td>{{ attribute.text }}</td><!-- тут текст/описание атрибута --> {% endif %} {% endfor %} {% endfor %} Link to comment Share on other sites More sharing options... 4 months later... vsok2007 Posted April 3, 2021 Share Posted April 3, 2021 (edited) В контролер после $data['products'][] = array( -- 'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']), -- Edited April 3, 2021 by vsok2007 Link to comment Share on other sites More sharing options... 1 month later... alia123 Posted May 9, 2021 Share Posted May 9, 2021 У меня не работает. вот такой код получается? {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id in [17, 73, 34, 35] or attribute.id in [17, 73, 34, 35] %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options... 4 weeks later... Igor112 Posted June 5, 2021 Share Posted June 5, 2021 (edited) Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> Edited June 5, 2021 by Igor112 Link to comment Share on other sites More sharing options... Blast Posted June 5, 2021 Share Posted June 5, 2021 3 часа назад, Igor112 сказал: Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} Link to comment Share on other sites More sharing options... Igor112 Posted June 6, 2021 Share Posted June 6, 2021 В 05.06.2021 в 15:57, Blast сказал: {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. Link to comment Share on other sites More sharing options... Blast Posted June 7, 2021 Share Posted June 7, 2021 15 часов назад, Igor112 сказал: <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. если для получения атрибутов пользовались стандартной функцией, то должно быть так {% for attribute in attributeColumn.attribute %} а если какой-то самопис, то кто ж знает какая у вас структура данных и как отличить категорию Характеристики от других Link to comment Share on other sites More sharing options... 3 weeks later... configurator Posted June 22, 2021 Share Posted June 22, 2021 Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? Link to comment Share on other sites More sharing options... lexxkrt Posted June 24, 2021 Share Posted June 24, 2021 В 22.06.2021 в 17:31, configurator сказал: Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? сформировать нужные данные в зависимости от входных данных в контроллере. в твиге (во вьюхе) вообще логики по минимуму должно быть. пишите сразу правильно Link to comment Share on other sites More sharing options... configurator Posted June 24, 2021 Share Posted June 24, 2021 А можете подробнее написать? Например сюда (category.php): $data['products'][] = array( 'product_id' => $result['product_id'], Добавить: $data['products'][] = array( 'product_id' => $result['product_id'], 'category_id' => $result['product_categoryid'], Так? Link to comment Share on other sites More sharing options... 1 year later... dizastill Posted October 27, 2022 Share Posted October 27, 2022 (edited) Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать Edited October 27, 2022 by dizastill Link to comment Share on other sites More sharing options... Blast Posted October 27, 2022 Share Posted October 27, 2022 27.10.2022 в 13:23, dizastill сказал: Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать {% if attribute_group.attribute_group_id == 'ид_нужной_группы' %} Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 More sharing options... Followers 4 Go to topic listing Similar Content Релиз ocStore 3.0.2.0 1 2 3 4 11 By dinox, February 6, 2019 ocstore 3 ocstore 3.0.2.0 267 replies 101,246 views sergio1987 November 12, 2022 Вывод названия и ссылки главной категории в блоге окстор 3.0.2.0 By AlexMax13, January 4 ocstore блог 1 reply 129 views AlexMax13 January 4 Как сделать правильное структурирование Opencart 3.0.2.0 By Lucider105, Thursday at 12:58 PM 5 replies 147 views Lucider105 Thursday at 04:03 PM Перенос данных Ocfilter с версии OcStore 2.3 на OcStore 3.0.2.0 By WeBuy, November 11, 2022 2 replies 268 views WeBuy November 11, 2022 Интеграция 1С 8.3 Предприятие с ocStore 3.0.2.0 By sergbb, October 6, 2022 3 replies 437 views BTops October 16, 2022 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Вывод определенных атрибутiов ocStore 3.0.2.0 Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Chameleon - Responsive & Multipurpose Opencart Template + Quick Start By 29aleksey Wayforpay API оплата для Opencart 2.3, 3.x By bogdan281989 TgMarket - Модуль интернет магазина в телеграмме. By Rassol2 ShowCase – Responsive / Multipurpose Opencart Template By octemplates Telnotification By Yevhenii_7777 × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × 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. I accept
PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 Типа такого что-то? {% if attribute.id == '1' or attribute.id == '2' %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 Спасибо! Но этот вариант не работает. Выводится только группа атрибута. Сам атрибут и значения атрибута нет. Link to comment Share on other sites More sharing options... PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 @helen2014 покажите код полностью плиз. Не может не работать, обязано. 1 Link to comment Share on other sites More sharing options... PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 да, и у меня не правильно там, сорри - не attribute.id, а attribute.attribute_id, как писал @Blast Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 2 минуты назад, PaulKravchenko сказал: @helen2014 покажите код полностью плиз. Не может не работать, обязано. {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id == '13' or attribute.id == '13' %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options... Blast Posted September 18, 2019 Share Posted September 18, 2019 (edited) {% if attribute.attribute_id == '13' %} если нужно несколько атрибутов, то можно так: {% if attribute.attribute_id in [13, 14, 15] %} Edited September 18, 2019 by Blast 1 Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 1 минуту назад, Blast сказал: {% if attribute.attribute_id == '13' %} Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} Link to comment Share on other sites More sharing options... PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 1 минуту назад, helen2014 сказал: добавляем через запятую? не прокатит, через or Link to comment Share on other sites More sharing options... Blast Posted September 18, 2019 Share Posted September 18, 2019 6 минут назад, helen2014 сказал: Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} {% if attribute.attribute_id in [13, 14, 15] %} Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 8 минут назад, Blast сказал: {% if attribute.attribute_id in [13, 14, 15] %} Все работает! Link to comment Share on other sites More sharing options... 10 months later... nibbl Posted July 21, 2020 Share Posted July 21, 2020 вставил не работает, надо еще что то вставлять в контроллере? Link to comment Share on other sites More sharing options... 4 months later... kuripka2222 Posted December 3, 2020 Share Posted December 3, 2020 В 21.07.2020 в 12:16, nibbl сказал: вставил не работает, надо еще что то вставлять в контроллере? {% for attribute_group in attribute_groups %} {% for attribute in attribute_group.attribute %} {% if attribute.attribute_id in [1, 2, 3, 4] %} <!-- тут id атрибутов --> <td>{{ attribute.name }}</td><!-- тут название атрибута--> <td>{{ attribute.text }}</td><!-- тут текст/описание атрибута --> {% endif %} {% endfor %} {% endfor %} Link to comment Share on other sites More sharing options... 4 months later... vsok2007 Posted April 3, 2021 Share Posted April 3, 2021 (edited) В контролер после $data['products'][] = array( -- 'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']), -- Edited April 3, 2021 by vsok2007 Link to comment Share on other sites More sharing options... 1 month later... alia123 Posted May 9, 2021 Share Posted May 9, 2021 У меня не работает. вот такой код получается? {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id in [17, 73, 34, 35] or attribute.id in [17, 73, 34, 35] %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options... 4 weeks later... Igor112 Posted June 5, 2021 Share Posted June 5, 2021 (edited) Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> Edited June 5, 2021 by Igor112 Link to comment Share on other sites More sharing options... Blast Posted June 5, 2021 Share Posted June 5, 2021 3 часа назад, Igor112 сказал: Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} Link to comment Share on other sites More sharing options... Igor112 Posted June 6, 2021 Share Posted June 6, 2021 В 05.06.2021 в 15:57, Blast сказал: {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. Link to comment Share on other sites More sharing options... Blast Posted June 7, 2021 Share Posted June 7, 2021 15 часов назад, Igor112 сказал: <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. если для получения атрибутов пользовались стандартной функцией, то должно быть так {% for attribute in attributeColumn.attribute %} а если какой-то самопис, то кто ж знает какая у вас структура данных и как отличить категорию Характеристики от других Link to comment Share on other sites More sharing options... 3 weeks later... configurator Posted June 22, 2021 Share Posted June 22, 2021 Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? Link to comment Share on other sites More sharing options... lexxkrt Posted June 24, 2021 Share Posted June 24, 2021 В 22.06.2021 в 17:31, configurator сказал: Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? сформировать нужные данные в зависимости от входных данных в контроллере. в твиге (во вьюхе) вообще логики по минимуму должно быть. пишите сразу правильно Link to comment Share on other sites More sharing options... configurator Posted June 24, 2021 Share Posted June 24, 2021 А можете подробнее написать? Например сюда (category.php): $data['products'][] = array( 'product_id' => $result['product_id'], Добавить: $data['products'][] = array( 'product_id' => $result['product_id'], 'category_id' => $result['product_categoryid'], Так? Link to comment Share on other sites More sharing options... 1 year later... dizastill Posted October 27, 2022 Share Posted October 27, 2022 (edited) Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать Edited October 27, 2022 by dizastill Link to comment Share on other sites More sharing options... Blast Posted October 27, 2022 Share Posted October 27, 2022 27.10.2022 в 13:23, dizastill сказал: Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать {% if attribute_group.attribute_group_id == 'ид_нужной_группы' %} Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 More sharing options... Followers 4 Go to topic listing Similar Content Релиз ocStore 3.0.2.0 1 2 3 4 11 By dinox, February 6, 2019 ocstore 3 ocstore 3.0.2.0 267 replies 101,246 views sergio1987 November 12, 2022 Вывод названия и ссылки главной категории в блоге окстор 3.0.2.0 By AlexMax13, January 4 ocstore блог 1 reply 129 views AlexMax13 January 4 Как сделать правильное структурирование Opencart 3.0.2.0 By Lucider105, Thursday at 12:58 PM 5 replies 147 views Lucider105 Thursday at 04:03 PM Перенос данных Ocfilter с версии OcStore 2.3 на OcStore 3.0.2.0 By WeBuy, November 11, 2022 2 replies 268 views WeBuy November 11, 2022 Интеграция 1С 8.3 Предприятие с ocStore 3.0.2.0 By sergbb, October 6, 2022 3 replies 437 views BTops October 16, 2022 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Вывод определенных атрибутiов ocStore 3.0.2.0 Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Chameleon - Responsive & Multipurpose Opencart Template + Quick Start By 29aleksey Wayforpay API оплата для Opencart 2.3, 3.x By bogdan281989 TgMarket - Модуль интернет магазина в телеграмме. By Rassol2 ShowCase – Responsive / Multipurpose Opencart Template By octemplates Telnotification By Yevhenii_7777 × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × 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. I accept
helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 Спасибо! Но этот вариант не работает. Выводится только группа атрибута. Сам атрибут и значения атрибута нет. Link to comment Share on other sites More sharing options...
PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 @helen2014 покажите код полностью плиз. Не может не работать, обязано. 1 Link to comment Share on other sites More sharing options... PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 да, и у меня не правильно там, сорри - не attribute.id, а attribute.attribute_id, как писал @Blast Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 2 минуты назад, PaulKravchenko сказал: @helen2014 покажите код полностью плиз. Не может не работать, обязано. {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id == '13' or attribute.id == '13' %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options... Blast Posted September 18, 2019 Share Posted September 18, 2019 (edited) {% if attribute.attribute_id == '13' %} если нужно несколько атрибутов, то можно так: {% if attribute.attribute_id in [13, 14, 15] %} Edited September 18, 2019 by Blast 1 Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 1 минуту назад, Blast сказал: {% if attribute.attribute_id == '13' %} Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} Link to comment Share on other sites More sharing options... PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 1 минуту назад, helen2014 сказал: добавляем через запятую? не прокатит, через or Link to comment Share on other sites More sharing options... Blast Posted September 18, 2019 Share Posted September 18, 2019 6 минут назад, helen2014 сказал: Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} {% if attribute.attribute_id in [13, 14, 15] %} Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 8 минут назад, Blast сказал: {% if attribute.attribute_id in [13, 14, 15] %} Все работает! Link to comment Share on other sites More sharing options... 10 months later... nibbl Posted July 21, 2020 Share Posted July 21, 2020 вставил не работает, надо еще что то вставлять в контроллере? Link to comment Share on other sites More sharing options... 4 months later... kuripka2222 Posted December 3, 2020 Share Posted December 3, 2020 В 21.07.2020 в 12:16, nibbl сказал: вставил не работает, надо еще что то вставлять в контроллере? {% for attribute_group in attribute_groups %} {% for attribute in attribute_group.attribute %} {% if attribute.attribute_id in [1, 2, 3, 4] %} <!-- тут id атрибутов --> <td>{{ attribute.name }}</td><!-- тут название атрибута--> <td>{{ attribute.text }}</td><!-- тут текст/описание атрибута --> {% endif %} {% endfor %} {% endfor %} Link to comment Share on other sites More sharing options... 4 months later... vsok2007 Posted April 3, 2021 Share Posted April 3, 2021 (edited) В контролер после $data['products'][] = array( -- 'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']), -- Edited April 3, 2021 by vsok2007 Link to comment Share on other sites More sharing options... 1 month later... alia123 Posted May 9, 2021 Share Posted May 9, 2021 У меня не работает. вот такой код получается? {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id in [17, 73, 34, 35] or attribute.id in [17, 73, 34, 35] %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options... 4 weeks later... Igor112 Posted June 5, 2021 Share Posted June 5, 2021 (edited) Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> Edited June 5, 2021 by Igor112 Link to comment Share on other sites More sharing options... Blast Posted June 5, 2021 Share Posted June 5, 2021 3 часа назад, Igor112 сказал: Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} Link to comment Share on other sites More sharing options... Igor112 Posted June 6, 2021 Share Posted June 6, 2021 В 05.06.2021 в 15:57, Blast сказал: {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. Link to comment Share on other sites More sharing options... Blast Posted June 7, 2021 Share Posted June 7, 2021 15 часов назад, Igor112 сказал: <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. если для получения атрибутов пользовались стандартной функцией, то должно быть так {% for attribute in attributeColumn.attribute %} а если какой-то самопис, то кто ж знает какая у вас структура данных и как отличить категорию Характеристики от других Link to comment Share on other sites More sharing options... 3 weeks later... configurator Posted June 22, 2021 Share Posted June 22, 2021 Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? Link to comment Share on other sites More sharing options... lexxkrt Posted June 24, 2021 Share Posted June 24, 2021 В 22.06.2021 в 17:31, configurator сказал: Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? сформировать нужные данные в зависимости от входных данных в контроллере. в твиге (во вьюхе) вообще логики по минимуму должно быть. пишите сразу правильно Link to comment Share on other sites More sharing options... configurator Posted June 24, 2021 Share Posted June 24, 2021 А можете подробнее написать? Например сюда (category.php): $data['products'][] = array( 'product_id' => $result['product_id'], Добавить: $data['products'][] = array( 'product_id' => $result['product_id'], 'category_id' => $result['product_categoryid'], Так? Link to comment Share on other sites More sharing options... 1 year later... dizastill Posted October 27, 2022 Share Posted October 27, 2022 (edited) Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать Edited October 27, 2022 by dizastill Link to comment Share on other sites More sharing options... Blast Posted October 27, 2022 Share Posted October 27, 2022 27.10.2022 в 13:23, dizastill сказал: Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать {% if attribute_group.attribute_group_id == 'ид_нужной_группы' %} Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 More sharing options... Followers 4 Go to topic listing Similar Content Релиз ocStore 3.0.2.0 1 2 3 4 11 By dinox, February 6, 2019 ocstore 3 ocstore 3.0.2.0 267 replies 101,246 views sergio1987 November 12, 2022 Вывод названия и ссылки главной категории в блоге окстор 3.0.2.0 By AlexMax13, January 4 ocstore блог 1 reply 129 views AlexMax13 January 4 Как сделать правильное структурирование Opencart 3.0.2.0 By Lucider105, Thursday at 12:58 PM 5 replies 147 views Lucider105 Thursday at 04:03 PM Перенос данных Ocfilter с версии OcStore 2.3 на OcStore 3.0.2.0 By WeBuy, November 11, 2022 2 replies 268 views WeBuy November 11, 2022 Интеграция 1С 8.3 Предприятие с ocStore 3.0.2.0 By sergbb, October 6, 2022 3 replies 437 views BTops October 16, 2022 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Вывод определенных атрибутiов ocStore 3.0.2.0 Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Chameleon - Responsive & Multipurpose Opencart Template + Quick Start By 29aleksey Wayforpay API оплата для Opencart 2.3, 3.x By bogdan281989 TgMarket - Модуль интернет магазина в телеграмме. By Rassol2 ShowCase – Responsive / Multipurpose Opencart Template By octemplates Telnotification By Yevhenii_7777 × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × 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. I accept
PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 да, и у меня не правильно там, сорри - не attribute.id, а attribute.attribute_id, как писал @Blast Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 2 минуты назад, PaulKravchenko сказал: @helen2014 покажите код полностью плиз. Не может не работать, обязано. {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id == '13' or attribute.id == '13' %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options... Blast Posted September 18, 2019 Share Posted September 18, 2019 (edited) {% if attribute.attribute_id == '13' %} если нужно несколько атрибутов, то можно так: {% if attribute.attribute_id in [13, 14, 15] %} Edited September 18, 2019 by Blast 1 Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 1 минуту назад, Blast сказал: {% if attribute.attribute_id == '13' %} Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} Link to comment Share on other sites More sharing options... PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 1 минуту назад, helen2014 сказал: добавляем через запятую? не прокатит, через or Link to comment Share on other sites More sharing options... Blast Posted September 18, 2019 Share Posted September 18, 2019 6 минут назад, helen2014 сказал: Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} {% if attribute.attribute_id in [13, 14, 15] %} Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 8 минут назад, Blast сказал: {% if attribute.attribute_id in [13, 14, 15] %} Все работает! Link to comment Share on other sites More sharing options... 10 months later... nibbl Posted July 21, 2020 Share Posted July 21, 2020 вставил не работает, надо еще что то вставлять в контроллере? Link to comment Share on other sites More sharing options... 4 months later... kuripka2222 Posted December 3, 2020 Share Posted December 3, 2020 В 21.07.2020 в 12:16, nibbl сказал: вставил не работает, надо еще что то вставлять в контроллере? {% for attribute_group in attribute_groups %} {% for attribute in attribute_group.attribute %} {% if attribute.attribute_id in [1, 2, 3, 4] %} <!-- тут id атрибутов --> <td>{{ attribute.name }}</td><!-- тут название атрибута--> <td>{{ attribute.text }}</td><!-- тут текст/описание атрибута --> {% endif %} {% endfor %} {% endfor %} Link to comment Share on other sites More sharing options... 4 months later... vsok2007 Posted April 3, 2021 Share Posted April 3, 2021 (edited) В контролер после $data['products'][] = array( -- 'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']), -- Edited April 3, 2021 by vsok2007 Link to comment Share on other sites More sharing options... 1 month later... alia123 Posted May 9, 2021 Share Posted May 9, 2021 У меня не работает. вот такой код получается? {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id in [17, 73, 34, 35] or attribute.id in [17, 73, 34, 35] %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options... 4 weeks later... Igor112 Posted June 5, 2021 Share Posted June 5, 2021 (edited) Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> Edited June 5, 2021 by Igor112 Link to comment Share on other sites More sharing options... Blast Posted June 5, 2021 Share Posted June 5, 2021 3 часа назад, Igor112 сказал: Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} Link to comment Share on other sites More sharing options... Igor112 Posted June 6, 2021 Share Posted June 6, 2021 В 05.06.2021 в 15:57, Blast сказал: {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. Link to comment Share on other sites More sharing options... Blast Posted June 7, 2021 Share Posted June 7, 2021 15 часов назад, Igor112 сказал: <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. если для получения атрибутов пользовались стандартной функцией, то должно быть так {% for attribute in attributeColumn.attribute %} а если какой-то самопис, то кто ж знает какая у вас структура данных и как отличить категорию Характеристики от других Link to comment Share on other sites More sharing options... 3 weeks later... configurator Posted June 22, 2021 Share Posted June 22, 2021 Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? Link to comment Share on other sites More sharing options... lexxkrt Posted June 24, 2021 Share Posted June 24, 2021 В 22.06.2021 в 17:31, configurator сказал: Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? сформировать нужные данные в зависимости от входных данных в контроллере. в твиге (во вьюхе) вообще логики по минимуму должно быть. пишите сразу правильно Link to comment Share on other sites More sharing options... configurator Posted June 24, 2021 Share Posted June 24, 2021 А можете подробнее написать? Например сюда (category.php): $data['products'][] = array( 'product_id' => $result['product_id'], Добавить: $data['products'][] = array( 'product_id' => $result['product_id'], 'category_id' => $result['product_categoryid'], Так? Link to comment Share on other sites More sharing options... 1 year later... dizastill Posted October 27, 2022 Share Posted October 27, 2022 (edited) Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать Edited October 27, 2022 by dizastill Link to comment Share on other sites More sharing options... Blast Posted October 27, 2022 Share Posted October 27, 2022 27.10.2022 в 13:23, dizastill сказал: Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать {% if attribute_group.attribute_group_id == 'ид_нужной_группы' %} Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 More sharing options... Followers 4 Go to topic listing Similar Content Релиз ocStore 3.0.2.0 1 2 3 4 11 By dinox, February 6, 2019 ocstore 3 ocstore 3.0.2.0 267 replies 101,246 views sergio1987 November 12, 2022 Вывод названия и ссылки главной категории в блоге окстор 3.0.2.0 By AlexMax13, January 4 ocstore блог 1 reply 129 views AlexMax13 January 4 Как сделать правильное структурирование Opencart 3.0.2.0 By Lucider105, Thursday at 12:58 PM 5 replies 147 views Lucider105 Thursday at 04:03 PM Перенос данных Ocfilter с версии OcStore 2.3 на OcStore 3.0.2.0 By WeBuy, November 11, 2022 2 replies 268 views WeBuy November 11, 2022 Интеграция 1С 8.3 Предприятие с ocStore 3.0.2.0 By sergbb, October 6, 2022 3 replies 437 views BTops October 16, 2022 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Вывод определенных атрибутiов ocStore 3.0.2.0 Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Chameleon - Responsive & Multipurpose Opencart Template + Quick Start By 29aleksey Wayforpay API оплата для Opencart 2.3, 3.x By bogdan281989 TgMarket - Модуль интернет магазина в телеграмме. By Rassol2 ShowCase – Responsive / Multipurpose Opencart Template By octemplates Telnotification By Yevhenii_7777 × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × 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. I accept
helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 2 минуты назад, PaulKravchenko сказал: @helen2014 покажите код полностью плиз. Не может не работать, обязано. {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id == '13' or attribute.id == '13' %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options...
Blast Posted September 18, 2019 Share Posted September 18, 2019 (edited) {% if attribute.attribute_id == '13' %} если нужно несколько атрибутов, то можно так: {% if attribute.attribute_id in [13, 14, 15] %} Edited September 18, 2019 by Blast 1 Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 1 минуту назад, Blast сказал: {% if attribute.attribute_id == '13' %} Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} Link to comment Share on other sites More sharing options... PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 1 минуту назад, helen2014 сказал: добавляем через запятую? не прокатит, через or Link to comment Share on other sites More sharing options... Blast Posted September 18, 2019 Share Posted September 18, 2019 6 минут назад, helen2014 сказал: Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} {% if attribute.attribute_id in [13, 14, 15] %} Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 8 минут назад, Blast сказал: {% if attribute.attribute_id in [13, 14, 15] %} Все работает! Link to comment Share on other sites More sharing options... 10 months later... nibbl Posted July 21, 2020 Share Posted July 21, 2020 вставил не работает, надо еще что то вставлять в контроллере? Link to comment Share on other sites More sharing options... 4 months later... kuripka2222 Posted December 3, 2020 Share Posted December 3, 2020 В 21.07.2020 в 12:16, nibbl сказал: вставил не работает, надо еще что то вставлять в контроллере? {% for attribute_group in attribute_groups %} {% for attribute in attribute_group.attribute %} {% if attribute.attribute_id in [1, 2, 3, 4] %} <!-- тут id атрибутов --> <td>{{ attribute.name }}</td><!-- тут название атрибута--> <td>{{ attribute.text }}</td><!-- тут текст/описание атрибута --> {% endif %} {% endfor %} {% endfor %} Link to comment Share on other sites More sharing options... 4 months later... vsok2007 Posted April 3, 2021 Share Posted April 3, 2021 (edited) В контролер после $data['products'][] = array( -- 'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']), -- Edited April 3, 2021 by vsok2007 Link to comment Share on other sites More sharing options... 1 month later... alia123 Posted May 9, 2021 Share Posted May 9, 2021 У меня не работает. вот такой код получается? {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id in [17, 73, 34, 35] or attribute.id in [17, 73, 34, 35] %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options... 4 weeks later... Igor112 Posted June 5, 2021 Share Posted June 5, 2021 (edited) Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> Edited June 5, 2021 by Igor112 Link to comment Share on other sites More sharing options... Blast Posted June 5, 2021 Share Posted June 5, 2021 3 часа назад, Igor112 сказал: Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} Link to comment Share on other sites More sharing options... Igor112 Posted June 6, 2021 Share Posted June 6, 2021 В 05.06.2021 в 15:57, Blast сказал: {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. Link to comment Share on other sites More sharing options... Blast Posted June 7, 2021 Share Posted June 7, 2021 15 часов назад, Igor112 сказал: <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. если для получения атрибутов пользовались стандартной функцией, то должно быть так {% for attribute in attributeColumn.attribute %} а если какой-то самопис, то кто ж знает какая у вас структура данных и как отличить категорию Характеристики от других Link to comment Share on other sites More sharing options... 3 weeks later... configurator Posted June 22, 2021 Share Posted June 22, 2021 Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? Link to comment Share on other sites More sharing options... lexxkrt Posted June 24, 2021 Share Posted June 24, 2021 В 22.06.2021 в 17:31, configurator сказал: Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? сформировать нужные данные в зависимости от входных данных в контроллере. в твиге (во вьюхе) вообще логики по минимуму должно быть. пишите сразу правильно Link to comment Share on other sites More sharing options... configurator Posted June 24, 2021 Share Posted June 24, 2021 А можете подробнее написать? Например сюда (category.php): $data['products'][] = array( 'product_id' => $result['product_id'], Добавить: $data['products'][] = array( 'product_id' => $result['product_id'], 'category_id' => $result['product_categoryid'], Так? Link to comment Share on other sites More sharing options... 1 year later... dizastill Posted October 27, 2022 Share Posted October 27, 2022 (edited) Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать Edited October 27, 2022 by dizastill Link to comment Share on other sites More sharing options... Blast Posted October 27, 2022 Share Posted October 27, 2022 27.10.2022 в 13:23, dizastill сказал: Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать {% if attribute_group.attribute_group_id == 'ид_нужной_группы' %} Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 More sharing options... Followers 4 Go to topic listing Similar Content Релиз ocStore 3.0.2.0 1 2 3 4 11 By dinox, February 6, 2019 ocstore 3 ocstore 3.0.2.0 267 replies 101,246 views sergio1987 November 12, 2022 Вывод названия и ссылки главной категории в блоге окстор 3.0.2.0 By AlexMax13, January 4 ocstore блог 1 reply 129 views AlexMax13 January 4 Как сделать правильное структурирование Opencart 3.0.2.0 By Lucider105, Thursday at 12:58 PM 5 replies 147 views Lucider105 Thursday at 04:03 PM Перенос данных Ocfilter с версии OcStore 2.3 на OcStore 3.0.2.0 By WeBuy, November 11, 2022 2 replies 268 views WeBuy November 11, 2022 Интеграция 1С 8.3 Предприятие с ocStore 3.0.2.0 By sergbb, October 6, 2022 3 replies 437 views BTops October 16, 2022 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Вывод определенных атрибутiов ocStore 3.0.2.0 Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Chameleon - Responsive & Multipurpose Opencart Template + Quick Start By 29aleksey Wayforpay API оплата для Opencart 2.3, 3.x By bogdan281989 TgMarket - Модуль интернет магазина в телеграмме. By Rassol2 ShowCase – Responsive / Multipurpose Opencart Template By octemplates Telnotification By Yevhenii_7777 × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × 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. I accept
helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 1 минуту назад, Blast сказал: {% if attribute.attribute_id == '13' %} Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} Link to comment Share on other sites More sharing options...
PaulKravchenko Posted September 18, 2019 Share Posted September 18, 2019 1 минуту назад, helen2014 сказал: добавляем через запятую? не прокатит, через or Link to comment Share on other sites More sharing options... Blast Posted September 18, 2019 Share Posted September 18, 2019 6 минут назад, helen2014 сказал: Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} {% if attribute.attribute_id in [13, 14, 15] %} Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 8 минут назад, Blast сказал: {% if attribute.attribute_id in [13, 14, 15] %} Все работает! Link to comment Share on other sites More sharing options... 10 months later... nibbl Posted July 21, 2020 Share Posted July 21, 2020 вставил не работает, надо еще что то вставлять в контроллере? Link to comment Share on other sites More sharing options... 4 months later... kuripka2222 Posted December 3, 2020 Share Posted December 3, 2020 В 21.07.2020 в 12:16, nibbl сказал: вставил не работает, надо еще что то вставлять в контроллере? {% for attribute_group in attribute_groups %} {% for attribute in attribute_group.attribute %} {% if attribute.attribute_id in [1, 2, 3, 4] %} <!-- тут id атрибутов --> <td>{{ attribute.name }}</td><!-- тут название атрибута--> <td>{{ attribute.text }}</td><!-- тут текст/описание атрибута --> {% endif %} {% endfor %} {% endfor %} Link to comment Share on other sites More sharing options... 4 months later... vsok2007 Posted April 3, 2021 Share Posted April 3, 2021 (edited) В контролер после $data['products'][] = array( -- 'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']), -- Edited April 3, 2021 by vsok2007 Link to comment Share on other sites More sharing options... 1 month later... alia123 Posted May 9, 2021 Share Posted May 9, 2021 У меня не работает. вот такой код получается? {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id in [17, 73, 34, 35] or attribute.id in [17, 73, 34, 35] %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options... 4 weeks later... Igor112 Posted June 5, 2021 Share Posted June 5, 2021 (edited) Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> Edited June 5, 2021 by Igor112 Link to comment Share on other sites More sharing options... Blast Posted June 5, 2021 Share Posted June 5, 2021 3 часа назад, Igor112 сказал: Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} Link to comment Share on other sites More sharing options... Igor112 Posted June 6, 2021 Share Posted June 6, 2021 В 05.06.2021 в 15:57, Blast сказал: {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. Link to comment Share on other sites More sharing options... Blast Posted June 7, 2021 Share Posted June 7, 2021 15 часов назад, Igor112 сказал: <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. если для получения атрибутов пользовались стандартной функцией, то должно быть так {% for attribute in attributeColumn.attribute %} а если какой-то самопис, то кто ж знает какая у вас структура данных и как отличить категорию Характеристики от других Link to comment Share on other sites More sharing options... 3 weeks later... configurator Posted June 22, 2021 Share Posted June 22, 2021 Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? Link to comment Share on other sites More sharing options... lexxkrt Posted June 24, 2021 Share Posted June 24, 2021 В 22.06.2021 в 17:31, configurator сказал: Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? сформировать нужные данные в зависимости от входных данных в контроллере. в твиге (во вьюхе) вообще логики по минимуму должно быть. пишите сразу правильно Link to comment Share on other sites More sharing options... configurator Posted June 24, 2021 Share Posted June 24, 2021 А можете подробнее написать? Например сюда (category.php): $data['products'][] = array( 'product_id' => $result['product_id'], Добавить: $data['products'][] = array( 'product_id' => $result['product_id'], 'category_id' => $result['product_categoryid'], Так? Link to comment Share on other sites More sharing options... 1 year later... dizastill Posted October 27, 2022 Share Posted October 27, 2022 (edited) Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать Edited October 27, 2022 by dizastill Link to comment Share on other sites More sharing options... Blast Posted October 27, 2022 Share Posted October 27, 2022 27.10.2022 в 13:23, dizastill сказал: Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать {% if attribute_group.attribute_group_id == 'ид_нужной_группы' %} Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 More sharing options... Followers 4 Go to topic listing Similar Content Релиз ocStore 3.0.2.0 1 2 3 4 11 By dinox, February 6, 2019 ocstore 3 ocstore 3.0.2.0 267 replies 101,246 views sergio1987 November 12, 2022 Вывод названия и ссылки главной категории в блоге окстор 3.0.2.0 By AlexMax13, January 4 ocstore блог 1 reply 129 views AlexMax13 January 4 Как сделать правильное структурирование Opencart 3.0.2.0 By Lucider105, Thursday at 12:58 PM 5 replies 147 views Lucider105 Thursday at 04:03 PM Перенос данных Ocfilter с версии OcStore 2.3 на OcStore 3.0.2.0 By WeBuy, November 11, 2022 2 replies 268 views WeBuy November 11, 2022 Интеграция 1С 8.3 Предприятие с ocStore 3.0.2.0 By sergbb, October 6, 2022 3 replies 437 views BTops October 16, 2022 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Вывод определенных атрибутiов ocStore 3.0.2.0 Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Chameleon - Responsive & Multipurpose Opencart Template + Quick Start By 29aleksey Wayforpay API оплата для Opencart 2.3, 3.x By bogdan281989 TgMarket - Модуль интернет магазина в телеграмме. By Rassol2 ShowCase – Responsive / Multipurpose Opencart Template By octemplates Telnotification By Yevhenii_7777 × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums News ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare × 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. I accept
Blast Posted September 18, 2019 Share Posted September 18, 2019 6 минут назад, helen2014 сказал: Так работает! Спаибо! а если атрибутов несколько, добавляем через запятую? {% if attribute.attribute_id == '13,14,15,16' %} {% if attribute.attribute_id in [13, 14, 15] %} Link to comment Share on other sites More sharing options... helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 8 минут назад, Blast сказал: {% if attribute.attribute_id in [13, 14, 15] %} Все работает! Link to comment Share on other sites More sharing options... 10 months later... nibbl Posted July 21, 2020 Share Posted July 21, 2020 вставил не работает, надо еще что то вставлять в контроллере? Link to comment Share on other sites More sharing options... 4 months later... kuripka2222 Posted December 3, 2020 Share Posted December 3, 2020 В 21.07.2020 в 12:16, nibbl сказал: вставил не работает, надо еще что то вставлять в контроллере? {% for attribute_group in attribute_groups %} {% for attribute in attribute_group.attribute %} {% if attribute.attribute_id in [1, 2, 3, 4] %} <!-- тут id атрибутов --> <td>{{ attribute.name }}</td><!-- тут название атрибута--> <td>{{ attribute.text }}</td><!-- тут текст/описание атрибута --> {% endif %} {% endfor %} {% endfor %} Link to comment Share on other sites More sharing options... 4 months later... vsok2007 Posted April 3, 2021 Share Posted April 3, 2021 (edited) В контролер после $data['products'][] = array( -- 'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']), -- Edited April 3, 2021 by vsok2007 Link to comment Share on other sites More sharing options... 1 month later... alia123 Posted May 9, 2021 Share Posted May 9, 2021 У меня не работает. вот такой код получается? {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id in [17, 73, 34, 35] or attribute.id in [17, 73, 34, 35] %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options... 4 weeks later... Igor112 Posted June 5, 2021 Share Posted June 5, 2021 (edited) Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> Edited June 5, 2021 by Igor112 Link to comment Share on other sites More sharing options... Blast Posted June 5, 2021 Share Posted June 5, 2021 3 часа назад, Igor112 сказал: Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} Link to comment Share on other sites More sharing options... Igor112 Posted June 6, 2021 Share Posted June 6, 2021 В 05.06.2021 в 15:57, Blast сказал: {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. Link to comment Share on other sites More sharing options... Blast Posted June 7, 2021 Share Posted June 7, 2021 15 часов назад, Igor112 сказал: <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. если для получения атрибутов пользовались стандартной функцией, то должно быть так {% for attribute in attributeColumn.attribute %} а если какой-то самопис, то кто ж знает какая у вас структура данных и как отличить категорию Характеристики от других Link to comment Share on other sites More sharing options... 3 weeks later... configurator Posted June 22, 2021 Share Posted June 22, 2021 Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? Link to comment Share on other sites More sharing options... lexxkrt Posted June 24, 2021 Share Posted June 24, 2021 В 22.06.2021 в 17:31, configurator сказал: Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? сформировать нужные данные в зависимости от входных данных в контроллере. в твиге (во вьюхе) вообще логики по минимуму должно быть. пишите сразу правильно Link to comment Share on other sites More sharing options... configurator Posted June 24, 2021 Share Posted June 24, 2021 А можете подробнее написать? Например сюда (category.php): $data['products'][] = array( 'product_id' => $result['product_id'], Добавить: $data['products'][] = array( 'product_id' => $result['product_id'], 'category_id' => $result['product_categoryid'], Так? Link to comment Share on other sites More sharing options... 1 year later... dizastill Posted October 27, 2022 Share Posted October 27, 2022 (edited) Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать Edited October 27, 2022 by dizastill Link to comment Share on other sites More sharing options... Blast Posted October 27, 2022 Share Posted October 27, 2022 27.10.2022 в 13:23, dizastill сказал: Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать {% if attribute_group.attribute_group_id == 'ид_нужной_группы' %} Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 More sharing options... Followers 4 Go to topic listing Similar Content Релиз ocStore 3.0.2.0 1 2 3 4 11 By dinox, February 6, 2019 ocstore 3 ocstore 3.0.2.0 267 replies 101,246 views sergio1987 November 12, 2022 Вывод названия и ссылки главной категории в блоге окстор 3.0.2.0 By AlexMax13, January 4 ocstore блог 1 reply 129 views AlexMax13 January 4 Как сделать правильное структурирование Opencart 3.0.2.0 By Lucider105, Thursday at 12:58 PM 5 replies 147 views Lucider105 Thursday at 04:03 PM Перенос данных Ocfilter с версии OcStore 2.3 на OcStore 3.0.2.0 By WeBuy, November 11, 2022 2 replies 268 views WeBuy November 11, 2022 Интеграция 1С 8.3 Предприятие с ocStore 3.0.2.0 By sergbb, October 6, 2022 3 replies 437 views BTops October 16, 2022 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Вывод определенных атрибутiов ocStore 3.0.2.0 Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Chameleon - Responsive & Multipurpose Opencart Template + Quick Start By 29aleksey Wayforpay API оплата для Opencart 2.3, 3.x By bogdan281989 TgMarket - Модуль интернет магазина в телеграмме. By Rassol2 ShowCase – Responsive / Multipurpose Opencart Template By octemplates Telnotification By Yevhenii_7777
helen2014 Posted September 18, 2019 Author Share Posted September 18, 2019 8 минут назад, Blast сказал: {% if attribute.attribute_id in [13, 14, 15] %} Все работает! Link to comment Share on other sites More sharing options...
nibbl Posted July 21, 2020 Share Posted July 21, 2020 вставил не работает, надо еще что то вставлять в контроллере? Link to comment Share on other sites More sharing options...
kuripka2222 Posted December 3, 2020 Share Posted December 3, 2020 В 21.07.2020 в 12:16, nibbl сказал: вставил не работает, надо еще что то вставлять в контроллере? {% for attribute_group in attribute_groups %} {% for attribute in attribute_group.attribute %} {% if attribute.attribute_id in [1, 2, 3, 4] %} <!-- тут id атрибутов --> <td>{{ attribute.name }}</td><!-- тут название атрибута--> <td>{{ attribute.text }}</td><!-- тут текст/описание атрибута --> {% endif %} {% endfor %} {% endfor %} Link to comment Share on other sites More sharing options...
vsok2007 Posted April 3, 2021 Share Posted April 3, 2021 (edited) В контролер после $data['products'][] = array( -- 'attribute_groups' => $this->model_catalog_product->getProductAttributes($result['product_id']), -- Edited April 3, 2021 by vsok2007 Link to comment Share on other sites More sharing options...
alia123 Posted May 9, 2021 Share Posted May 9, 2021 У меня не работает. вот такой код получается? {% if attribute_groups %} <table class="table table-bordered"> {% for attribute_group in attribute_groups %} <thead> <tr> <td colspan="2"><strong>{{ attribute_group.name }}</strong></td> </tr> </thead> <tbody> {% for attribute in attribute_group.attribute %} <tr> {% if attribute.id in [17, 73, 34, 35] or attribute.id in [17, 73, 34, 35] %} <td>{{ attribute.name }}</td> <td>{{ attribute.text }}</td> {% endif %} </tr> {% endfor %} </tbody> {% endfor %} </table> {% endif %} Link to comment Share on other sites More sharing options...
Igor112 Posted June 5, 2021 Share Posted June 5, 2021 (edited) Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> Edited June 5, 2021 by Igor112 Link to comment Share on other sites More sharing options...
Blast Posted June 5, 2021 Share Posted June 5, 2021 3 часа назад, Igor112 сказал: Здравствуйте, уважаемые. Помогите пожалуйста. Нужно вывести атрибуты только из категории "Характеристики" <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endfor %} </div> </div> </div> {% endif %} </div> {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} Link to comment Share on other sites More sharing options... Igor112 Posted June 6, 2021 Share Posted June 6, 2021 В 05.06.2021 в 15:57, Blast сказал: {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. Link to comment Share on other sites More sharing options... Blast Posted June 7, 2021 Share Posted June 7, 2021 15 часов назад, Igor112 сказал: <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. если для получения атрибутов пользовались стандартной функцией, то должно быть так {% for attribute in attributeColumn.attribute %} а если какой-то самопис, то кто ж знает какая у вас структура данных и как отличить категорию Характеристики от других Link to comment Share on other sites More sharing options... 3 weeks later... configurator Posted June 22, 2021 Share Posted June 22, 2021 Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? Link to comment Share on other sites More sharing options... lexxkrt Posted June 24, 2021 Share Posted June 24, 2021 В 22.06.2021 в 17:31, configurator сказал: Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? сформировать нужные данные в зависимости от входных данных в контроллере. в твиге (во вьюхе) вообще логики по минимуму должно быть. пишите сразу правильно Link to comment Share on other sites More sharing options... configurator Posted June 24, 2021 Share Posted June 24, 2021 А можете подробнее написать? Например сюда (category.php): $data['products'][] = array( 'product_id' => $result['product_id'], Добавить: $data['products'][] = array( 'product_id' => $result['product_id'], 'category_id' => $result['product_categoryid'], Так? Link to comment Share on other sites More sharing options... 1 year later... dizastill Posted October 27, 2022 Share Posted October 27, 2022 (edited) Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать Edited October 27, 2022 by dizastill Link to comment Share on other sites More sharing options... Blast Posted October 27, 2022 Share Posted October 27, 2022 27.10.2022 в 13:23, dizastill сказал: Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать {% if attribute_group.attribute_group_id == 'ид_нужной_группы' %} Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 More sharing options... Followers 4 Go to topic listing Similar Content Релиз ocStore 3.0.2.0 1 2 3 4 11 By dinox, February 6, 2019 ocstore 3 ocstore 3.0.2.0 267 replies 101,246 views sergio1987 November 12, 2022 Вывод названия и ссылки главной категории в блоге окстор 3.0.2.0 By AlexMax13, January 4 ocstore блог 1 reply 129 views AlexMax13 January 4 Как сделать правильное структурирование Opencart 3.0.2.0 By Lucider105, Thursday at 12:58 PM 5 replies 147 views Lucider105 Thursday at 04:03 PM Перенос данных Ocfilter с версии OcStore 2.3 на OcStore 3.0.2.0 By WeBuy, November 11, 2022 2 replies 268 views WeBuy November 11, 2022 Интеграция 1С 8.3 Предприятие с ocStore 3.0.2.0 By sergbb, October 6, 2022 3 replies 437 views BTops October 16, 2022 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: General questions Вывод определенных атрибутiов ocStore 3.0.2.0
Igor112 Posted June 6, 2021 Share Posted June 6, 2021 В 05.06.2021 в 15:57, Blast сказал: {% if attributeColumn.attribute_group_id == 'ид_категории_Характеристики' %} <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. Link to comment Share on other sites More sharing options...
Blast Posted June 7, 2021 Share Posted June 7, 2021 15 часов назад, Igor112 сказал: <div class="products__tabs-container"> {% if (product['attribute_groups']) %} <div class="products__tabs-content js-tabs-content is-active"> <div class="products__info"> <div class="row"> {% for attributeColumn in product['attribute_groups'] %} {% if attributeColumn.attribute_group_id == '8' %} <div class="col-6 col-md-6"> <dl class="products__info-dl"> {% for attribute in attributeColumn %} <dt>{{ attribute['name'] }}</dt> <dd>{{ attribute['text'] }}</dd> {% endfor %} </dl> </div> {% endif %} {% endfor %} </div> </div> </div> {% endif %} </div> Добавил данный код, теперь не выводит атрибуты совсем. если для получения атрибутов пользовались стандартной функцией, то должно быть так {% for attribute in attributeColumn.attribute %} а если какой-то самопис, то кто ж знает какая у вас структура данных и как отличить категорию Характеристики от других Link to comment Share on other sites More sharing options... 3 weeks later... configurator Posted June 22, 2021 Share Posted June 22, 2021 Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? Link to comment Share on other sites More sharing options... lexxkrt Posted June 24, 2021 Share Posted June 24, 2021 В 22.06.2021 в 17:31, configurator сказал: Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? сформировать нужные данные в зависимости от входных данных в контроллере. в твиге (во вьюхе) вообще логики по минимуму должно быть. пишите сразу правильно Link to comment Share on other sites More sharing options... configurator Posted June 24, 2021 Share Posted June 24, 2021 А можете подробнее написать? Например сюда (category.php): $data['products'][] = array( 'product_id' => $result['product_id'], Добавить: $data['products'][] = array( 'product_id' => $result['product_id'], 'category_id' => $result['product_categoryid'], Так? Link to comment Share on other sites More sharing options... 1 year later... dizastill Posted October 27, 2022 Share Posted October 27, 2022 (edited) Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать Edited October 27, 2022 by dizastill Link to comment Share on other sites More sharing options... Blast Posted October 27, 2022 Share Posted October 27, 2022 27.10.2022 в 13:23, dizastill сказал: Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать {% if attribute_group.attribute_group_id == 'ид_нужной_группы' %} Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 More sharing options... Followers 4 Go to topic listing Similar Content Релиз ocStore 3.0.2.0 1 2 3 4 11 By dinox, February 6, 2019 ocstore 3 ocstore 3.0.2.0 267 replies 101,246 views sergio1987 November 12, 2022 Вывод названия и ссылки главной категории в блоге окстор 3.0.2.0 By AlexMax13, January 4 ocstore блог 1 reply 129 views AlexMax13 January 4 Как сделать правильное структурирование Opencart 3.0.2.0 By Lucider105, Thursday at 12:58 PM 5 replies 147 views Lucider105 Thursday at 04:03 PM Перенос данных Ocfilter с версии OcStore 2.3 на OcStore 3.0.2.0 By WeBuy, November 11, 2022 2 replies 268 views WeBuy November 11, 2022 Интеграция 1С 8.3 Предприятие с ocStore 3.0.2.0 By sergbb, October 6, 2022 3 replies 437 views BTops October 16, 2022 Recently Browsing 0 members No registered users viewing this page.
configurator Posted June 22, 2021 Share Posted June 22, 2021 Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? Link to comment Share on other sites More sharing options...
lexxkrt Posted June 24, 2021 Share Posted June 24, 2021 В 22.06.2021 в 17:31, configurator сказал: Подскажите, а если нужно вывести выбранные атрибуты только в определенной категории, какую функцию прописать? Что-то вроде этого: {% if category.category_id == '66' %} ? сформировать нужные данные в зависимости от входных данных в контроллере. в твиге (во вьюхе) вообще логики по минимуму должно быть. пишите сразу правильно Link to comment Share on other sites More sharing options...
configurator Posted June 24, 2021 Share Posted June 24, 2021 А можете подробнее написать? Например сюда (category.php): $data['products'][] = array( 'product_id' => $result['product_id'], Добавить: $data['products'][] = array( 'product_id' => $result['product_id'], 'category_id' => $result['product_categoryid'], Так? Link to comment Share on other sites More sharing options...
dizastill Posted October 27, 2022 Share Posted October 27, 2022 (edited) Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать Edited October 27, 2022 by dizastill Link to comment Share on other sites More sharing options...
Blast Posted October 27, 2022 Share Posted October 27, 2022 27.10.2022 в 13:23, dizastill сказал: Здравствуйте. Не могу никак вывести атрибуты определенной группы в карточке. {% for attribute_group in attribute_groups %} <h4 class="heading"><span>{{ attribute_group.name }}</span></h4> <div class="product-data"> {% for attribute in attribute_group.attribute %} <div class="product-data__item"> <div class="product-data__item-div">{{ attribute.name }}</div> <div class="product-data__item-div">{{ attribute.text }}</div> </div> {% endfor %} </div> {% endfor %} Надо как-то по id группы сделать {% if attribute_group.attribute_group_id == 'ид_нужной_группы' %} Link to comment Share on other sites More sharing options... Prev 1 2 Next Page 1 of 2 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 More sharing options... Followers 4
Recommended Posts