deroxonweb Posted August 1, 2011 Share Posted August 1, 2011 Hello Sir/Madam, Could somebody teach me how to add sort by "added date" for product list? I tried to search through the forum, but I did not found a solution for it. Please advice and help, thank you very much. PS: I am using PS 1.3.6 Link to comment Share on other sites More sharing options...
phrasespot Posted August 3, 2011 Share Posted August 3, 2011 This works for 1.3.7, should work with 1.3.6 as well. Edit (after making a backup copy) /themes/prestashop/product-sort.tpl. Within the select element add another option element so the entire select reads: <select id="selectPrductSort" onchange="document.location.href = $(this).val();"> <option value="{$link->addSortDetails($request, 'position', $orderwayposition)|escape:'htmlall':'UTF-8'}" {if $orderby eq 'position'}selected="selected"{/if}>{l s='--'}</option> <option value="{$link->addSortDetails($request, 'price', 'asc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'price' AND $orderway eq 'ASC' }selected="selected"{/if}>{l s='price: lowest first'}</option> <option value="{$link->addSortDetails($request, 'price', 'desc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'price' AND $orderway eq 'DESC'}selected="selected"{/if}>{l s='price: highest first'}</option> <option value="{$link->addSortDetails($request, 'name', 'asc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'name' AND $orderway eq 'ASC' }selected="selected"{/if}>{l s='name: A to Z'}</option> <option value="{$link->addSortDetails($request, 'name', 'desc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'name' AND $orderway eq 'DESC'}selected="selected"{/if}>{l s='name: Z to A'}</option> <option value="{$link->addSortDetails($request, 'quantity', 'desc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'quantity' AND $orderway eq 'DESC' }selected="selected"{/if}>{l s='in-stock first'}</option> <option value="{$link->addSortDetails($request, 'date_add', 'desc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'date_add' AND $orderway eq 'DESC' }selected="selected"{/if}>{l s='date added'}</option> </select> Notice the the last option element. This will give you products in descending date added order. If you want ascending order change relevant descs to asc. You can also change "date added" at the end to something else if you wish. 1 Link to comment Share on other sites More sharing options...
deroxonweb Posted August 4, 2011 Author Share Posted August 4, 2011 Thank you very much!!! It works for PS 1.3.6 too. Link to comment Share on other sites More sharing options...
CameraTek Posted August 20, 2011 Share Posted August 20, 2011 Hi all, What would the code be for PS 1.4.4? Cheers Andy Link to comment Share on other sites More sharing options...
phrasespot Posted August 21, 2011 Share Posted August 21, 2011 What would the code be for PS 1.4.4? I don't have 1.4.4 installed. This is for latest version but should work with the 1.4.4. too. Insert one or both lines below in the same file. <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> To insert after the existing options use the marked location, or move up to insert earlier <select id="selectPrductSort"> <option value="{$orderbydefault|escape:'htmlall':'UTF-8'}:{$orderwaydefault|escape:'htmlall':'UTF-8'}" {if $orderby eq $orderbydefault}selected="selected"{/if}>{l s='--'}</option> {if !$PS_CATALOG_MODE} <option value="price:asc" {if $orderby eq 'price' AND $orderway eq 'asc'}selected="selected"{/if}>{l s='Price: lowest first'}</option> <option value="price:desc" {if $orderby eq 'price' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='Price: highest first'}</option> {/if} <option value="name:asc" {if $orderby eq 'name' AND $orderway eq 'asc'}selected="selected"{/if}>{l s='Product Name: A to Z'}</option> <option value="name:desc" {if $orderby eq 'name' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='Product Name: Z to A'}</option> {if !$PS_CATALOG_MODE} <option value="quantity:desc" {if $orderby eq 'quantity' AND $orderway eq 'desc'}selected="selected"{/if}>{l s='In-stock first'}</option> {/if} <!-- INSERT HERE --> </select> You can change the wording "Date added: latest/earliest first" to whatever you want if not suitable. Remember to make a backup of the original file. Link to comment Share on other sites More sharing options...
anix Posted November 17, 2011 Share Posted November 17, 2011 Hi! Is it possible to do the filtering also for most popular products? (meaning those that sell most....) Thanks Best regards, Ana Link to comment Share on other sites More sharing options...
mux Posted September 20, 2012 Share Posted September 20, 2012 Hi! I am also searching for filtering of most popular products.... Link to comment Share on other sites More sharing options...
Cintia Posted October 25, 2012 Share Posted October 25, 2012 I have 1.5 and it worked for me thanks!! Link to comment Share on other sites More sharing options...
Ghufran Y Posted April 11, 2014 Share Posted April 11, 2014 I am working on this websitehttp://shop.mzed.com/index.php?id_category=13&controller=category&n=20They want a shopify like sorting drop down menu on it,http://www.mzed.com/collections/all/designhow I may enable the sorting on the products page? Link to comment Share on other sites More sharing options...
Scully Posted August 21, 2014 Share Posted August 21, 2014 Sorting within category works perfectly with this change. However when a user manually enters a search tem, there is no visible result (no image, no text) - but page numbers still exist. Any idea? My version is 1.5.6.2. Regards, Scully Link to comment Share on other sites More sharing options...
oliiix Posted September 17, 2020 Share Posted September 17, 2020 still works in 1.6!! GREAT 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