Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Attribute order


Guest

Recommended Posts

Hi,

 

Im adding in Product Attributes into some of my catalog items, and i was wondering how you change the order? It would be nice to see these ordered via price..?

 

At this stage they are all over the place and looks very messy..

Link to comment
Share on other sites

In your catalog/product_info.php on approximately line 141 you will se this line of script:

 

      $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");

 

 

See where it says

order by popt.products_options_name

?

 

You can change this to say

order by popt.products_options_price

$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_price");

 

JM

Always remember, we need patience, guidance and most of all understanding.

 

My Contributions

Link to comment
Share on other sites

  • 6 months later...
In your catalog/product_info.php on approximately line 141 you will se this line of script:

 

      $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");

See where it says

order by popt.products_options_name

?

 

You can change this to say

order by popt.products_options_price

$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_price");

 

JM

 

I tried this and I get an error I would like to order my attributes by size.

Can some give me so guidence. I tried changing the code to option_value_id. Because these have been entered in the correct order.

 

Thanks :(

Link to comment
Share on other sites

  • 6 months later...

Did anyone get this to work? I am trying to order my options dropdown list alphabetically and it's not working. The code above shows the list should be ordering by "name" by default, which should be alphabetically, but it's not. I also tried ordering by "id", but no luck there either. The order seems to be random.

 

How do I control the order of the options in the dropdown list?

 

Thanks,

C

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...