osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 
 

Sorting your attribute option values in osCMax

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 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v2.0 Forums > osCMax v2 Customization/Mods

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Reply

 

LinkBack Thread Tools
  #1  
Old 09-03-2007, 04:06 PM
osCMax Testing Team
 
Join Date: Sep 2004
Posts: 298
Thanks: 23
Thanked 35 Times in 34 Posts
Rep Power: 6
bkpie has a spectacular aura aboutbkpie has a spectacular aura about
Default Sorting your attribute option values in osCMax

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Advertisement
  #2  
Old 09-18-2008, 06:16 AM
New Member
 
Join Date: Aug 2008
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
BrandonScottishRegalia is on a distinguished road
Question Re: Sorting your attribute option values in osCMax

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Advertisement
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -8. The time now is 08:02 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax