Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Attributes Random Order Problem


DesignAlot

Recommended Posts

Posted

I have searched around, having bad luck. Latest install of OScommerce. I have a product "T-shirt" and I want size attributes. I add them in order from "small, medium, large, xtra large, 2xl". When I check the actual product as if I was a shopper, I get THIS order "2xl, small, xtra large, large, medium". That is NOT the order I want the drop down menu to display. Getting very frustrated. Even looked as sql database to see if I could change order to be correct. Nothing works. What the heck am I doing wrong?!

Posted

Assuming the latest osCommerce is CE Phoenix 1.0.6.0, the order is set in https://github.com/gburton/CE-Phoenix/blob/master/includes/modules/content/product_info/cm_pi_options_attributes.php

It orders by name.  So to get a different order, make the names have a definite order.  E.g.

1.  Small

2.  Medium

3.  Large

4.  Xtra Large

5.  2XL

Where the initial number is part of the option name.  Note that this only supports up to nine choices per option. 

It's possible that a different version might have a different order, e.g. by order of entry in the database.  I mention this because I think that your order would be difficult to achieve in CE Phoenix.  Perhaps 2XL, Small, Xtra large, large, medium would do it (mixed casing intentional).  I would expect with consistent casing, it would be 2XL, Large, Medium, Small, Xtra Large. 

Always back up before making changes.

Posted

Sort Ordering would be a very simple change to add in the product_attributes area. 
Support a good coder to allow him/her to take v1060 and make the changes, then (if you wanted to help others in the future) give us back the code to potentially add into the Core.

Posted

After some searching, this is what I found. From 2004, but still works! I am thankful...

 

All I wanted was something that showed my options in order of price. Or at the very least showed them in the order I entered them.

It's a simple fix that takes less than a minute.

 

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

Hope someone else will find this useful.

Posted
9 hours ago, DesignAlot said:

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

Hope someone else will find this useful.

Replace by 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 products_attributes pa, products_options_values pov where pa.products_id = '" . (int)_GET['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");

I suppose that you aren't on osCommerce Phoenix (by the code pasted), I recommend you upgrade to Phoenix

Posted

I am on Phoenix on another OS commerce site. This one I am talking about I could only install through godaddy, no full installer through cpanels yet. If I have ftp access, is it hard to upgrade to phoenix and keep previous products/settings?

Archived

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

×
×
  • Create New...