SQL order by problem
Posted: Thu May 03, 2007 5:47 pm
feyd | Please use
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...
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have an sql statement that orders a pull down menu using sql "order by" in product_info (from oscommerce).Code: Select all
$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...
Pull down menus
Frames (option)
Gold (value)
Silver (value)
Mahagony (value)
Size (option)
11x14 (value)
14 x 17 (value)
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]