Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help, sql statement to order attributes


cczernia

Recommended Posts

I have an sql statement that orders attributes using sql "order by" in product_info.

 

 $products_options_query = tep_db_query("select pa.options_id, pa.options_values_id, pa.options_values_price, pa.price_prefix, po.options_type, po.options_length, pot.products_options_name, pot.products_options_instruct from
	   " . TABLE_PRODUCTS_ATTRIBUTES  . " AS pa,
	   " . TABLE_PRODUCTS_OPTIONS  . " AS po,
	   " . TABLE_PRODUCTS_OPTIONS_TEXT  . " AS pot
	   where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'
		 and pa.options_id = po.products_options_id
		 and po.products_options_id = pot.products_options_text_id and pot.language_id = '" . (int)$languages_id . "'
	   order by pa.products_options_sort_order
	   ");

 

This will order the values of the product attributes. If you want to order the product options you change "pa.products_options_sort_order" to "po.products_options_sort_order".

 

My question is how do you change it if you want to order both?

 

 

 

Just in case I need to define myself here is how I'm labeling the attributes...

Product Attributes

 

Frames (option)

Gold (value)

Silver (value)

Mahagony (value)

Size (option)

11x14 (value)

14 x 17 (value)

Shade and Sweet Water

Chris Czerniak

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...