Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Oct 2008
    Posts
    378
    Plugin Contributions
    0

    Default Option values in attributes controller sort order

    Hi, I need to change the sort order of the option values displayed in the attribute controller.

    There will be an attribute for every day of the year ie january 1st january 2nd etc etc

    I am setting the option sort orders as 1 through 365 to get them to display correctly on the product info page but in the attributes controller in admin they are displaying in alphabetical order ie april first 1 through 30 then august 1 through 31.

    I need them to display in sort order low to high

    How can this be achieved

    Thanks in advance

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Option values in attributes controller sort order

    Attribute Values have a Sort Order that you can set to arrange their display order ...

    NOTE: 365 Attributes is quite a number to add on a Product ... what exactly are you trying to accomplish with an Attribute for every day of the year?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Oct 2008
    Posts
    378
    Plugin Contributions
    0

    Default Re: Option values in attributes controller sort order

    My customer is selling training courses, I have the option name set as course date. I now need to add option name values for every date in the year so as he can set a date against each of his training courses.

    I know attributes have a sort order that displays correctly in the product info display but i need them to display in sort order in admin not alphabetical much easier to add if the order starts january rather than april

    P.s. I am not adding 365 attributes to a product I am adding 365 option values to an attribute option name
    Last edited by Congerman; 17 Feb 2014 at 11:56 PM.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Option values in attributes controller sort order

    While this is usually not necessarily a good way to display the Attributes Option Values, you could try editing the:
    /your_secret_admin/attributes_controller.php

    and add the code in RED:
    Code:
      function zen_js_option_values_list($selectedName, $fieldName) {
    
        global $db, $show_value_numbers;
    
        $attributes_sql = "SELECT povpo.products_options_id, povpo.products_options_values_id, po.products_options_name, po.products_options_sort_order,
    
                           pov.products_options_values_name, pov.products_options_values_sort_order
    
                           FROM " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " povpo, " . TABLE_PRODUCTS_OPTIONS . " po, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
    
                           WHERE povpo.products_options_id = po.products_options_id
    
                           AND povpo.products_options_values_id = pov.products_options_values_id
    
                           AND pov.language_id = po.language_id
    
                           AND po.language_id = " . (int)$_SESSION['languages_id'] . "
    
                           ORDER BY po.products_options_id, po.products_options_name, pov.products_options_values_sort_order, pov.products_options_values_name";
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Oct 2008
    Posts
    378
    Plugin Contributions
    0

    Default Re: Option values in attributes controller sort order

    worked a treat thank you very much

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Option values in attributes controller sort order

    Thanks for the update that this worked for you ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #7
    Join Date
    Oct 2008
    Posts
    378
    Plugin Contributions
    0

    Default Re: Option values in attributes controller sort order

    Trying to work out the code can you shed any light on the use of po and pov as pov option value name is still in there but pov option value sort order is taking presidence

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Option values in attributes controller sort order

    Any chance you can do a screen shot that might help better define the problem?

    I thought you want the Option Values to display by Sort Order in the selections ...

    Perhaps you can be a bit more specific in an image ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  9. #9
    Join Date
    Oct 2008
    Posts
    378
    Plugin Contributions
    0

    Default Re: Option values in attributes controller sort order

    There is no problem with your solution it works perfectly as far as i can see. I am just trying to understand the code
    " ORDER BY po.products_options_id, po.products_options_name, pov.products_options_values_sort_order, pov.products_options_values_name";"

    You have put pov option values sort order in there before pov option value names

    i would like to understand the priorities with your solution and the meanings of po and pov


    It is not needed information but the more i learn then the better lol

    Thanks for your solution

  10. #10
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Option values in attributes controller sort order

    I see ...

    If you look at that SELECT statement, you will see the table references:
    Code:
                          FROM " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " povpo, " . TABLE_PRODUCTS_OPTIONS . " po, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
    Each table is referenced with:
    povpo
    po
    pov

    which saves having to write out the whole name of the table ...

    On the ORDER BY:
    Code:
    ORDER BY po.products_options_id, po.products_options_name,  pov.products_options_values_sort_order,  pov.products_options_values_name
    It defines what the sort order for the records selected should be so this is sorted by the products_options table field products_options_id then it looks at the products_options table products_options_name it then sorts the products_options_values table products_options_values_sort_order and then the products_options_values table products_options_values_name ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Option Value Sort Order - Attributes Controller Page Only
    By dranet in forum Setting Up Categories, Products, Attributes
    Replies: 12
    Last Post: 7 Mar 2017, 08:25 AM
  2. Sort order of option values
    By Nick1973 in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 18 Apr 2013, 02:06 PM
  3. v150 Option Values as Sort Order
    By coopco in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 4 Jan 2013, 03:30 PM
  4. Alphabetical order of Option Values in Attribute Controller
    By D-man in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 20 Dec 2008, 05:56 PM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR