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->getProducts((int)Context::getContext()->language->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.

Views (177)

Share on Facebook0Share on Google+0Share on LinkedIn0Tweet about this on TwitterEmail this to someonePrint this page
[Total: 0    Average: 0/5]
The following two tabs change content below.

Leave a Reply

Your email address will not be published. Required fields are marked *

11 + 12 =