This is a discussion on Sorting your attribute option values in osCMax within the osCMax v2 Customization/Mods forums, part of the osCMax v2.0 Forums category; I have read many posts about this and so I combined a few to help those who have their attributes ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| I have read many posts about this and so I combined a few to help those who have their attributes show up out of order. Like for me it was sizes. This will fix it no matter what order you put them in or they are in the database in OSCmax. One file different in regular Osc. Always back up first First you must run a couple sql querys to add a new column in products_options_values and products_options_values_to_options First run this query: ALTER TABLE products_options_values ADD COLUMN products_options_values_order_by INT UNSIGNED NOT NULL DEFAULT '0'; Then using phpmyadmin browse the table products_options_values and in the order_by column number your options in the order you want them to appear on the site. (corresponding to option name) 1 thru whatever Then run this query ALTER TABLE products_options_values_to_products_options ADD COLUMN order_by INT UNSIGNED NOT NULL DEFAULT '0'; Then browse table products_options_values_to_products_options and in the order_by column put your options in the order you want. In this table you will be referencing the products_options_value_ID If you do not know what your attribute option ID is you can look in admin under products attributes to get the ID # for that value or option. Now change 2 files (3 if you are using the add multiple prods to cart contrib) In admin/new_attributes_include.php Find around line 58 $query2 = "SELECT * FROM products_options_values_to_products_options WHERE products_options_id = '$current_product_option_id' ORDER BY products_options_values_id DESC"; Replace with $query2 = "SELECT * FROM products_options_values_to_products_options WHERE products_options_id = '$current_product_option_id' ORDER BY order_by DESC"; (The above sets order for attribute manager whether you use ASC or DESC is your choice) In Catalog/includes/classes/pad_base.php Find around line 316 $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)$this->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 . "'"); Replace with $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)$this->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_order_by ASC"); (This sets the order based on what you chose in the DB Order BY column on the product info page) THATS IT! No matter what order you enter them in while in admin they always come out the way you set them up. If you are using add multiple prods to cart contribution with attributes on the product listing page you will also have to do the above change in the product_listing_multi_col.php Now if you want to add the ajax attribute contrib which allows you to do everything on the product edit page including attributes instead of attribute manager it is easy since you do not have to first add the sort order contribution. You can however tweak it so they show in order on the admin side on the ajax contrib even though it is only aesthetic since they always come out right on the site side. Hope you had a great Labor Day |
| Sponsored Links | ||
| ||
| |
|
#2
| |||
| |||
| Hello I added this module but am new to this mysql stuff so do not understand what i am suppost to do after i add the sqls. can you explain that a bit more for me please. Can you tell me if i am suppost to click the change button or what i am suppost to click and change. Any help is much appreciated. I assume me not doing those steps is why i get this error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/burnettsandstruth.com/httpdocs/includes/functions/database.php on line 101 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/burnettsandstruth.com/httpdocs/includes/functions/database.php on line 101 |
| Sponsored Links | ||
| ||
| |
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Attribute manager - sorting attributes on SELECT | chrismole | osCMax v2 Customization/Mods | 1 | 04-07-2006 10:32 AM |
| Flat fee product option / attribute | JonThePromoGuy | osCommerce 2.2 Modification Help | 0 | 01-04-2005 06:51 PM |
| Set order to option in product attribute | knullhund | osCMax v1.7 Installation | 2 | 12-01-2004 06:04 PM |
| Option values scrol | KCount | osCommerce 2.2 Modification Help | 1 | 09-14-2004 11:02 AM |
| Is there A Product Attribute Option Type Mod for MS2-MAX? | klyder | osCMax v1.7 General Mods Discussion | 9 | 07-10-2004 09:44 AM |