seregadaa Posted September 22, 2012 Report Share Posted September 22, 2012 Кто-нибудь может подсказать, как определить категорию товара в корзине? Необходимо для выведения доп. информации при условии, что товар определенной категории в корзине. Quote Link to post Share on other sites
Novecheg Posted September 22, 2012 Report Share Posted September 22, 2012 По идее $product->category Quote Link to post Share on other sites
seregadaa Posted September 22, 2012 Author Report Share Posted September 22, 2012 Не отображает так. Видимо, не передается в шаблон. Что-то надо дополнить в CartView.php Quote Link to post Share on other sites
Novecheg Posted September 22, 2012 Report Share Posted September 22, 2012 $product->category->nameнет?$product->categories[0]->nameне?а так:{foreach $product->categories as $c} {$c->name}{/foreach} Quote Link to post Share on other sites
Novecheg Posted September 22, 2012 Report Share Posted September 22, 2012 У меня аналогичный вопрос: как указать категорию товара в products.tpl?Бегло посмотрел ранние версии симплы, там, как оказалось, к названию товара можно было добавить его категорию. Да ещё и в единственном числе.Этого мне как раз не хватает. Если понадобится, в категориях я новое поле смогу сделать. А вот как вывести имя категории в списке товаров (products.tpl)? Quote Link to post Share on other sites
Novecheg Posted September 22, 2012 Report Share Posted September 22, 2012 <div></div> Quote Link to post Share on other sites
seregadaa Posted September 22, 2012 Author Report Share Posted September 22, 2012 Я сделал так. Где-то тут было. В ProductsView.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]; }добавил $categories = $this->categories->get_product_categories(array_keys($products)); foreach($categories as $category1) { $cat = $this->categories->get_category((int)$category1->category_id); $products[$category1->product_id]->categories[] = $cat; } foreach($products as &$product) { if(isset($product->variants[0])) $product->variant = $product->variants[0]; if(isset($product->images[0])) $product->image = $product->images[0]; if(isset($product->categories[0])) $product->category1 = $product->categories[0]; }По {$product->category1->name} можно получит категорию товара. Quote Link to post Share on other sites
Novecheg Posted September 22, 2012 Report Share Posted September 22, 2012 Да, это почти то, что мне нужно Quote Link to post Share on other sites
Novecheg Posted September 22, 2012 Report Share Posted September 22, 2012 Есть только одно но:мне нужно вывести не имя категории, а категорию в единственном числе. Вот это как сделать? Quote Link to post Share on other sites
seregadaa Posted September 22, 2012 Author Report Share Posted September 22, 2012 А подскажет нам кто-нибудь, как с корзиной быть? Quote Link to post Share on other sites
Novecheg Posted September 22, 2012 Report Share Posted September 22, 2012 А с категорией в единственном числе? Quote Link to post Share on other sites
seregadaa Posted September 24, 2012 Author Report Share Posted September 24, 2012 Есть способ простого опледеления категории товара в корзине? Или все-таки это непростая платная доработка? 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.