HelleM Posted November 6, 2006 Share Posted November 6, 2006 Hi I have been trying to sort this dropdown menu on the product_info.php page - so that the options are sorted alphabetic and not by the ID. I thought I could use something like: order by products_options_name desc" - but NOOO I must confess I'm soooooo much a PHP newbie. i'm sure it's simple if you know PHP *please* <?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?> What should I add.... Please Helle :-() Link to comment Share on other sites More sharing options...
Tidalwave Posted November 7, 2006 Share Posted November 7, 2006 I'm also searching for a solution of this. Please help us. Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 7, 2006 Share Posted November 7, 2006 I have been trying to sort this dropdown menu on the product_info.php page - so that the options are sorted alphabetic and not by the ID. I thought I could use something like: order by products_options_name desc" - but NOOO Strange, just tried that and it seemed to work fine in 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 . "' order by pov.products_options_values_name desc"); Link to comment Share on other sites More sharing options...
HelleM Posted November 8, 2006 Author Share Posted November 8, 2006 Hi Jan Ehhh, which code lines did you replace you code with... Really looking forward to try it - but I'm not sure which code to replace *sorry for my newbie state* Helle :-) Link to comment Share on other sites More sharing options...
HelleM Posted November 8, 2006 Author Share Posted November 8, 2006 Okay - BIG thanks - it work fine...... *I was kinda close in my guessing* Find 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 . "'"); Replace 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 desc"); Again thanks Jan Link to comment Share on other sites More sharing options...
Tidalwave Posted November 8, 2006 Share Posted November 8, 2006 To sort numbers and alphabetic as well, add this code instead: $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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.