Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / How do i display certain banners on certain pages?

How do i display certain banners on certain pages?

Views: 819

Results 1 to 3 of 3
23 Aug 2011, 3:10 AM
#1
berserkey avatar

berserkey

New Zenner

Join Date:
Aug 2011
Posts:
5
Plugin Contributions:
0

How do i display certain banners on certain pages?

I have been trying to figure out for a couple days how to display certain banners on certain pages. I am thinking i should use if statements. I'd like to have If Category A,B, or C display Banner_Group_Set5. If Category D, E, or F display Banner_Group_set6.

any clues how i could reference the categories in the includes/templates/Custom/common/tpl_footer.php

23 Aug 2011, 1:49 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How do i display certain banners on certain pages?

Let's say you want Products in categories_id 10, 12 and 15 to be in Footer 2 ... SHOW_BANNERS_GROUP_SET5 ... use the code in red to place that limit ...

<!--bof-banner #5 display -->
<?php
if ( in_array($current_category_id, array(10, 12, 15)) ) { // limit to 10, 12 and 15
  if (SHOW_BANNERS_GROUP_SET5 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET5)) {
    if ($banner->RecordCount() > 0) {
?>
<div id="bannerFive" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
<?php
    }
  }
} // limit to 10, 12 and 15
?>
<!--eof-banner #5 display -->

NOTE: the $current_categories_id is the immediate categories_id that you are in ... if the $cPath is showing that is the categories_id on the right side ...

23 Aug 2011, 6:55 PM
#3
berserkey avatar

berserkey

New Zenner

Join Date:
Aug 2011
Posts:
5
Plugin Contributions:
0

Re: How do i display certain banners on certain pages?

Thanks. That worked out great.