Alex000 Posted February 16 Report Share Posted February 16 (edited) Всем привет, код приведённый ниже выводит товары на странице товара принадлежащие этому же бренду, а как вывести товары принадлежащие этой же категории? {get_products var=cat_brand_products brand_id=$product->brand_id category_id=$category->id sort='rand' in_stock=1 limit=10} {if $cat_brand_products} <h2>Похожие товары по бренду</h2> <div class="itemslist1 row owl-carousel12 owl-theme"> {foreach $cat_brand_products as $product} <div class="item_col items myitems"> {include file="_myproduct.tpl"} </div> {/foreach} </div> {/if} Edited February 16 by Alex000 Quote Link to post Share on other sites
Alex000 Posted February 16 Author Report Share Posted February 16 Не получилось отформатировать код, извините, думаю спецы поймут что и как. Заранее благодарю. Quote Link to post Share on other sites
alexivchenko Posted February 17 Report Share Posted February 17 (edited) 5 часов назад, Alex000 сказал: Всем привет, код приведённый ниже выводит товары на странице товара принадлежащие этому же бренду, а как вывести товары принадлежащие этой же категории? {get_products var=cat_brand_products brand_id=$product->brand_id category_id=$category->id sort='rand' in_stock=1 limit=10} {if $cat_brand_products} <h2>Похожие товары по бренду</h2> <div class="itemslist1 row owl-carousel12 owl-theme"> {foreach $cat_brand_products as $product} <div class="item_col items myitems"> {include file="_myproduct.tpl"} </div> {/foreach} </div> {/if} Ваш код не полный, видимо прописан еще «универсальный виджет». Нужны еще файлы view/View.php и api/Products.php Edited February 17 by alexivchenko Quote Link to post Share on other sites
phukortsin Posted February 17 Report Share Posted February 17 Приведенный код выводит товары, принадлежащие этому же бренду И этой же категории, о чем говорят параметры вызова плагина {get_products ... brand_id=... category_id=...} А чтобы вывести товары принадлежащие этой же категории, надо всего лишь убрать параметр brand_id. Quote Link to post Share on other sites
Alex000 Posted February 17 Author Report Share Posted February 17 Спасибо большое всем. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.