Forums / Templates, Stylesheets, Page Layout / Conditional Statement - Parent and Child Category Display Additional Information

Conditional Statement - Parent and Child Category Display Additional Information

Views: 1,602

Results 1 to 6 of 6
5 Feb 2011, 1:54 AM
#1
crlannen avatar

crlannen

New Zenner

Join Date:
Dec 2005
Posts:
19
Plugin Contributions:
0

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

5 Feb 2011, 9:51 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

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

5 Feb 2011, 3:52 PM
#3
crlannen avatar

crlannen

New Zenner

Join Date:
Dec 2005
Posts:
19
Plugin Contributions:
0

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.

5 Feb 2011, 4:10 PM
#4
crlannen avatar

crlannen

New Zenner

Join Date:
Dec 2005
Posts:
19
Plugin Contributions:
0

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 Feb 2011, 6:08 PM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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

<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.

6 Feb 2011, 3:13 AM
#6
crlannen avatar

crlannen

New Zenner

Join Date:
Dec 2005
Posts:
19
Plugin Contributions:
0

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

Thank you!! It worked like a charm.