Prestashop sort by date

It seems more and more lately I am running into unusual request with Prestashop. Earlier this week one of my clients contacted me and wanted to add the option to their category pages to sort by date. It is odd that this is left out, since in the back office on the products tab, you can select to display the products by date. So this is what I did to add those options to the drop down on the categories page.


Adding a sort by date on the categories page


You are going to need to FTP into your site and change the product-sort.tpl file. The location for the default theme is themes/default/product-sort.tpl. Your location and lines on the file could be different if you are not using the default Prestashop theme. Once the file is open, it should look like this.

Prestashop product sort


These are the two lines you will need to enter to add the sorting.

<option value="date_add:desc" {if $orderby eq 'date_add' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='Date added: latest first'}</option>
<option value="date_add:asc" {if $orderby eq 'date_add' AND $orderway eq 'asc'}selected="selected"{/if}>{l s='Date added: earliest first'}</option>

It depends where you want them to show up in the list as to where you would insert them. I wanted these to be the first options in the list, so I inserted them here.

Prestashop sort by date


As with all of our tutorials, if you do not feel like you can handle this, shoot us a message and let us handle it for you. Good luck and happy selling.


About the Author: Lesley Paone

Lesley has worked in e-commerce for over a decade, and is the founder of dh42. Starting out with PrestaShop and brancing out into other platforms like Shopify. He loves all things e-commerce and loves a challenge, in his spare time he helps moderate several forums on SEO, e-commerce, as well as the PrestaShop forum. If you have any questions for him about any of his articles just use our contact form to contact him.