Product Sorting v2.x

CS has changed the way they call for product sorting and it's actually a little simpler as far as changing all of the sorting in both front and back end. In previous versions you had to not only modify files but the database as well.

Below, you can see that I have added product code to the sorting and this not only allows you to choose it for the default in admin but also adds it to the sorting choices in the front end.

/core/fn.catalog.php

function fn_get_products_sorting($simple_mode = true)
{
$sorting = array(
'position' => array('description' => fn_get_lang_var('default'), 'default_order' => 'asc'),
'code' => array('description' => fn_get_lang_var('code'), 'default_order' => 'asc'),
'product' => array('description' => fn_get_lang_var('name'), 'default_order' => 'asc'),
'price' => array('description' => fn_get_lang_var('price'), 'default_order' => 'asc'),
'popularity' => array('description' => fn_get_lang_var('popularity'), 'default_order' => 'desc')
);

Sorry that my english isnt very bad. Can you explain a litle more what the code make, please? Or you can even put a screenshot too?



Thanks very much!

This particular example is for Product code. You can either select it in the Appearance settings to sort your products by code by default in both the front and back end or if you do not select it, it will still be an option in the front end.





[ATTACH]1569[/ATTACH]





[ATTACH]1570[/ATTACH]

sorting2.jpg

sorting1.jpg

Wow, this works great!



But, is there a way to sort by “product creation and last update datetime”? :slight_smile:

TOOL Outfitters very nice MOD !!!



Thank you

Does it meant by sorting in product code, it will be sorted by the date creation of products, as cs cart generate the product code automatically?

Tool: could you share the code you added to make “Bestsellers” appear in the sortings?

[quote name=‘sixnin9’]Tool: could you share the code you added to make “Bestsellers” appear in the sortings?[/QUOTE]



That is/was actually standard. I am assuming they have removed it?



Once CSC gets their shit straight (to my standards) with 2.1.x, I will then upgrade and be more familiar with the code and once again be of help to the forum. :stuck_out_tongue:

Figured it out - I just needed to enable the Bestsellers add-on.

Does anyone know how I could pull a specific product feature into this array to sort by that feature?



Say I’ve got a product feature called “artist last name” can I use that as a sort parameter?

Even a point in the right direction would help. I’m willing to try and tinker this thing out, I’m just not sure how to target a specific product feature and add it to that array…

Is there any way of sorting by product code in version 1.3.5 (SP4)?

Lyn, I posted a thread on it back in the day. Search in the 1.3.x forums.

Thanks The Tool but, despite searching for ages, I am unable to find any post on this for my version. Maybe I’m not putting the correct search terms in but nothing seems to be coming up for on the forum. I can remember trying to find something concerning this back when I set up my cart but thought it was something that couldn’t be done.



Will keep looking …

Here you go. [url]http://forum.cs-cart.com/showthread.php?t=7357&highlight=Sorting[/url]

Any simple way to sort by timestamp ?

[quote name=‘The Tool’]Here you go. [url]http://forum.cs-cart.com/showthread.php?t=7357&highlight=Sorting[/url][/QUOTE]



Thank you. I will try it out later this evening or tomorrow. Don’t know why I couldn’t find the thread but I did try searching for a lot of different things.

For timestamp, try this:

function fn_get_products_sorting($simple_mode = true)
{
$sorting = array(
'position' => array('description' => fn_get_lang_var('default'), 'default_order' => 'asc'),
'timestamp' => array('description' => fn_get_lang_var('time'), 'default_order' => 'asc'),
'product' => array('description' => fn_get_lang_var('name'), 'default_order' => 'asc'),
'price' => array('description' => fn_get_lang_var('price'), 'default_order' => 'asc'),
'popularity' => array('description' => fn_get_lang_var('popularity'), 'default_order' => 'desc')
);

Please, help me

Sort by random.

Thanks

I have on my product table one field called sa_message_id and I would like to be able to sort product by it on customer view.





How can I put it sorting my sa_message_id the adicional field that I have in my product tables?



Thanks in advance.