Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can I list products by model number, not name?


Guest

Recommended Posts

I'd like my list of products to be presented sorted by Model Number instead of Product Name. (Unfortunately, there is no Part Number, so I'm using Model Number as a Part Number). I can change the columns these appear in, but it is always sorted by Product Name instead of number.

Link to comment
Share on other sites

The documentation says that "Config - Product Listing -- This displays the order of your products listed in your store. Change the values for whatever product order you want." Actually this just displays the fields in the order specified, but the entire list of products is still always sorted by product name. The documentation looks like it should be changed to "This displays the order of the fields on each line" instead.

Link to comment
Share on other sites

Thanks for the suggestion. I tried that, but got error 1054: unknown column "pd.products_model" in "order clause".

Link to comment
Share on other sites

I also tried "order by p.products_model", and this works for the first page of products. But the second and subsequent pages are presented in a scrambled order. Seems strange that you can't list products by product numbers. I suppose I have two circumventions: 1. make the products page long enough to handle all the products, or 2. prefix my product names with the product number, duplicating this information.

Link to comment
Share on other sites

There are two places in index.php that have to be changed in order for the second and subsequent pages to be sorted by model. If you only change the first of these, the first page gets sorted by model, but other pages don't. I changed these two sections and it works fine:

 

change pd.products_name to p.products_model in

 

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

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

$listing_sql .= " order by p.products_model";

break;

 

and change pd.products_name to p.products_model in

 

 

case 'PRODUCT_LIST_NAME':

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

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...