Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Attribute Option Order Fix


Trailz

Recommended Posts

Posted

I looked all over and could not find a way to fix this how I wanted so the best way for me to get the attribute options in the order I like was

to enter them in order I'd like them to appear for a item.

 

Example

 

Color -> Would have options I setup as red, black etc.

 

Engine - > V6

 

Maker -> Honda, Toyota

 

So inorder to make those appear on the product page in a specified order I couldn't find anywhere so entering them in order then allows a slight mod to product_info.php

 

Find

 

if ($products_attributes == '1') {

$products_options_name = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");

 

change to

 

if ($products_attributes == '1') {

 

 

$porderby = "products_options_id"

// $porderby = "products_options_name";

 

$products_options_name = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "' order by $porderby");

 

 

You can then just comment/uncomment the porderby and it will then sort by either the id or the name and if you want it the default way just comment both.

Archived

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

×
×
  • Create New...