Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sort Product Option Values in Admin & Cat.


Sinister-Racing

Recommended Posts

I am having a problem with the way the product attributes are sorted in the catalog. The sizes of the boots are messed up and I know It's because of how they were inserted in the admin section but I dont know how to fix it. Here is the site so you can see what I mean.

 

http://www.sinister-racing.com/catalog/pro...products_id=253

 

If anybody can help that would be great, I have been racking mybrain on this for countless evenings.

 

Thanks,

 

Mike

Link to comment
Share on other sites

I'm very new to osCommerce so I'm not entirely sure if this will solve your problem. That said I would try adding an ORDER BY clause to the $products_options_query in product_info.php (line 134 in mine).

 

E.g

 

$products_options_query = tep_db_query("select pov.products_options_values_id, ............ pov.language_id = '" . (int)$languages_id . "' ORDER BY pov.products_options_values_name");

 

Of course any single digit sizes would need to be prefixed by a zero to keep the order correct. To reverse the order add DESC to the ORDER BY:

 

ORDER BY pov.products_options_values_name DESC");

 

Hope that helps.

Link to comment
Share on other sites

Thanks, Matt

 

But I am not sure if this is what you meant but I am getting errors, I am not sure if I missed something like a space or a quote around the BOLD area in the code below..... any suggestions

 

 

$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

Try this, you'll get even more control over the order of the display, as long as you put the attributes in in order:

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

 

That's line 134, and the drop down box will display the options in the order their id numbers run from lowest to highest.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...