Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Products listed in order of Product Code?


Milmod

Recommended Posts

Hi All again

 

I have another question. I am trying to get my products listed under each category to be listed in order of their Product Code not in Alphabetical order of Description which seems to be the default way.

 

Can anyone help please.

 

Thanks.

 

David.

Link to comment
Share on other sites

David,

 

You will need to find the sql statements like the one I have pasted below

 

$sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
     $sort_order = substr($HTTP_GET_VARS['sort'], 1);
     $listing_sql .= ' order by ';
     switch ($column_list[$sort_col-1]) {
       case 'PRODUCT_LIST_MODEL':
         $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_AUTHOR':
         $listing_sql .= "p.products_author " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_NAME':
         $listing_sql .= "pd.products_name" . ($sort_order == 'd' ? 'desc' : '');
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", p.products_title";
         break;
       case 'PRODUCT_LIST_IMAGE':
         $listing_sql .= "pd.products_name";
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_PRICE':
         $listing_sql .= "p.products_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;

 

I haven't checked this because I am working away from my dev server, but you should just be able to replace

 

($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

 

with

 

($sort_order == 'd' ? 'desc' : '') . ", p.products_model";

 

 

again good luck

 

Matt

Matt Peace

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...