Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Feb 2016
    Posts
    11
    Plugin Contributions
    0

    Default Show subcats + products

    Hi everyone. I have a little problem with products in subcategories. I will try to explain you.
    For example I have main category with subcategories.
    Main category
    - Subcat 1
    - Subcat 2
    - Subcat 3
    And when I click on “ main category” it shows tabs with subcategories.
    I found this addon:
    https://www.zen-cart.com/attachment....6&d=1357113131
    And now when I click on “main category” it shows all products from subcategories, but doesn`t show subcategories tabs.

    That what I want is to show subcategories tabs above and products from this subcategories below.
    I think that part of code is the key:

    if(!empty($sub_cats))
    $categories_products_query = "SELECT count(*) AS total
    FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "
    WHERE categories_id IN ($sub_cats)";
    else
    // eof all_sub_cats_products
    $categories_products_query = "SELECT count(*) AS total
    FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "
    WHERE categories_id = :categoriesID";

    This code is in - includes/modules/pages/index/header_php. (line from 22 to 30)

    I use ZC 1.5.0
    Thanks!

  2. #2
    Join Date
    Feb 2016
    Posts
    11
    Plugin Contributions
    0

    Default Re: Show subcats + products

    Can anybody help me ? Pls? I want to show subcats tabs and products at the same time when i click on the main category. What must I change at the code to shows that what I want? Pls Help me?

  3. #3
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Show subcats + products

    This is a little more involved than just saying "do this". There are templates that have incorporated such action, and they may be a good starting point. There are other things to consider on the presentation side such as are there going to be fly out menus, which way, what if they are really long, etc...

    Primarily what is needed is to track the structure of the categories from the "root", then as a category is presented to identify if there are product in that category and what sub-category(ies) exist off of that. Continue until at the end of the last category and/or set of products.... If your setup will only have product at the end of a category branch, then the code is a little simpler, but you'll be limiting what can happen/be displayed.

    The code snippet identified above merely addresses the number of things to address, not necessarily how that is then used/broken down. The header file will provide data applicable for use in the template file(s)/module(s) invoked to present the data. Just remember that unless the tree gets trimmed on various selections/navigation that that data will be sent with each page load and tied to an efficiencies of navigating the site...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Feb 2016
    Posts
    11
    Plugin Contributions
    0

    Default Re: Show subcats + products

    So... you telling me that what i want is too difficult to make?

  5. #5
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Show subcats + products

    Quote Originally Posted by GhouL View Post
    So... you telling me that what i want is too difficult to make?
    Not too difficult to make. Maybe too difficult for me to type/copy all of the code using my cell phone. Would take longer to do from scratch when there are already templates and potentially partial templates that do this. Using the code changes of such a template, the applicable parts could be used/applied to your site. Yes, I know the next thing is to know where it is already factored. Otherwise I believe I provided the logic above that could be used to obtain the result requested. My only thing was an offering to consider the results, full implementation, and effect of implementing.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Feb 2016
    Posts
    11
    Plugin Contributions
    0

    Default Re: Show subcats + products

    Ok, thanks "mc12345678"! I understand it`s difficult to make with cell phone, but can someone else who has free time to help me ?

 

 

Similar Threads

  1. Question about Categories set up - how can I show products from subcats in parent?
    By touchclothing in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Aug 2009, 06:25 PM
  2. How can I show products on Cat with subCats page
    By bumba000 in forum General Questions
    Replies: 2
    Last Post: 12 Jan 2008, 10:23 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