Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    989
    Plugin Contributions
    5

    red flag Display Information on Products inside a category only

    [Note: remember to include site URL, ZC version, list of plugins, PHP version, etc ... read the Posting Tips shown above for information to include in your post here. And, remove this comment before actually posting!]

    I need to display some information on all products inside a category and all the sub categories products inside that category only. How do I do this?
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  2. #2
    Join Date
    Feb 2009
    Location
    UK
    Posts
    745
    Plugin Contributions
    0

    Default Re: Display Information on Products inside a category only

    To add code based on a certain category I tend to use the code below.

    Code:
     <?php $cPath= zen_get_path((int)$_GET['current_category_id']);
     
     if ($cPath = '36_39') { ?>
           
    	   <div> [add code here]</div>
    	   
       <?php  
    	  } 
    ?>
    change the 36_39 to your category path.

    If you want to add the info to the product_info page of each product under a certain category then add the code to the tpl_product_info_display file (or similar file depending on the Product Type). If you want to add it to each product on the product_listing page then that's more complicated (and I don't have the answer to hand).
    Simon

  3. #3
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    989
    Plugin Contributions
    5

    red flag Re: Display Information on Products inside a category only

    Quote Originally Posted by simon1066 View Post
    To add code based on a certain category I tend to use the code below.

    Code:
     <?php $cPath= zen_get_path((int)$_GET['current_category_id']);
     
     if ($cPath = '36_39') { ?>
           
           <div> [add code here]</div>
           
       <?php  
          } 
    ?>
    change the 36_39 to your category path.

    If you want to add the info to the product_info page of each product under a certain category then add the code to the tpl_product_info_display file (or similar file depending on the Product Type). If you want to add it to each product on the product_listing page then that's more complicated (and I don't have the answer to hand).
    Yes would that do every product inside the sub categories (there are a few sub categories) of a top level category or would I need to do it as an array?
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  4. #4
    Join Date
    Feb 2009
    Location
    UK
    Posts
    745
    Plugin Contributions
    0

    Default Re: Display Information on Products inside a category only

    Ah yes I see now, not sure - that would be stretching the extent of my very limited php knowledge.
    Simon

  5. #5
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    989
    Plugin Contributions
    5

    red flag Re: Display Information on Products inside a category only

    Quote Originally Posted by simon1066 View Post
    Ah yes I see now, not sure - that would be stretching the extent of my very limited php knowledge.
    Ok no worries, yeah I already knew how to do that bit. There must be a way to do it though. I'm obviously trying to avoid writing a long array of category id's to target. But if it has to be done that way it does.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  6. #6
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    989
    Plugin Contributions
    5

    Default Re: Display Information on Products inside a category only

    Quote Originally Posted by simon1066 View Post
    Ah yes I see now, not sure - that would be stretching the extent of my very limited php knowledge.
    I don't suppose you know how you would write an array for this do you Simon?
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  7. #7
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    989
    Plugin Contributions
    5

    red flag Re: Display Information on Products inside a category only

    Quote Originally Posted by Nick1973 View Post
    I don't suppose you know how you would write an array for this do you Simon?
    Its ok Simon, I've just done this with c_176_children.css and .mystyle {display:none;} in the stylesheet...176 being the top level category number. Not ideal as I would have preferred a PHP method but it works.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

 

 

Similar Threads

  1. v153 Display text on products in certain category only
    By abcisme in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 6 Mar 2015, 06:55 PM
  2. How to display products inside a defined page?
    By whosleonard in forum General Questions
    Replies: 3
    Last Post: 7 Mar 2011, 04:23 PM
  3. Need to display Zen-cart products inside a div
    By Ryan Greenlife in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 13 Dec 2009, 04:10 PM
  4. Replies: 0
    Last Post: 22 Apr 2009, 05:07 PM
  5. Category with no products dont display"There are no products to list in this category
    By atracksler in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 3 Apr 2008, 05:47 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