jackalll Posted November 29, 2013 Report Share Posted November 29, 2013 Как вывести категорию каждого товара при просмотре страницы "Бренд" (какая-нибудь фирма)? По умолчанию там выводятся товары из разных категорий. Quote Link to post Share on other sites
Виталий Анатольевич Posted November 29, 2013 Report Share Posted November 29, 2013 а если товар сразу в нескольких категориях? Quote Link to post Share on other sites
jackalll Posted November 29, 2013 Author Report Share Posted November 29, 2013 у меня в одной Quote Link to post Share on other sites
Виталий Анатольевич Posted November 29, 2013 Report Share Posted November 29, 2013 $product->categories = $this->categories->get_categories(array('product_id'=>$product->id)); $product->category = reset($product->categories)); в цикле одного из перебора товаров (скажем для картинок) Вам поможет Quote Link to post Share on other sites
Виталий Анатольевич Posted November 30, 2013 Report Share Posted November 30, 2013 решение лучше добавляем $categories = $this->categories->get_product_categories($products_ids); foreach($categories as $cat) $products[$cat->product_id]->category = $this->categories->get_category((int)$cat->category_id); после if(!empty($products)) { $products_ids = array_keys($products); в ProductsView.php Для вывода используем {$product->category->name|escape} Наслаждайтесь товарищи симплавцы Quote Link to post Share on other sites
kionlife Posted January 14, 2016 Report Share Posted January 14, 2016 как сделать подобное, только на главной? Quote Link to post Share on other sites
mishanya Posted January 14, 2016 Report Share Posted January 14, 2016 как сделать подобное, только на главной? смотрите файл view/View.php и ф-и get_new_products_plugin, get_featured_products_plugin, get_discounted_products_plugin Quote Link to post Share on other sites
kionlife Posted January 14, 2016 Report Share Posted January 14, 2016 Сделал. Quote Link to post Share on other sites
Kosjak76 Posted April 6, 2016 Report Share Posted April 6, 2016 Подобных ссылок я не допущу Ищите другие примеры. Quote Link to post Share on other sites
crab Posted April 6, 2016 Report Share Posted April 6, 2016 Подскажите как реализовать на странице бренда вывод товара блоками по несколько товаров из категорий, в которых этот бренд встречается с подписью перед блоком что это за категория. Видел такую реализацию на сайтах, ссылки на которые недопустимы Форум облазил, ничего не нашел подобного, платных решений тоже не встречал. Quote Link to post Share on other sites
Kosjak76 Posted April 6, 2016 Report Share Posted April 6, 2016 Я вам подскажу: либо размещайте заказ в теме поиска платных доработок, если готовы оплачивать.Либо ищите другие сайты, тем более вы писали - "это много где есть" Quote Link to post Share on other sites
crab Posted April 6, 2016 Report Share Posted April 6, 2016 Ещё менее всё понятно стало ) Quote Link to post Share on other sites
Kosjak76 Posted April 6, 2016 Report Share Posted April 6, 2016 Что вам не понятно?Вы можете предоставить ссылку на сайт, который не касается политики?Если нет - пишите заявку на доработку в текстовом формате. Quote Link to post Share on other sites
crab Posted April 6, 2016 Report Share Posted April 6, 2016 Сайт сувенирной атрибутики, на который я ссылку давал, причем тут политика не могу понять Quote Link to post Share on other sites
Kosjak76 Posted April 6, 2016 Report Share Posted April 6, 2016 Да ладно А можно ссылку на сувенирную атрибутику Правого Сектора, Республики Ичкерия, ИГИЛ ???Не вопрос, можно на том же сайте Quote Link to post Share on other sites
crab Posted April 6, 2016 Report Share Posted April 6, 2016 Надеюсь эта ссылка ещё не запрещена http://voenpro.ru/atributika/atributika-sssr-9-maya Quote Link to post Share on other sites
Gandalf Posted April 6, 2016 Report Share Posted April 6, 2016 Зачем это говно здесь постить Quote Link to post Share on other sites
crab Posted April 6, 2016 Report Share Posted April 6, 2016 Вроде всё понятно написал, со средним IQ понять можно Quote Link to post Share on other sites
nikolayzhdanov Posted July 14, 2017 Report Share Posted July 14, 2017 Ребята помогите разобраться с выводом категорий. Всё сделал по аналогии, всё работает. Только если у товара несколько категорий, то выводит последнюю. А родной функционал вывода хлебных крошек на странице товара выводит первую. Как привести их к одному виду? Quote Link to post Share on other sites
ЯкЦинДрак Posted July 14, 2017 Report Share Posted July 14, 2017 Пробуйте $categories = $this->categories->get_product_categories($products_ids); foreach($categories as $cat) if(!isset($products[$cat->product_id]->category)) $products[$cat->product_id]->category = $this->categories->get_category((int)$cat->category_id); Quote Link to post Share on other sites
nikolayzhdanov Posted July 14, 2017 Report Share Posted July 14, 2017 Пробуйте $categories = $this->categories->get_product_categories($products_ids); foreach($categories as $cat) if(!isset($products[$cat->product_id]->category)) $products[$cat->product_id]->category = $this->categories->get_category((int)$cat->category_id); Отлично! Спасибо! Quote Link to post Share on other sites
nikolayzhdanov Posted July 14, 2017 Report Share Posted July 14, 2017 Пробуйте $categories = $this->categories->get_product_categories($products_ids); foreach($categories as $cat) if(!isset($products[$cat->product_id]->category)) $products[$cat->product_id]->category = $this->categories->get_category((int)$cat->category_id); А можете объяснить как это работает? Не могу понять суть условия. Quote Link to post Share on other sites
nikolayzhdanov Posted July 14, 2017 Report Share Posted July 14, 2017 Пробуйте $categories = $this->categories->get_product_categories($products_ids); foreach($categories as $cat) if(!isset($products[$cat->product_id]->category)) $products[$cat->product_id]->category = $this->categories->get_category((int)$cat->category_id); Блин, в цикле перезаписывалась категория, да? Условие останавливает его, если уже есть значение. Верно понял? Quote Link to post Share on other sites
Noxter Posted July 14, 2017 Report Share Posted July 14, 2017 Пропустил break Quote Link to post Share on other sites
ЯкЦинДрак Posted July 14, 2017 Report Share Posted July 14, 2017 Блин, в цикле перезаписывалась категория, да? Условие останавливает его, если уже есть значение. Верно понял? Верно. Пропустил break Ужас как любопытно узнать подробности - кто пропустил, где пропустил, как надо правильно делать с break... 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.