Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sorting dropdown menu


HelleM

Recommended Posts

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

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

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

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

Archived

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

×
×
  • Create New...