dkoz Posted November 2, 2012 Report Share Posted November 2, 2012 Хочу реализовать чтобы сайт сам генерировал краткое описание типа: Cмарфон / Моноблок / 3,7"(480x854) , выбирая нужные значения свойств.Проблема, не получается вывести свойства товара, когда находишься в категории.Может кто-то сталкивался с подобной проблемой? Quote Link to post Share on other sites
kind Posted November 2, 2012 Report Share Posted November 2, 2012 сталкивался, выводил, но это надо копаться в коде и искать, как я это делал. Quote Link to post Share on other sites
dkoz Posted November 7, 2012 Author Report Share Posted November 7, 2012 Разобрался. Вопрос закрыт. Quote Link to post Share on other sites
igoryk Posted November 15, 2012 Report Share Posted November 15, 2012 /dkoz / - разобрался, поделись с народом плиз... Quote Link to post Share on other sites
dkoz Posted November 16, 2012 Author Report Share Posted November 16, 2012 в файле ProductsView.php меняем foreach($products as &$product) { $product->variants = array(); $product->images = array(); $product->properties = array(); }на foreach($products as &$product) { $product->variants = array(); $product->images = array(); $product->properties = array(); $product->features = $this->features->get_product_options(array('product_id'=>$product->id)); }Вывод в шаблоне аналогичен product.tpl Quote Link to post Share on other sites
dkoz Posted November 16, 2012 Author Report Share Posted November 16, 2012 2kors подскажи, как надо Quote Link to post Share on other sites
dkoz Posted November 18, 2012 Author Report Share Posted November 18, 2012 благодарю Quote Link to post Share on other sites
Prote1n Posted December 22, 2012 Report Share Posted December 22, 2012 Отлично, работает. Есть вопрос, у меня свойсвт много, можно ли сделать ограничение по количеству, например первые 4 свойства, они важные, остальные нет. Quote Link to post Share on other sites
dkoz Posted December 22, 2012 Author Report Share Posted December 22, 2012 Если первые 4, то можно что-то вроде этого:{$n=0}{foreach} {$n=$n+1} {if $n<5} Выводим свойство {/if}{/foreach} Quote Link to post Share on other sites
dkoz Posted December 22, 2012 Author Report Share Posted December 22, 2012 или через iteration Quote Link to post Share on other sites
Prote1n Posted December 22, 2012 Report Share Posted December 22, 2012 Работает Quote Link to post Share on other sites
Prote1n Posted December 22, 2012 Report Share Posted December 22, 2012 Сделал, спасибо Quote Link to post Share on other sites
Prote1n Posted December 23, 2012 Report Share Posted December 23, 2012 Есть ли возможность сделать отображение свойств товара в списке товаров, а именно те свойства которые есть в фильтре товаров? Quote Link to post Share on other sites
mart Posted December 23, 2012 Report Share Posted December 23, 2012 {if $feature->in_filter}<li><label>{$feature->name|escape}</label><span>{$feature->value|escape}</span></li>{/if}Только в api/Features.php в методе get_product_options надо в выборке добавить после f.name, f.in_filter Quote Link to post Share on other sites
Prote1n Posted December 23, 2012 Report Share Posted December 23, 2012 У меня свойства отбражаются в кратком описании, код такой:{foreach $product->features as $f} <label>{$f->name}</label> - <span class="val">{$f->value} {/foreach}Поменял на ваш, не отображается ничего, если можете опишите подробнее. Quote Link to post Share on other sites
dkoz Posted December 23, 2012 Author Report Share Posted December 23, 2012 в итоге должен получится следующий код:{foreach $product->features as $f}{if $f->in_filter}{$f->name} - {$f->value}{/if}{/foreach} Quote Link to post Share on other sites
Prote1n Posted December 23, 2012 Report Share Posted December 23, 2012 Ого, СПАСИБО, работает, СУПЕР. Quote Link to post Share on other sites
maksam07 Posted December 23, 2012 Report Share Posted December 23, 2012 не понимаю.. нечего не работает.. 2.1.0 simplaу меня в productview.php нету$product->variants = array(); и т.д.я заменил в productsview.php но нечего не поменялось Quote Link to post Share on other sites
dkoz Posted December 23, 2012 Author Report Share Posted December 23, 2012 а product.tpl редактировали? ...сделан вывод этих самых свойств? Quote Link to post Share on other sites
maksam07 Posted December 23, 2012 Report Share Posted December 23, 2012 расскажите подробно что и где изменять. может я чтото не понял... :-( Quote Link to post Share on other sites
dkoz Posted December 23, 2012 Author Report Share Posted December 23, 2012 опечатка. нужно products.tpl редактировать.делайте как по инструкции выше, а в products.tpl где-то перед или после описания (или где нужно){foreach $product->features as $f}{$f->name}: {$f->value} / {/foreach} Quote Link to post Share on other sites
maksam07 Posted December 23, 2012 Report Share Posted December 23, 2012 когда этот код добавляю в products.tpl пишет, страница не найдена. Quote Link to post Share on other sites
Prote1n Posted December 23, 2012 Report Share Posted December 23, 2012 В файле ProductsView.phpforeach($products as &$product){$product->variants = array();$product->images = array();$product->properties = array();$product->features = array();}$features = $this->features->get_product_options($products_ids);foreach($features as &$feature){$products[$feature->product_id]->features[] = $feature;}В админке products.tpl{foreach $product->features as $f} {$f->name} - {$f->value}{/foreach} Quote Link to post Share on other sites
dkoz Posted December 23, 2012 Author Report Share Posted December 23, 2012 наверно не туда код вставлен. нужно именно в цикл товаров. и ProductsView.php обязательно подправить. Quote Link to post Share on other sites
Prote1n Posted December 23, 2012 Report Share Posted December 23, 2012 я правил ProductsView.php, а не ProductView.php 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.