jorgebiblio Posted October 14, 2013 Share Posted October 14, 2013 Hi I'm pretty new in Prestashop (developing since June) and for a shop in Prestashop (1.5.6) I have some categories: Category 1 Subcat 1.1 Subcat 1.2 ... Category 2 Subcat 2.1 Subcat 2.2 Etc. Is it posible, with a free or payed module, to display only the new products of a certain category (for example, in the page of a category, show the new products in it)? With the standard option all of them come together but I'd like to get them filtered by category. I've been searching this and other fórums with no clues and it's strange because it's not a weird thing from my point of view. I installed and configured the Layered Navigation Block but it cannot filter by new products. Thanks a lot in advance. Link to comment Share on other sites More sharing options...
kimmy018 Posted November 5, 2013 Share Posted November 5, 2013 I'm having the same problem. Please help us. Thanks! Link to comment Share on other sites More sharing options...
weblitzer Posted July 21, 2014 Share Posted July 21, 2014 I'm having the same problem. version 1.6 Thanks. Link to comment Share on other sites More sharing options...
vekia Posted July 21, 2014 Share Posted July 21, 2014 why not to sort products by "add date" ? then newest products will be first on each category page Link to comment Share on other sites More sharing options...
weblitzer Posted July 21, 2014 Share Posted July 21, 2014 good idea. thanks. You can add AND product_shop.`id_category_default` = '.$id_category.' in getNewProducts function or create a new function like getNewProductsByCategory with a base of getNewProducts where: if (Group::isFeatureActive()) $sql->where('p.`id_product` IN ( SELECT cp.`id_product` FROM `'._DB_PREFIX_.'category_group` cg LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`) WHERE cg.`id_group` '.$sql_groups.' AND product_shop.`id_category_default` = '.$id_category.' )'); Thanks 1 Link to comment Share on other sites More sharing options...
weblitzer Posted July 21, 2014 Share Posted July 21, 2014 i've you idea about Display features products only of one category ???? Link to comment Share on other sites More sharing options...
zeki893 Posted April 16, 2015 Share Posted April 16, 2015 there is a cleaner way to do this without using sql public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, Context $context = null) $category = new Category((int)$id, (int)$id_lang); if (Validate::isLoadedObject($category)) { $categories[$item]['id'] = $item; $categories[$item]['name'] = $category -> name; $categories[$item]['products'] = $category -> getProducts($id_lang, 1, ($nb ? $nb : 10), 'date_add','DESC'); if(method_exists('Product','getProductsImgs')) { $image_array=array(); for($i=0;$i<count($categories[$item]['products']);$i++) { if(isset($categories[$item]['products'][$i]['id_product'])) $image_array[$categories[$item]['products'][$i]['id_product']]= Product::getProductsImgs($categories[$item]['products'][$i]['id_product']); } $categories[$item]['productimg'] = (isset($image_array) AND $image_array) ? $image_array : NULL; } } Link to comment Share on other sites More sharing options...
fsvmanu123 Posted March 14, 2016 Share Posted March 14, 2016 (edited) there is a cleaner way to do this without using sql public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, Context $context = null) $category = new Category((int)$id, (int)$id_lang); if (Validate::isLoadedObject($category)) { $categories[$item]['id'] = $item; $categories[$item]['name'] = $category -> name; $categories[$item]['products'] = $category -> getProducts($id_lang, 1, ($nb ? $nb : 10), 'date_add','DESC'); if(method_exists('Product','getProductsImgs')) { $image_array=array(); for($i=0;$i<count($categories[$item]['products']);$i++) { if(isset($categories[$item]['products'][$i]['id_product'])) $image_array[$categories[$item]['products'][$i]['id_product']]= Product::getProductsImgs($categories[$item]['products'][$i]['id_product']); } $categories[$item]['productimg'] = (isset($image_array) AND $image_array) ? $image_array : NULL; } } Could you please let me know how to access this ? I mean, the function should be placed inside /classes/Category.php as far as I can see, but what will be the link to send the inquired category? http://mysite.com/26-socks/?selected_filters=new-products - something like that ? Thanks. Edited March 14, 2016 by fsvmanu123 (see edit history) Link to comment Share on other sites More sharing options...
ps3z Posted August 20, 2016 Share Posted August 20, 2016 (edited) hi Profs.. i have market website ,have many kind of products ,forexample selling game and home appliances too...but home appliances are showing on game category also its being weird like this is there possible to show the new products belong to same category? Best Regards Ps3z Edited August 20, 2016 by ps3z (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts