SmartyDev Posted September 26, 2015 Report Share Posted September 26, 2015 Здравствуйте. Пытаюсь вывести в шаблоне main.tpl (последние товары например) свойства товара {api module=features method=get_features var=features} {foreach $features as $ff}<div>{$ff->name} {$ff->value}</div>{/foreach} Выводу таким методом, только почему-то выводится название свойств а значение пустое. Как решить проблему? Также хотел-бы узнать как таким методом вывести определенные свойства по ихнему ID Quote Link to post Share on other sites
Jedi Posted September 26, 2015 Report Share Posted September 26, 2015 Значения свойств выводятся только в привязке к определенному товару. У тебя не указан ID товара. Quote Link to post Share on other sites
SmartyDev Posted September 26, 2015 Author Report Share Posted September 26, 2015 Jedi, спасибо за ответ. Можете более детально, как привязать ID товара к данному варианту реализации? Quote Link to post Share on other sites
Jedi Posted September 26, 2015 Report Share Posted September 26, 2015 Попробуй так {api module=features method=get_features product_id=$product->id var=features} Quote Link to post Share on other sites
SmartyDev Posted September 26, 2015 Author Report Share Posted September 26, 2015 Не выходит, снова пустое значение Quote Link to post Share on other sites
Jedi Posted September 26, 2015 Report Share Posted September 26, 2015 Ааа я понял. Метод надо другой использовать: get_options {api module=features method=get_options product_id=$product->id var=features} Quote Link to post Share on other sites
SmartyDev Posted September 26, 2015 Author Report Share Posted September 26, 2015 Теперь выводит только значение Quote Link to post Share on other sites
Jedi Posted September 26, 2015 Report Share Posted September 26, 2015 Короче, добавь новую функцию в view/View.php В самом конце посмотри там, если ты прогер, то всё поймёшь )) нужно доабвить функцию и зарегистрировать плагин.Составь там свою функцию, и потом вызови её через шаблон таким синтаксисом: {<название функции без слова _plugin> var=features product_id=$product->id} Quote Link to post Share on other sites
Jedi Posted September 26, 2015 Report Share Posted September 26, 2015 Получилось? Quote Link to post Share on other sites
SmartyDev Posted September 26, 2015 Author Report Share Posted September 26, 2015 Да, спасибо. Вывел таким методом: {if $product->options} {foreach $product->options as $f} {if $f->feature_id==149}<div><b>Материал:</b> {$f->value}</div>{/if} {/foreach} {/if} Мне ведь определенные свойства нужно было вывести. Quote Link to post Share on other sites
nikisha Posted November 16, 2017 Report Share Posted November 16, 2017 хмм , теперь страницу в ошибку кидает может проблема из-за версии? 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.