Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2005
    Posts
    19
    Plugin Contributions
    0

    Default Conditional Statement - Parent and Child Category Display Additional Information

    I have a request to echo out a phone number for a primary category that will also display on each of the child categories, e.g., Bakery (parent) with child categories such as Cakes, Pies, etc. within the top navigation.

    It's not my design and the top navigation is hard coded as the website is not just ZC.

    Thanks!
    Chris

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Conditional Statement - Parent and Child Category Display Additional Information

    And we have no clue what or where the hard code is...
    Refer to the person who hard codded it
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Dec 2005
    Posts
    19
    Plugin Contributions
    0

    Default Re: Conditional Statement - Parent and Child Category Display Additional Information

    Quite frankly why did you even bothered to respond to my question. It doesn't make any difference whether or not it is currently hard coded or not.

    ZC is never, ever my recommendation for a shopping cart. Free is NOT EVER the best solution.

    So instead of:

    <li><a href="/bakery/">Bakery</a></li>


    <li>
    <?php if it's category Bakery or anyone of the child/subcategories or is a product page within the parent/child category

    echo out <a href="/bakery/">Bakery xxx-xxx-xxxx Ext. 1</a>endif; ?></li>



    I tried googling for even a hint of the appropriate ZC syntax with no luck.

  4. #4
    Join Date
    Dec 2005
    Posts
    19
    Plugin Contributions
    0

    Default Re: Conditional Statement - Parent and Child Category Display Additional Information

    <li>
    <?php if it's category Bakery or anyone of the child/subcategories or is a product page within the parent/child category

    echo out <a href="/bakery/">Bakery xxx-xxx-xxxx Ext. 1</a></li>

    else (if it's not one of the above)

    <li><a href="/bakery/">Bakery</a></li>

    endif; ?>

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

    Default Re: Conditional Statement - Parent and Child Category Display Additional Information

    PHP Code:
    <li><a href="/bakery/">Bakery<?php if((int)$_GET['cPath'] == 23) echo ' xxx-xxx-xxxx Ext. 1' ?></a></li>
    (int)$_GET['cPath'] strips the category path down to its first numerical portion, which is the top category id. Replace 23 with the appropriate category id.

    You find out the appropriate syntax for a given platform by studying its structure or by asking those who are familiar with it. It helps if you don't insult those who respond.
    We couldn't tell you how to get the number into your output without a clue as to what the output is, as you gave with your subsequent posts.
    Last edited by gjh42; 5 Feb 2011 at 07:12 PM.

  6. #6
    Join Date
    Dec 2005
    Posts
    19
    Plugin Contributions
    0

    Default Re: Conditional Statement - Parent and Child Category Display Additional Information

    Thank you!! It worked like a charm.

 

 

Similar Threads

  1. Replies: 7
    Last Post: 24 Nov 2012, 06:33 AM
  2. Parent / Child products?
    By sapphireweb in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 20 Nov 2011, 03:53 AM
  3. help with parent products and child products, how to seperate size and quantity?
    By blankman in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 20 Aug 2008, 03:04 AM
  4. Replies: 3
    Last Post: 20 Aug 2008, 02:50 AM
  5. Parent & Child Attributes
    By Shoreham1 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 26 Mar 2007, 04:10 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