Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing Default Sort Order of Products


antonbartolo

Recommended Posts

Posted

I needed to change the default sort order of my products from Product Name Ascending to Price Descending.

 

After searching the forums without success for the answer (the search function was not working well so I cannot say I made an exhaustive search) I decided to figure it out for myself.

 

In case you are looking to do the same, the solution is quite simple:

 

In index.php comment out and add the following:

 

/*      if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

          $HTTP_GET_VARS['sort'] = $i+1 . 'a';

          $listing_sql .= " order by pd.products_name";

          break;

        }

*/

        if ($column_list[$i] == 'PRODUCT_LIST_PRICE') {

          $HTTP_GET_VARS['sort'] = $i+1 . 'd';

          $listing_sql .= " order by final_price desc, pd.products_name";

          break;

        }

 

The main reason I write is to suggest that for future releases changing the default product sort order should be made through the admin tool under Configuration/Product Listing. This should be quite straightforward to implement and I image very useful to users who want to order by price or some other column.

  • 1 year later...
Posted
I needed to change the default sort order of my products from Product Name Ascending to Price Descending.

 

After searching the forums without success for the answer (the search function was not working well so I cannot say I made an exhaustive search) I decided to figure it out for myself.

 

In case you are looking to do the same, the solution is quite simple:

 

In index.php comment out and add the following:

The main reason I write is to suggest that for future releases changing the default product sort order should be made through the admin tool under Configuration/Product Listing. This should be quite straightforward to implement and I image very useful to users who want to order by price or some other column.

 

Thanks for the quick fix - worked like a charm!

  • 1 year later...
Posted

this works great

 

to sort price ascending just remove the "desc" from the following

 

" order by final_price desc, pd.products_name";

this time it'll go :-)

  • 3 weeks later...
Posted

I was looking for this also!!

 

I want to specifically choose some products to appear first as they are "easier on the eye :blush: " !!

 

I tried to sort them using the "sort" option but it dosent work.

 

Any ideas!?

 

thanks

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...