PDA

View Full Version : Product Options / Product Attributes.. pulldown sorting.?



Preston
08-21-2005, 01:01 PM
Ive got an option, "Style", with 10 Options, 100-109, and when I insert them all the dropdown box on the rendered page has them in random order. Is there a setting I'm missing or is this just how it works.

I've tried adding the attributes in dif orders and it arranges them differently.. even if I re-add them in the original ascending order..

I'm so confused has anyone else seen this.. I just want them in ascending order

100
101,.. etc..

ive got

101
105
102
103,..

:shock:


Oh.. and while I add them in the admin.. products_attributes.php page in order.. the rearrange with each update on their own.. fun.

Preston
08-21-2005, 01:22 PM
Dang. I just looked at the mysql query.. there is no order by.. so I just added that..

in product_info.php line 131:

$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 . "'");

changed to:

$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 pa.options_values_id");


I hope this helps fix my problem ;/ ill have to add more products and options.

ktweezee
09-26-2005, 09:54 AM
Dang. I just looked at the mysql query.. there is no order by.. so I just added that..

in product_info.php line 131:

$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 . "'");

changed to:

$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 pa.options_values_id");


I hope this helps fix my problem ;/ ill have to add more products and options.

nice work man, i really needed this one, there was a contribution that was too much for me to follow:

http://www.oscommerce.com/community/contributions,1822

Smurf
10-26-2005, 11:14 AM
I'm having the a similar problem.

My attribute list is colours, at the moment in a random order. Can I use a modified version of the above code & display them in alphabetical order?

Any help appreciated.

Smurf
11-08-2005, 02:31 AM
Is anybody willing to she some light on the code, I've tried searching other php forums, no joy yet. I'm going back to trial & error.
Any help appreciated.

Thank You :lol:

ericcech
11-24-2005, 07:53 PM
if not found in product_info.php, add to the end of the same line as above in pad_base.php

." order by pa.options_values_price, pa.products_attributes_id"

my single radio options are now sorted by option_id.