colorrush Posted December 28, 2012 Share Posted December 28, 2012 Hi! I have messed a bit with the featured products function, but I can't figure out how to change the sort order. Can anyone tell me how I do that? Thanks in advance Link to comment Share on other sites More sharing options...
vekia Posted December 28, 2012 Share Posted December 28, 2012 In this case (this module hasn't got advanced configuration) you can only edit php files of module. Which type of order you want to implement? Link to comment Share on other sites More sharing options...
colorrush Posted December 28, 2012 Author Share Posted December 28, 2012 In this case (this module hasn't got advanced configuration) you can only edit php files of module. Which type of order you want to implement? Ok, I just thought missed it somehow (although I spent a lot of time looking for the function), because I assumed that such a simple function was there I want them in a "customised" order of my own choosing (based on which products I want to sell more of and thus give it more attention on the page). I will try to edit the php code, but I also found out that the products appear in the order in which they were added to the featured (home) category, so a solution is also to remove the products so the featured is empty and then add the products in the order you want them (the last one is added first). Link to comment Share on other sites More sharing options...
parsifal Posted February 15, 2013 Share Posted February 15, 2013 (edited) Hello guys. I found this topic after searching for a solution to the same problem. In order to to achieve what colorrush (and I) is asking here: I will try to edit the php code, but I also found out that the products appear in the order in which they were added to the featured (home) category, so a solution is also to remove the products so the featured is empty and then add the products in the order you want them (the last one is added first). ...I edited the file /PRESTASHOPDIR/modules/homefeatured/homefeatured.php and changed line 106 (PS 1.5.3.1): $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); to this: // webmaster changes start // $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); $products = array_reverse($category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10))); // webmaster changes end Now, the display order of the products in the Homefeatured block is the reverse, meaning that the product you add last in the Home category will be displayed first, and so on. Hope this helps! DISCLAIMER: I am not a particularly experienced PHP developer. The hack above may seem trivial/simple, but I shall take no responsibility in the unlikely case where it causes your PrestaShop site to crash and burn! Edited February 15, 2013 by parsifal (see edit history) 2 Link to comment Share on other sites More sharing options...
bazrao Posted May 31, 2013 Share Posted May 31, 2013 Yes Parsifal your code rearranges the order of the display. However what I am looking for is to show the latest added products in the featured area. So we have over 100 products and we we want the latest added products to be seen in the featured area. Link to comment Share on other sites More sharing options...
imankikuk Posted August 10, 2013 Share Posted August 10, 2013 Hello guys. I found this topic after searching for a solution to the same problem. In order to to achieve what colorrush (and I) is asking here: ...I edited the file /PRESTASHOPDIR/modules/homefeatured/homefeatured.php and changed line 106 (PS 1.5.3.1): $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); to this: // webmaster changes start // $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); $products = array_reverse($category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10))); // webmaster changes end Now, the display order of the products in the Homefeatured block is the reverse, meaning that the product you add last in the Home category will be displayed first, and so on. Hope this helps! DISCLAIMER: I am not a particularly experienced PHP developer. The hack above may seem trivial/simple, but I shall take no responsibility in the unlikely case where it causes your PrestaShop site to crash and burn! Thank you.. I tried this, great.. Link to comment Share on other sites More sharing options...
stottycabanas Posted August 10, 2013 Share Posted August 10, 2013 Assuming the number of featured products you have doesn't run into the hundreds, the simplest way to achieve this is to edit the position column for category 2 in the ps_category_product table and put the products in the order you want. I'm not normally an advocate of direct updates to the database, but I believe you're pretty safe with this one. Link to comment Share on other sites More sharing options...
caris789 Posted September 26, 2013 Share Posted September 26, 2013 Hello guys. I found this topic after searching for a solution to the same problem. In order to to achieve what colorrush (and I) is asking here: ...I edited the file /PRESTASHOPDIR/modules/homefeatured/homefeatured.php and changed line 106 (PS 1.5.3.1): $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); to this: // webmaster changes start // $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); $products = array_reverse($category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10))); // webmaster changes end Now, the display order of the products in the Homefeatured block is the reverse, meaning that the product you add last in the Home category will be displayed first, and so on. Hope this helps! DISCLAIMER: I am not a particularly experienced PHP developer. The hack above may seem trivial/simple, but I shall take no responsibility in the unlikely case where it causes your PrestaShop site to crash and burn! This helped me! it's not perfect, but it works! Link to comment Share on other sites More sharing options...
Ashu1190 Posted August 27, 2014 Share Posted August 27, 2014 Hi everyone, I am having the same issue, but for "new Product" section, i am using prestashop 1.4.2, and using velvet sky free theme. i have two category, first one is home safes and second is office safes, (please visit www.mastersafe.net), at home page i have slider who slide feature product and new arrival product. i want feature product shown from Home safes category and new product from Office Product Category. Is this Possible???? Any one please help.....i am not hard core programmer,so it is very difficult.... Link to comment Share on other sites More sharing options...
Ashu1190 Posted August 27, 2014 Share Posted August 27, 2014 How do i start new topic, i have some problem in my prestashop............???? Link to comment Share on other sites More sharing options...
Lisa_brown2694 Posted February 12, 2016 Share Posted February 12, 2016 Hello guys. I found this topic after searching for a solution to the same problem. In order to to achieve what colorrush (and I) is asking here: ...I edited the file /PRESTASHOPDIR/modules/homefeatured/homefeatured.php and changed line 106 (PS 1.5.3.1): $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); to this: // webmaster changes start // $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); $products = array_reverse($category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10))); // webmaster changes end Now, the display order of the products in the Homefeatured block is the reverse, meaning that the product you add last in the Home category will be displayed first, and so on. Hope this helps! DISCLAIMER: I am not a particularly experienced PHP developer. The hack above may seem trivial/simple, but I shall take no responsibility in the unlikely case where it causes your PrestaShop site to crash and burn! Hello! I tried this but its not working for me! Any other solution?? here is my code: if (Configuration::get('HOME_FEATURED_RANDOMIZE')) /*HomeFeatured::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), null, null, false, true, true, ($nb ? $nb : 8));*/ HomeFeatured::$cache_products = array_reverse($category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), null, null, false, true, true, ($nb ? $nb : 8))); else /*HomeFeatured::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position');*/ HomeFeatured::$cache_products = array_reverse($category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position')); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now