Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2011
    Posts
    16
    Plugin Contributions
    0

    Default HIde categories mod with css dropdown menu

    I have hide categories mod installed and working.

    http://www.zen-cart.com/index.php?ma...roducts_id=391

    I also have the CSS drop-down menu, also working fine.

    http://www.zen-cart.com/index.php?ma...roducts_id=476

    I need to edit the dropdown menu mod so it only displays the categories it is supposed to display.

    Has anyone figured this one out yet?

    A.D.

  2. #2
    Join Date
    Jan 2011
    Posts
    16
    Plugin Contributions
    0

    Default Re: HIde categories mod with css dropdown menu

    I've determined that the file to edit is:
    includes/classes/categories_ul_generator.php
    Reading through this file, it seems to me that it makes a list of all the categories and then runs through a while loop and adds the <ul> and <li> tags to be read by the dropdown menu widget.
    Here's the original file.


    <?php
    //placeholder21// +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce |
    // +----------------------------------------------------------------------+
    // | Copyright(c) 2003 The zen-cart developers |
    // | |
    // | http://www.zen-cart.com/index.php |
    // | |
    // | Portions Copyright(c) 2003 osCommerce |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license, |
    // | that is bundled with this package in the file LICENSE, and is |
    // | available through the world-wide-web at the following url: |
    // | http://www.zen-cart.com/license/2_0.txt. |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to |
    // | [email protected] so we can mail you a copy immediately. |
    // +----------------------------------------------------------------------+
    // $Id: categories_ul_generator.php 2004-07-11 DrByteZen $
    // based on site_map.php v1.0.1 by networkdad 2004-06-04
    //


    class zen_categories_ul_generator {
    var $root_category_id = 0,
    $max_level = 0,
    $data = array(),
    $parent_group_start_string = '<ul%s>',
    $parent_group_end_string = '</ul>',
    $child_start_string = '<li%s>',
    $child_end_string = '</li>',
    $spacer_string = '
    ',
    $spacer_multiplier = 1;

    var $document_types_list = ' (3) ';
    // acceptable format example: ' (3, 4, 9, 22, 18) '

    function zen_categories_ul_generator($load_from_database = true)
    {
    global $languages_id, $db;
    $this->data = array();
    $categories_query = "select c.categories_id, cd.categories_name, c.parent_id
    from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
    where c.categories_id = cd.categories_id
    and c.categories_status=1 " .
    " and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
    " order by c.parent_id, c.sort_order, cd.categories_name";
    $categories = $db->Execute($categories_query);
    while (!$categories->EOF) {
    $this->data[$categories->fields['parent_id']][$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'], 'count' => 0);
    $categories->MoveNext();
    }
    }

    function buildBranch($parent_id, $level, $submenu=true, $parent_link='')
    {
    $result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level+1) . '"' : '' );

    if (($this->data[$parent_id])) {
    foreach($this->data[$parent_id] as $category_id => $category) {
    $category_link = $parent_link . $category_id;
    if (($this->data[$category_id])) {
    $result .= sprintf($this->child_start_string, ($submenu==true) ? ' class="submenu"' : '');
    } else {
    $result .= sprintf($this->child_start_string, '');
    }
    $result .= str_repeat($this->spacer_string, $this->spacer_multiplier * 1) . '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">';
    $result .= $category['name'];
    $result .= '</a>';

    if (($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
    $result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
    }
    $result .= $this->child_end_string;
    }
    }

    $result .= $this->parent_group_end_string;
    return $result;
    }

    function buildTree($submenu=false)
    {
    return $this->buildBranch($this->root_category_id, '', $submenu);
    }
    }
    ?>





    Here is the code I need to add to it:


    // Begin hideCategories code

    list($nada, $mycpath)= split('=', $box_categories_array[$i]['path']);

    $mycid = split('_', $mycpath);

    $categories_id = array_pop($mycid);

    $hide_status = $db->Execute("select visibility_status

    FROM " . TABLE_HIDE_CATEGORIES . "

    WHERE categories_id = " . $categories_id . "

    LIMIT 1");

    if ($hide_status->fields['visibility_status'] < 1) {

    // End hideCategories code

    I'm guessing the query to the database needs to be rewritten so that it gets all the information for each category at the same, then the loop needs to have the line if ($hide_status->fields['visibility_status'] < 1) { in just the right place.

    can anyone give me a hint?

  3. #3
    Join Date
    Aug 2009
    Posts
    210
    Plugin Contributions
    1

    Default Re: HIde categories mod with css dropdown menu

    I also really need to get this working with the drop down mod.

 

 

Similar Threads

  1. CSS Dropdown menu for the header- With Categories!
    By jettrue in forum All Other Contributions/Addons
    Replies: 2344
    Last Post: 5 Mar 2020, 09:35 PM
  2. Categories dropdown menu/css
    By KenshiroU in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 5 Apr 2013, 01:04 PM
  3. Problem with CSS Dropdown menu
    By nicksab in forum General Questions
    Replies: 4
    Last Post: 24 Apr 2012, 05:48 PM
  4. CSS Horizontal Dropdown Menu With jquery
    By Ross_T in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 15 Sep 2011, 03:04 PM
  5. CSS Horizontal Dropdown Menu With jquery
    By HBELLC in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 15 Sep 2011, 01:00 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR