Prestashop – How To Change Home Feature Product Deafult Sorting in PHP
By default Prestashop Home Feature product module is sorted by position. If you would like to change it to sort by date (Latest products show first), you need to change the homefeatured.php under ‘modules’ –> ‘homefeatured’. Before you do the following changes, please make sure you make a backup in case something goes wrong.
Let’s go to line 130 of homefeatured.php (version 1.8.0)
HomeFeatured::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), ‘position’);
Now, replace ‘position’ to ‘date_upd’, ‘DESC’ so it should look like this:
HomeFeatured::$cache_products = $category-&gt;getProducts((int)Context::getContext()-&gt;language-&gt;id, 1, ($nb ? $nb : 8), ‘date_upd’, ‘DESC’);
DONE! Please remember not to use the ‘Randomize ‘ option in the back office!
You may ask ‘Hey, Prestashop has a new product module. Why do I bother?’ Since the release of Prestashop 1.6, we have encountered multiple problems with New Product Module. Usually it cannot pick up the new products uploaded by administrator so we used the Home Featured Products as a backup plan. If the New Product module doesn’t work, you know what to do then.
If you have any questions, please leave a comment below.
Latest posts by Owen Woo (see all)
- Prestashop – How To Change Home Feature Product Deafult Sorting in PHP - March 14, 2016
- WordPress Plugins You Should Install - November 17, 2015
- Google Negative SEO - November 17, 2015
- JQuery – Put JQuery in Prestashop tpl file - September 18, 2015
- CSS – How to fix the background image with full width and full height - September 18, 2015