PDA

View Full Version : Set order to option in product attribute



knullhund
11-28-2004, 08:41 PM
Problem: I enter say four options for a product. Opt1, Opt2, Opt3, and Opt4. The when I go to attributes manager I check the four option, but they don't show in the pull down version, or "radio button" in the order I entered them. Optio1 has a zero dollar value. The others have added charges and need to be in the same order (1,2,3, and 4) as when I entered them.
Question: How do I fix this, or better jet how do I control the order in which these attributes appear in the pull-down window or under the option with the radio buttons.
Thanks in advance.
Knull

gameparts
11-30-2004, 10:58 PM
I believe the file is /catalog/admin/products_attributes.php

and the section that needs to be modified is:

<?php
} else {
if (isset($HTTP_GET_VARS['option_order_by'])) {
$option_order_by = $HTTP_GET_VARS['option_order_by'];
} else {
$option_order_by = 'products_options_id';
}
?>

But I have no idea how to modify it. I would like to change this as well. Anyone with PHP coding experience know how to modify it or where/how to set that variable "option_order_by"??

gameparts
12-01-2004, 07:04 PM
I Found It! It was listed on another support site:

Sort Product Options (attributes)

What it does...
First - sorts by price
Second - if price is same (or 0), it sorts based on the order that the option was entered.

File to change ...
/catalog/product_info.php
********************************************

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


With this line
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id 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_price, pa.products_attributes_id");


OR.......

If you want to sort solely by the order the option was entered (regardless of price) instead use 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, pa.products_attributes_id 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.products_attributes_id");