Results 1 to 10 of 45

Hybrid View

  1. #1
    Join Date
    Dec 2003
    Location
    UPstate NY
    Posts
    440
    Plugin Contributions
    0

    help question How to make clicking a category display all its items under the category name??

    Customer wants clicking the category name in the category SIDEBOX to ALSO display list of category ITEMS underneath category name, how can this be done??

    E.g. If I have two categories, Books and Shoes, clicking Books should open the category page AND show all the book items for sale underneath Books.

    E.g.
    CATEGORIES
    Books
    Socks

    becomes

    CATEGORIES
    Books
    For Whom The Bell Tolls
    The Great Gatsby
    The Godfather
    Gone with the Wind
    Socks

    OR

    CATEGORIES
    Books
    Socks
    Argyle
    Plaid
    Polka Dot

    How can this be done??

    Thank you, Tom
    Last edited by tlyczko; 6 Feb 2013 at 12:51 AM.

  2. #2
    Join Date
    Dec 2003
    Location
    UPstate NY
    Posts
    440
    Plugin Contributions
    0

    Default Re: How to make clicking a category display all its items under the category name??

    Does anyone know how I could modify the "Expanded Category List" sidebox addon for my purpose??

    http://www.zen-cart.com/downloads.php?do=file&id=255

    I've tried it but it always displays all products in each category and we need to show the list only for the clicked / opened category...

    In my example above the example product names are supposed to be indented...

    Thank you, Tom
    Last edited by tlyczko; 6 Feb 2013 at 01:11 AM.

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

    Default Re: How to make clicking a category display all its items under the category name??

    If we can see it installed, we can tell if it is possible to do with CSS. If that won't work, you would need to do some PHP recoding.

  4. #4
    Join Date
    Dec 2003
    Location
    UPstate NY
    Posts
    440
    Plugin Contributions
    0

    help question Re: How to make clicking a category display all its items under the category name??

    ZC is presently running on localhost...and clicking the category must toggle on only that category's product list and leave the other categories alone.

    Expanded Categories always shows all products in each category, don't want this...

    I had an idea, I could try modifying the code in this addon: Click-Show-Hide Category Menu
    http://www.zen-cart.com/downloads.php?do=file&id=615

    I will look at that one tomorrow -- the description seems to do what I need but the queries would have to be modified to return products instead of subcategories...I will look at it and make a new post asking help with the requisite php modifications...fingers crossed.

    Thank you, Tom

  5. #5
    Join Date
    Dec 2003
    Location
    UPstate NY
    Posts
    440
    Plugin Contributions
    0

    Default Re: How to make clicking a category display all its items under the category name??

    It's categories_ul_generator.php in that addon which I'd like to know how to modify so it returns products per category instead of subcategories per category...anyone know???

    I *think* all I need to do is change this line: var $document_types_list = ' (3) '; // acceptable format example: ' (3, 4, 9, 22, 18) '??????
    but I do not know what number to put to have it return products not categories, what do the other possible values return??

    Code:
    class zen_categories_ul_generator {
      var $root_category_id = 0,
          $max_level = 6,
          $data = array(),
          $root_start_string = '',
          $root_end_string = '',
          $parent_start_string = '',
          $parent_end_string = '',
          $parent_group_start_string = '%s<ul>',
          $parent_group_end_string = '%s</ul>',
          $child_start_string = '%s<li>',
          $child_end_string = '%s</li>',
          $spacer_string = '',
          $spacer_multiplier = 1;
      var $document_types_list = ' (3) ';  // acceptable format example: ' (3, 4, 9, 22, 18) '
    
      function zen_categories_ul_generator() {
        global $languages_id, $db, $request_type;
        $this->server    = ((ENABLE_SSL == true && $request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER);
        $this->base_href = ((ENABLE_SSL == true && $request_type == 'SSL') ? DIR_WS_HTTPS_CATALOG : DIR_WS_CATALOG);
        $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) {
          $products_in_category = (SHOW_COUNTS == 'true' ? zen_count_products_in_category($categories->fields['categories_id']) : 0);
          $this->data[$categories->fields['parent_id']][$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'], 'count' => $products_in_category);
          $categories->MoveNext();
        }
    // DEBUG: These lines will dump out the array for display and troubleshooting:
    // foreach ($this->data as $pkey=>$pvalue) { 
    //   foreach ($this->data[$pkey] as $key=>$value) { echo '['.$pkey.']'.$key . '=>' . $value['name'] . '<br>'; }
    // }
      }
    another related thread but I don't fully understand the code:
    http://www.zen-cart.com/showthread.p...-modifications

    I just need to query the categories and return products instead of sub-categories, how do I do this??

    Thank you, Tom -- please advise if I should start a new thread for the above question...
    Last edited by tlyczko; 6 Feb 2013 at 02:17 AM.

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

    Default Re: How to make clicking a category display all its items under the category name??

    I do have a copy of the Expanded Category List (or Category List Box) files, so on looking at them, I see that there is code included in tpl_category_list_box.php to create the classes for tracking the current links, but it is not applied to the output. It would be a simpler matter to do this than to alter another mod which is not designed to handle products.

  7. #7
    Join Date
    Dec 2003
    Location
    UPstate NY
    Posts
    440
    Plugin Contributions
    0

    Default Re: How to make clicking a category display all its items under the category name??

    Quote Originally Posted by gjh42 View Post
    I do have a copy of the Expanded Category List (or Category List Box) files, so on looking at them, I see that there is code included in tpl_category_list_box.php to create the classes for tracking the current links, but it is not applied to the output. It would be a simpler matter to do this than to alter another mod which is not designed to handle products.
    Would you please offer some guidance upon how to 'applied to the output'?? in this mod?? I read the template code and don't see how/where to do this -- show only products for the current category page, not all category products.

    Maybe it is category_list.php to be modified somehow to only get products for the current category page??

    I'm not a skilled PHP programmer per se -- my experience is mostly making minor modifications to code, not writing new code from scratch

    I looked at Expanded Category -- it always shows all products per category, the requirement is to only show the products for the specific category PAGE -- that is if the category page is 1 (Books) show the book products but no other products in any other category, only other categories per se, if the category page is 2 (Socks) show only the sock products under Socks but no other products in any other category...to use the example I started with...

    Thank you, Tom

 

 

Similar Threads

  1. v151 How to display the last category name
    By Kevin205 in forum General Questions
    Replies: 6
    Last Post: 30 Oct 2013, 04:11 AM
  2. How to link the category name under featured products
    By newbie456 in forum General Questions
    Replies: 0
    Last Post: 8 Sep 2011, 09:38 AM
  3. Replies: 3
    Last Post: 12 Jun 2011, 06:26 AM
  4. how to add the optiona name(text type) to all products under a category?
    By mybiz9999 in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 7 Aug 2010, 04:24 AM
  5. Displaying category name under new items thumbnails
    By aeolidia in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 20 Dec 2006, 12:05 AM

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