Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product listing sort field


robokoneko

Recommended Posts

Hello,

 

I am havign torubles with product sorting. I have set in index.php for items to be sorted via product_model in descending order by setting the following in index.php:

 

$listing_sql .= " order by p.products_model desc"; (line 208)

 

which works fine. But if I come to a manufacturing listing which has more than one page worth of items and I click on the "Next" link at the bottom of the page it goes to the next page but re-sorts them all via product_name.

 

Is there somewhere else I should also put the sort field as p.products_model

The only other one I could find was in product_listing.php

 

$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_model');

 

and it is already to tp p.products_model

 

Thanks,

 

melinda

Link to comment
Share on other sites

Reset what you did and change

        if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by pd.products_name";
         break;
       }

to

        if ($column_list[$i] == 'PRODUCT_LIST_MODEL') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'd';
         $listing_sql .= " order by p.products_model desc";
         break;
       }

The effect of this would be to change the default sort to descending by product model. The customer will still be able to change the sort order by clicking on the headers.

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

Hi Matt,

 

Ok I have done hat you suggested and that got me one step closer.

 

When I click on "next" now they remain sorted by product_model but reverse from descending (desc) order to ascending order on the second page. The reason why I want the descending order is so the newwest items are at the top always.

 

Many Thanks,

 

Melinda

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...