Zen Cart Logo
Forums / General Questions / Display different image and link in sidebox depending on category displayed

Display different image and link in sidebox depending on category displayed

Views: 733

Results 1 to 2 of 2
6 Jan 2011, 6:53 PM
#1
tjb avatar

tjb

New Zenner

Join Date:
Feb 2008
Location:
Illinois
Posts:
54
Plugin Contributions:
0

Display different image and link in sidebox depending on category displayed

I was wondering if there is a way I could control what image and link is displayed in a sidebox depending on what category is currently being displayed.

Example:

If Category 1 is being displayed
display image1.jpg and link1.jpg

If Category 2 is being displayed
display image2.jpg and link2.jpg

etc.

7 Jan 2011, 4:37 AM
#2
tjb avatar

tjb

New Zenner

Join Date:
Feb 2008
Location:
Illinois
Posts:
54
Plugin Contributions:
0

Re: Display different image and link in sidebox depending on category displayed

Ok.. figured it out... I created a sidebox file in the
includes/modules/sideboxes/ directory called sub.php ...

and added the following code into the php file:

<?php if ($cPath == '7') { $content='<div style="margin-top:8px;"><a href="http://www. sub 1 .com "><img src="includes/templates/links/images/sub3.jpg" /></a></div>'; echo $content; } else if ($cPath == '4') { $content='<div style="margin-top:8px;"><a href="https://www. sub 2.com"><img src="includes/templates/links/images/sub1.jpg" /></a></div>'; echo $content; }else { $content='<div style="margin-top:8px;"><a href="https://www. other .com"><img src="includes/templates/links/images/sub2.jpg" /></a></div>'; echo $content; } ?>

This changes the sidebox image and link depending on the category that is being displayed... kind of like a sponsor image/link changer that is associated with the category/products.