Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I change the order of the attributes?


oz16oz2

Recommended Posts

I thought it was chronological (lower product attribute ID #s first),

but that's not the case.

 

I thought it was alphabetical (according to the option value), but

that's not the case either.

 

Can anyone help me on this?

 

Is there a contribution for it?

 

Thanks!

 

OZ

Link to comment
Share on other sites

Here's a contribution

 

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

 

Or you can just make the following change.....from a previous saved thread.

 

At the end of the attribute sorter contribution, the very last change to

product_info.php, there is a small addition to the last line of code,

"order by" which in the contribution is set to order by the new field

created called "sort_order". All I did was change this to the

options_values_id and voila - all my product attributes are displayed in

the correct order. Here is the ONLY change required, in the file

catalog/product_info.php :

 

Change this code:

 

$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 = '" . $products_options_name['products_options_id'] .

"' and pa.options_values_id = pov.products_options_values_id and

pov.language_id = '" . $languages_id . "'");

 

to this (change is at the very end of the last line, an additional bit

of code):

 

$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 = '" . $products_options_name['products_options_id'] .

"' and pa.options_values_id = pov.products_options_values_id and

pov.language_id = '" . $languages_id . "' order by

pa.options_values_id");

 

All the other stuff seems like overkill to me. All you have to do is

make this change and then make sure you create (or recreate) your

attribute values in the order you want them to appear. (Or, edit their

ID numbers in the database if they're already created and in the wrong

order.) If you wanted to sort by something else you can do that too,

just change the field that it's sorted by, the other choices would be

alphabetical by the value name or sorted by the attribute price.

 

HTH

Tom

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...