Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to order listing by model as default on product_list.php


peterbat

Recommended Posts

Posted

Morning/Afternoon/Evening All,

 

Anyone know where I can change the default product listing order of product_listing.php so that it orders by model and not product name as default?

 

Cheers,

 

Peter

Posted

by changing your catalog\index.php

 

from this:

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

to this

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

Posted
by changing your catalog\index.php

 

from this:

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

to this

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

 

Woot saved me searching on how to do it by price. Made the mistake of not catching that d in the from this code and left it in for the to this.

  • 4 weeks later...
Posted

Please note before changing the code, set the "Display Product Model" to "0."

 

When I tried replacing the code I got error mssages. So I set the Display Product Model to 0 then replaced the code and then set Display Product Model to 3 and all worked fine.

 

Tony

 

 

Woot saved me searching on how to do it by price. Made the mistake of not catching that d in the from this code and left it in for the to this.

Archived

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

×
×
  • Create New...