Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sorting Products, Options, and Attributes


rhfield

Recommended Posts

Someone gave me a snippit of code a while back. I remember making a small change in the product_info.php file so that it would sort the products by alphebitically name, but I have lost that snipit.

 

Then I had to replace the products_info.php file from back up, and now the product and options are fine, but the attributes now display in the opposit order.

 

What controls the sorting order?

Link to comment
Share on other sites

the following post might be useful: http://www.oscommerce.com/forums/index.php?showtopic=191869

 

The short answer in that post is to find

$listing_sql .= " order by pd.products_name";

in catalog/index.php and change it to whatever you want to sort by.

 

Also there is a contribution out there which allows you to set which column sorts on the backend. It can be found here: AutoSort Products Contribution

Link to comment
Share on other sites

for the option values of attributes locate this code in the catalog\product_info.php

 

		$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

 

replace it with this

		$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pov.products_options_values_name");

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...