Andreasjj Posted July 4, 2013 Share Posted July 4, 2013 Hello I would like to give my customers the opportunity to sort products by newest first. I know where i have to insert the code in product-sort.tpl, but can anyone tell me the code i have to insert? Thanks in advance, Andreas Link to comment Share on other sites More sharing options...
vekia Posted July 4, 2013 Share Posted July 4, 2013 you don't have to change code go to the preferences > products there you can set up the "default" sort method: Link to comment Share on other sites More sharing options...
Andreasjj Posted July 4, 2013 Author Share Posted July 4, 2013 On 7/4/2013 at 8:13 PM, vekia said: you don't have to change code go to the preferences > products there you can set up the "default" sort method: Thank you for your answer, but that is not what i am looking for. I would like to give my customers the opportunity to sort products by newest first, as well as they can sort by price. Link to comment Share on other sites More sharing options...
vekia Posted July 4, 2013 Share Posted July 4, 2013 i thought that you want to change the default sorting method sorry for my mistake Link to comment Share on other sites More sharing options...
PSfever.com Posted July 4, 2013 Share Posted July 4, 2013 I don't this is possible right now in Prestashop. You'll need to hire a programer for this one (or look online for a free solution). If you want to change the order of the options, take a look at this code. <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'}</option> {/if} Those <option> tags should define the order of the dropdown list options. You can therefore modify the order, I don't know how you could simply solve your problem. I thing there should be some PHP OOP in the background anyway.. Link to comment Share on other sites More sharing options...
Andreasjj Posted July 4, 2013 Author Share Posted July 4, 2013 On 7/4/2013 at 8:27 PM, PSfever.com said: I don't this is possible right now in Prestashop. You'll need to hire a programer for this one (or look online for a free solution). If you want to change the order of the options, take a look at this code. <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'}</option> {/if} Those <option> tags should define the order of the dropdown list options. You can therefore modify the order, I don't know how you could simply solve your problem. I thing there should be some PHP OOP in the background anyway.. Also thank you for your answer, but i do not want to change the order of the dropdown list options, but just add the "sort by newest first"-option. Link to comment Share on other sites More sharing options...
PSfever.com Posted July 4, 2013 Share Posted July 4, 2013 On 7/4/2013 at 8:30 PM, Andreasjj said: Also thank you for your answer, but i do not want to change the order of the dropdown list options, but just add the "sort by newest first"-option. As I said, it's not possible atm (I guess). Look for a programmer here or p.e. Freelancer.com - you'll get it cheaply :-) India is India.. Link to comment Share on other sites More sharing options...
Recommended Posts