Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sort order after a search


jeffers

Recommended Posts

By default Osc list the reults of a search by products order.

Now I wanted my search results sorted by Manufacturer, it has takes me ages to work it out as i could not find anything on the forums or contribs to help me out but finally i managed it and it was only 2 changes to 1 file that is needed.

 

In advanced_search_reults.php around about line 303 you should see code :--

 

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

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

$order_str = ' order by pd.products_name';

 

I changed this to

 

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

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

$order_str = ' order by m.manufacturers_name ';

 

and now the default sort order is by manufacturer.

 

Hope it can be help to some of you.

 

Jeff

Link to comment
Share on other sites

  • 1 month later...

Since putting the above tip up, i noticed on my site (JCProgrammes) that when the number of products exceeded the page limit ,the sort reverted to product name.

 

So i've now changed line

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

 

to

 

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

 

and now it works on all the pages.

 

Jeff

Link to comment
Share on other sites

  • 11 months later...
By default Osc list the reults of a search by products order.

Now I wanted my search results sorted by Manufacturer, it has takes me ages to work it out as i could not find anything on the forums or contribs to help me out but finally i managed it and it was only 2 changes to 1 file that is needed.

This contribution does just that and will also set the sort order for product listings: Default Search options in categories and Advanced Search. It requires just 2 changes in index.php and advanced_search_result.php

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...