Results 1 to 10 of 20

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Category Mega Drop Down Menu Help

    Tried to PM you something but your inbox is full ;)
    Phil Rogers
    A problem shared is a problem solved.

  2. #2
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Category Mega Drop Down Menu Help

    Quote Originally Posted by philip937 View Post
    Tried to PM you something but your inbox is full ;)
    WHAT??? Let me clear that out now..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  3. #3
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Category Mega Drop Down Menu Help

    as promised, here is what I use, pretty sure you shouldn't need anything else. messy I know but does the job.

    I limit the number of categories by 8 in the sql query so if you don't want to just remove.

    so to set categories into their columns just set their sort orders, so
    sort order 1 = column 1
    sort order 2 = column 2 etc

    the code obviously doesn't suit all but I got it to do what I needed and so hopefully you can too. :)

    enjoy

    PHP Code:
    <li><a href="#" class="drop">Browse Categories</a><!-- Begin 5 columns Item -->
        
        <div class="dropdown_5columns"><!-- Begin 5 columns container -->
            <?php

        $categories_tab_query 
    "SELECT c.categories_id, cd.categories_name, c.sort_order FROM ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION " cd WHERE c.categories_id=cd.categories_id AND c.parent_id= '0' AND cd.language_id='" . (int)$_SESSION['languages_id'] . "' AND c.categories_status='1' ORDER BY c.sort_order, cd.categories_name LIMIT 0, 8;";
        
    $categories_tab $db->Execute($categories_tab_query);
        
    $countthis 1;
    $columnnumber 0;

    echo 
    '<div class="col_1">';

        while (!
    $categories_tab->EOF
        {




    $columnnumber $columnnumber $categories_tab->fields['sort_order'];

        
    //if ($columnnumber < 0 && countthis == "1") {
        //echo '<div class="col_1">';
        
            
    if ($columnnumber 0) {
            echo 
    '</div><div class="col_1">';
    }

                    
            if((int)
    $cPath == $categories_tab->fields['categories_id']) 
                echo 
    '<h3><a class="topcat" style="font-size:1em;" href="'.zen_href_link(FILENAME_DEFAULT,'cPath=' . (int)$categories_tab->fields['categories_id']).'">' $categories_tab->fields['categories_name'];  
            else 
                echo 
    '<h3><a class="topcat" style="font-size:1em;" href="'.zen_href_link(FILENAME_DEFAULT,'cPath=' . (int)$categories_tab->fields['categories_id']).'">' $categories_tab->fields['categories_name'];
                    echo 
    '</a></h3>';
            
            
    $subcategories_tab_query="SELECT c.categories_id, cd.categories_name FROM ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION " cd WHERE c.categories_id=cd.categories_id AND c.parent_id= '".(int)$categories_tab->fields['categories_id']."' AND cd.language_id='" . (int)$_SESSION['languages_id'] . "' AND c.categories_status='1' ORDER BY c.sort_order, cd.categories_name;";
            
    $subcategories_tab=$db->Execute($subcategories_tab_query);
            if(
    $subcategories_tab->RecordCount()>0)
            {
                echo 
    '<ul>';
                
                    while (!
    $subcategories_tab->EOF) {

                    
    $cPath_new='cPath=' $categories_tab->fields['categories_id'] . '_' $subcategories_tab->fields['categories_id'];
                    
    $cPath_new=str_replace('=0_''='$cPath_new);
                    echo 
    '<li>'.'<a class="sub-cat" href="' zen_href_link(FILENAME_DEFAULT$cPath_new) . '">'.$subcategories_tab->fields['categories_name'].'</a></li>';
                    
    $subcategories_tab->MoveNext();
                    
                    }

                echo 
    '</ul>';
            }
            

    $columnnumber $categories_tab->fields['sort_order'];

    $countthis $countthis 1;

            
    $categories_tab->MoveNext();
        }
            
    ?>

        </div>


    </div><!-- End 5 columns container -->
    Phil Rogers
    A problem shared is a problem solved.

  4. #4
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Category Mega Drop Down Menu Help

    Quote Originally Posted by philip937 View Post
    as promised, here is what I use, pretty sure you shouldn't need anything else. messy I know but does the job.

    I limit the number of categories by 8 in the sql query so if you don't want to just remove.

    so to set categories into their columns just set their sort orders, so
    sort order 1 = column 1
    sort order 2 = column 2 etc

    the code obviously doesn't suit all but I got it to do what I needed and so hopefully you can too. :)

    enjoy

    PHP Code:
    <li><a href="#" class="drop">Browse Categories</a><!-- Begin 5 columns Item -->
        
        <div class="dropdown_5columns"><!-- Begin 5 columns container -->
            <?php

        $categories_tab_query 
    "SELECT c.categories_id, cd.categories_name, c.sort_order FROM ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION " cd WHERE c.categories_id=cd.categories_id AND c.parent_id= '0' AND cd.language_id='" . (int)$_SESSION['languages_id'] . "' AND c.categories_status='1' ORDER BY c.sort_order, cd.categories_name LIMIT 0, 8;";
        
    $categories_tab $db->Execute($categories_tab_query);
        
    $countthis 1;
    $columnnumber 0;

    echo 
    '<div class="col_1">';

        while (!
    $categories_tab->EOF
        {




    $columnnumber $columnnumber $categories_tab->fields['sort_order'];

        
    //if ($columnnumber < 0 && countthis == "1") {
        //echo '<div class="col_1">';
        
            
    if ($columnnumber 0) {
            echo 
    '</div><div class="col_1">';
    }

                    
            if((int)
    $cPath == $categories_tab->fields['categories_id']) 
                echo 
    '<h3><a class="topcat" style="font-size:1em;" href="'.zen_href_link(FILENAME_DEFAULT,'cPath=' . (int)$categories_tab->fields['categories_id']).'">' $categories_tab->fields['categories_name'];  
            else 
                echo 
    '<h3><a class="topcat" style="font-size:1em;" href="'.zen_href_link(FILENAME_DEFAULT,'cPath=' . (int)$categories_tab->fields['categories_id']).'">' $categories_tab->fields['categories_name'];
                    echo 
    '</a></h3>';
            
            
    $subcategories_tab_query="SELECT c.categories_id, cd.categories_name FROM ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION " cd WHERE c.categories_id=cd.categories_id AND c.parent_id= '".(int)$categories_tab->fields['categories_id']."' AND cd.language_id='" . (int)$_SESSION['languages_id'] . "' AND c.categories_status='1' ORDER BY c.sort_order, cd.categories_name;";
            
    $subcategories_tab=$db->Execute($subcategories_tab_query);
            if(
    $subcategories_tab->RecordCount()>0)
            {
                echo 
    '<ul>';
                
                    while (!
    $subcategories_tab->EOF) {

                    
    $cPath_new='cPath=' $categories_tab->fields['categories_id'] . '_' $subcategories_tab->fields['categories_id'];
                    
    $cPath_new=str_replace('=0_''='$cPath_new);
                    echo 
    '<li>'.'<a class="sub-cat" href="' zen_href_link(FILENAME_DEFAULT$cPath_new) . '">'.$subcategories_tab->fields['categories_name'].'</a></li>';
                    
    $subcategories_tab->MoveNext();
                    
                    }

                echo 
    '</ul>';
            }
            

    $columnnumber $categories_tab->fields['sort_order'];

    $countthis $countthis 1;

            
    $categories_tab->MoveNext();
        }
            
    ?>

        </div>


    </div><!-- End 5 columns container -->
    You are awesome!!! Thanks for the share.. One question.. Am I reading this correctly.. If I set the category sort order to "1" it will appear in column 1?? It's THAT simple???????
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  5. #5
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Category Mega Drop Down Menu Help

    yup.

    so if you want three categories in column 1, set them all with a sort order 1 and so on.. that way if you have categories with differnt amounts of sub cats you can fasin them in a way so they fill the drop down box nicely.

    i dnt think it will work with negative values as sort orders though, just the way its coded.
    Phil Rogers
    A problem shared is a problem solved.

  6. #6
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Category Mega Drop Down Menu Help

    Quote Originally Posted by philip937 View Post
    yup.

    so if you want three categories in column 1, set them all with a sort order 1 and so on.. that way if you have categories with differnt amounts of sub cats you can fasin them in a way so they fill the drop down box nicely.

    i dnt think it will work with negative values as sort orders though, just the way its coded.
    Nice.. thanks for sharing!!!
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

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

    Default Re: Category Mega Drop Down Menu Help

    Same principle I used for EZ-Pages Footer Columns, to sort links into columns. One refinement you might try (to be able to sort within columns) is to sort for columns by first digit of sort order. This allows up to 9 per column (with 2-digit sort orders) to be specifically organized within the column.

 

 

Similar Threads

  1. v139h Mega Drop Down Menu
    By gazag in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 1 May 2012, 10:22 AM
  2. Horizontal Drop Menu sort order of mega-menu
    By familynow in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 19 Oct 2011, 04:39 PM
  3. Disabling Drop Down Category Menu
    By zdanhauer in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 18 Oct 2011, 09:35 PM
  4. Replies: 0
    Last Post: 28 Jul 2008, 09:59 PM

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