Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2010
    Posts
    45
    Plugin Contributions
    1

    Default Is there any way of adding products to a category with subcategories?

    I have a category with subcategories.

    Is there any way of adding products to that category?




    Chaiavi

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Is there any way of adding products to a category with subcategories?

    Yes, but it's strongly recommended that you don't do that, as it can cause all sorts of problems with your product listings.

    See post #4 here:

    http://www.zen-cart.com/forum/showthread.php?t=166416

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

    Default Re: Is there any way of adding products to a category with subcategories?

    The most visible problem is that, if there are products and subcats in a category, that category's listing will only show the products and not the subcats. This will make navigation different from other categories and may cause confusion for users.

  4. #4
    Join Date
    Dec 2010
    Posts
    45
    Plugin Contributions
    1

    Default Re: Is there any way of adding products to a category with subcategories?

    I understand.


    Please, let me elaborate:

    I don't want to insert regular products, I want to have articles related to a specific category which has subcategories.

    My problem is that the articles which I want to appear in the sidebox only for that category are from type "document general" hence are considered as products, hence cannot be inserted into the category which has subcategories.


    can I do it somehow?

    Is there any other way?


    THE ACTUAL DILLEMA:
    How can I show a sidebox with articles only per a specific category and all of its subcategories.




    Chaiavi

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

    Default Re: Is there any way of adding products to a category with subcategories?

    That is no problem. It will take a bit of custom code in the documents sidebox file to filter the display based on the current top product category, but that is not difficult. I can take time to help with that tomorrow, if nobody else has time before then.

    First, you would set Configuration > Layout Settings > Split Categories Box -> true, and enable the documents sidebox in Tools > Layout Boxes Controller.
    You would probably want to create one "document type" category for each article, or maybe group some articles depending on what organization makes sense.
    Then edit the sidebox file to add the filter.

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

    Default Re: Is there any way of adding products to a category with subcategories?

    I envision a filter starting like
    PHP Code:
    $skip_cat 1;
    $current_doc str_replace('cPath=','',$box_categories_array[$i]['path']);
    if(
    in_array((int)$_GET['cPath'], explode(',','list_of_top_cats,separated_by_commas,and_no_spaces')) and (in_array($current_docexplode(',','list_of_doc_cats,separated_by_commas,and_no_spaces'))) {
      
    $skip_cat 0;
    } elseif (
    in_array((int)$_GET['cPath'], explode(',','second_list_of_top_cats,separated_by_commas,and_no_spaces')) and (in_array($current_docexplode(',','second_list_of_doc_cats,separated_by_commas,and_no_spaces'))) {
      
    $skip_cat 0;

    Repeat }elseif(){ lines for as many document groups as needed, and put

    $skip_cat or

    into the display filter test.

    This may need tweaking, but I think the approach will work.
    Last edited by gjh42; 8 Dec 2010 at 10:55 PM.

  7. #7
    Join Date
    Dec 2010
    Posts
    45
    Plugin Contributions
    1

    Default Re: Is there any way of adding products to a category with subcategories?

    Wow, you are totally zenned :-)


    I am a new zenner, and most of the things you wrote I didn't understand (although I know some php).

    1. Which file should I edit?

    2. Into which line should I put the code? (I use the latest ZC).

    3. Can you PLEASE add a sentance or two about the logic of what you advise here?



    Thank you so much,
    I really appreciate it,
    Chaiavi

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

    Default Re: Is there any way of adding products to a category with subcategories?

    /includes/templates/your_template/sideboxes/tpl_document_categories.php

    Around line 14, just after
    PHP Code:
      for ($i=0;$i<sizeof($box_categories_array);$i++) { 
    add this
    PHP Code:
    $show_cat 0;
    $current_doc str_replace('cPath=','',$box_categories_array[$i]['path']);
    if(
    in_array((int)$_GET['cPath'], explode(',','list_of_top_cats,separated_by_commas,and_no_spaces')) and (in_array($current_docexplode(',','list_of_doc_cats,separated_by_commas,and_no_spaces'))) {
      
    $show_cat 1;
    } elseif (
    in_array((int)$_GET['cPath'], explode(',','second_list_of_top_cats,separated_by_commas,and_no_spaces')) and (in_array($current_docexplode(',','second_list_of_doc_cats,separated_by_commas,and_no_spaces'))) {
      
    $show_cat 1;
    }  

    if (
    $show_cat) {//show doc category 
    and add
    PHP Code:
        }// /show 
    just before
    PHP Code:
        }
          
    $content .= '</div>'
    at the end of the file to get
    PHP Code:
          $content .= '<br />';
        }
    // /show
        
    }
          
    $content .= '</div>'
    You will have to supply the category lists in the places shown.
    Last edited by gjh42; 9 Dec 2010 at 11:32 AM.

 

 

Similar Threads

  1. Replies: 8
    Last Post: 9 Jul 2013, 02:53 AM
  2. v139h Is there any way to batch all products types to documents?
    By gotyed in forum General Questions
    Replies: 5
    Last Post: 9 Mar 2012, 05:50 PM
  3. Is there any way to edit a category name?
    By meowhead in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 29 Dec 2008, 07:31 PM
  4. Category with products - Way of adding sub-categories?
    By skyegospel in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 24 Oct 2008, 11:49 AM
  5. Any way to skip steps when adding new Products with new Attributes +quantities?
    By Computer Candy in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 25 Oct 2007, 05:41 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