dkoz Posted December 23, 2012 Author Report Share Posted December 23, 2012 не в админке, а в шаблоне надо! Quote Link to post Share on other sites
Prote1n Posted December 23, 2012 Report Share Posted December 23, 2012 Я через админку >> дизайн >> products.tpl Quote Link to post Share on other sites
maksam07 Posted December 23, 2012 Report Share Posted December 23, 2012 первое сделал. так это сюда надо?? /simpla/design/html/products.tplи куда именно? {foreach $product->features as $f} {$f->name} - {$f->value}{/foreach}блин, не путайте. Quote Link to post Share on other sites
Prote1n Posted December 23, 2012 Report Share Posted December 23, 2012 нет, нужно "view/ProductsView.phpДобавитьforeach($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;} Quote Link to post Share on other sites
Prote1n Posted December 23, 2012 Report Share Posted December 23, 2012 Я сюда кинул <!-- Описание товара --> {$n=0} {foreach $product->features as $f} {$n=$n+1} {if $n<5} <label>{$f->name}</label> - {$f->value} {/if} {/foreach} Quote Link to post Share on other sites
maksam07 Posted December 23, 2012 Report Share Posted December 23, 2012 /view/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; }/design/default/html/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 не так, ты правишь /design/default/html/products.tpl, а нужно default_1, или как у тебя называется дубликат шаблона 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
Prote1n Posted December 23, 2012 Report Share Posted December 23, 2012 )))) Quote Link to post Share on other sites
delprofile Posted December 23, 2012 Report Share Posted December 23, 2012 Вы когда-нибудь научитесь код в BB-теги вставлять? 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
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 Выделите текст и нажмите иконку С 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 26, 2012 Report Share Posted December 26, 2012 как это сделать на главной странице? код не работает :-( Quote Link to post Share on other sites
dkoz Posted December 27, 2012 Author Report Share Posted December 27, 2012 в View.php нужно заменитьforeach($products as &$product) { if(isset($product->variants[0])) $product->variant = $product->variants[0]; if(isset($product->images[0])) $product->image = $product->images[0]; }наforeach($products as &$product){if(isset($product->variants[0]))$product->variant = $product->variants[0];if(isset($product->images[0]))$product->image = $product->images[0];$product->features = array();}$features = $this->features->get_product_options($products_ids);foreach($features as &$feature){$products[$feature->product_id]->features[] = $feature;} Quote Link to post Share on other sites
maksam07 Posted December 28, 2012 Report Share Posted December 28, 2012 а какой html код вывода? я написал {foreach $product->features as $f} {$f->name} - {$f->value}{/foreach} но не работает Quote Link to post Share on other sites
dkoz Posted December 28, 2012 Author Report Share Posted December 28, 2012 Для main.tpl все правильно.Там в View.php отдельно для Новых поступлений, Рекомендуемых и Товаров со скидкой надо править. Функции get_featured_products_plugin, get_new_products_plugin, get_discounted_products_plugin. Quote Link to post Share on other sites
maksam07 Posted December 28, 2012 Report Share Posted December 28, 2012 можешь дать готовый код? хотя б одного из этого. Quote Link to post Share on other sites
dkoz Posted December 28, 2012 Author Report Share Posted December 28, 2012 public function get_featured_products_plugin($params, &$smarty) { if(!isset($params['visible'])) $params['visible'] = 1; $params['featured'] = 1; if(!empty($params['var'])) { foreach($this->products->get_products($params) as $p) $products[$p->id] = $p; if(!empty($products)) { // id выбраных товаров $products_ids = array_keys($products); // Выбираем варианты товаров $variants = $this->variants->get_variants(array('product_id'=>$products_ids, 'in_stock'=>true)); // Для каждого варианта foreach($variants as &$variant) { // добавляем вариант в соответствующий товар $products[$variant->product_id]->variants[] = $variant; } // Выбираем изображения товаров $images = $this->products->get_images(array('product_id'=>$products_ids)); foreach($images as $image) $products[$image->product_id]->images[] = $image; foreach($products as &$product) { if(isset($product->variants[0])) $product->variant = $product->variants[0]; if(isset($product->images[0])) $product->image = $product->images[0]; $product->features = array(); } $features = $this->features->get_product_options($products_ids); foreach($features as &$feature) { $products[$feature->product_id]->features[] = $feature; } } $smarty->assign($params['var'], $products); } } Quote Link to post Share on other sites
maksam07 Posted December 28, 2012 Report Share Posted December 28, 2012 аааа, я протупил. просто б сказал что заменить предыдущий код 3 раза. Спс, работает. Quote Link to post Share on other sites
ishibaev Posted April 13, 2013 Report Share Posted April 13, 2013 А как при таком решении с нагрузкой? Quote Link to post Share on other sites
allon925 Posted May 16, 2013 Report Share Posted May 16, 2013 Примерно такforeach($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;}productsview.php отредактировал. Изменения с 41-54 строчку. В products.tpl вставил код: {foreach $product->features as $f} {$f->name} - {$f->value} {/foreach} Сайт: http://magest.bget.ru/ хочу чтобы при наведении на картинку появлялась всплывашка как раз с этими характеристиками. Что я делаю неправильно. Заранее благодарен за любую помощь.ProductsView.php Quote Link to post Share on other sites
iliaprohor Posted May 11, 2015 Report Share Posted May 11, 2015 Если первые 4, то можно что-то вроде этого: {$n=0} {foreach} {$n=$n+1} {if $n<5} Выводим свойство {/if} {/foreach}Мне нужно вывести первые 3 свойства, куда вставить этот код? 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.