osCmax v2.5 User Manual
Results 1 to 2 of 2

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

      
  1. #1
    osCMax Testing Team
    Join Date
    Sep 2004
    Posts
    362
    Rep Power
    10


    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

  2. #2
    Member
    Join Date
    Aug 2008
    Location
    Canada
    Posts
    61
    Rep Power
    4


    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

Similar Threads

  1. Attribute manager - sorting attributes on SELECT
    By chrismole in forum osCmax v2 Customization/Mods
    Replies: 1
    Last Post: 04-07-2006, 10:32 AM
  2. Flat fee product option / attribute
    By JonThePromoGuy in forum osCommerce 2.2 Modification Help
    Replies: 0
    Last Post: 01-04-2005, 06:51 PM
  3. Set order to option in product attribute
    By knullhund in forum osCMax v1.7 Installation
    Replies: 2
    Last Post: 12-01-2004, 06:04 PM
  4. Option values scrol
    By KCount in forum osCommerce 2.2 Modification Help
    Replies: 1
    Last Post: 09-14-2004, 11:02 AM
  5. Is there A Product Attribute Option Type Mod for MS2-MAX?
    By klyder in forum osCMax v1.7 General Mods Discussion
    Replies: 9
    Last Post: 07-10-2004, 09:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •