Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16
  1. #11
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: $box_categories_array[i]['sort_order'] ?

    You could rewrite category_tree.php to retrieve sort_order as well as ordering by it. If you are using a mod 4 type of class assignment, changing an individual sort order... could work, as long as you keep the categories' sort orders spaced in sets of four (the first one is order 1-4, the second is order 5-8, etc.) That would break as soon as you want to change or add a new cat between two others. It might be more robust and easily maintainable if you use multi-digit sort orders and reserve the last digit for a numeral 1 through 4. Then you could extract that in the code (as a string) and apply it directly to the classname. Much easier to see than what the mod 4 of a number is going to be.

  2. #12
    Join Date
    Sep 2009
    Posts
    78
    Plugin Contributions
    0

    Idea or Suggestion Re: $box_categories_array[i]['sort_order'] ?

    Quote Originally Posted by gjh42 View Post
    You could rewrite category_tree.php to retrieve sort_order as well as ordering by it.
    OK I finally got it. sort_order is indeed there in the system (otherwise it wouldn't have worked, right?) but it is never stored in a variable. It is only stored in TABLE_CATEGORIES and used by SQL queries. Nice.

    BTW, sort_order is mentioned in 3 files only:
    1. modules/categories_tabs.php
    2. functions/functions_categories.php
    3. classes/category_tree.php

    Thank you very much for your help so far. You helped me finally understand what I was missing.

    It seems to me that all I need to do make sort_order retrievable is add a line to the following code snippet in category_tree.php:

    PHP Code:
        while (!$categories->EOF)  {
          
    $this->tree[$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'],
          
    'parent' => $categories->fields['parent_id'],
          
    'level' => 0,
          
    'path' => $categories->fields['categories_id'],
          
    'image' => $categories->fields['categories_image'],
          
    'next_id' => false); 
    Last edited by scatzc; 24 Aug 2010 at 04:39 PM. Reason: insight

  3. #13
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: $box_categories_array[i]['sort_order'] ?

    First you need to get the sort_order into $categories[].
    PHP Code:
        } else {
          
    $categories_query "select ptc.category_id as categories_id, cd.categories_name, c.parent_id, c.categories_image
                                 from " 
    TABLE_CATEGORIES " c, " TABLE_CATEGORIES_DESCRIPTION " cd, " TABLE_PRODUCT_TYPES_TO_CATEGORY " ptc
                                 where c.parent_id = 0
                                 and ptc.category_id = cd.categories_id
                                 and ptc.product_type_id = " 
    $master_type "
                                 and c.categories_id = ptc.category_id
                                 and cd.language_id=" 
    . (int)$_SESSION['languages_id'] ."
                                 and c.categories_status= 1
                                 order by sort_order, cd.categories_name"
    ;
        }
        
    $categories $db->Execute($categories_query''true150); 
    Add to
    "select ptc.category_id as categories_id, cd.categories_name, c.parent_id, c.categories_image, c.sort_order
    or maybe it should just be
    , sort_order
    since that is how it is used at the bottom of the query.

  4. #14
    Join Date
    Sep 2009
    Posts
    78
    Plugin Contributions
    0

    Idea or Suggestion Re: $box_categories_array[i]['sort_order'] ?

    Quote Originally Posted by gjh42 View Post
    or maybe it should just be
    , sort_order
    since that is how it is used at the bottom of the query.
    It's sort_order (without the 'c.' prefix), it should be added to all 4 queries (otherwise box_categories_array[$i]['sort_order'] is unassigned) and the following line should be added after the very similar 'image' one:
    PHP Code:
    // make category sort_order available in case needed
        
    $this->box_categories_array[$ii]['sort_order'] = $this->tree[$counter]['sort_order']; 
    I can't believe I was able to debug this without the superglobals addon (yes, it didn't go smoothly right from the start). Thanks again Glenn.

  5. #15
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: $box_categories_array[i]['sort_order'] ?

    Glad you got it working. We both learned something about the system here.

  6. #16
    Join Date
    Sep 2009
    Posts
    78
    Plugin Contributions
    0

    Idea or Suggestion Re: $box_categories_array[i]['sort_order'] ?

    Quote Originally Posted by scatzc View Post
    I wonder why the w3.org CSS validator didn't catch this.
    This mystery has been solved, too: The CSS validator should not catch this because the id duplication is not in the CSS file itself but in the HTML file(s) using it. Thus, the HTML validator should catch this (and it did!).

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 1
    Last Post: 29 Aug 2013, 05:57 AM
  2. sort_order in Configuration table insert
    By torvista in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 18 Oct 2008, 07:54 PM
  3. need help finding a core function $box_categories_Array
    By alienfactory in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Jul 2008, 05:08 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