Forums / Templates, Stylesheets, Page Layout / Side Banners in selected categories

Side Banners in selected categories

Views: 668

Results 1 to 5 of 5
4 Apr 2011, 1:23 PM
#1
leest35 avatar

leest35

Zen Follower

Join Date:
May 2010
Location:
London UK
Posts:
134
Plugin Contributions:
0

Side Banners in selected categories

Hi all,

OK is it possible to add a side banner to only selected categories, for example i have a category in which we are promoting a specific product and would like to add a side banner. However i only want it to be displayed once people are in that category and not through out the whole site?

I have looked around Google but can not seem to find anything, which makes me think i probably can't, however anty ideas and advice would be gratefully appreciated.

Thanks

4 Apr 2011, 2:11 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Side Banners in selected categories

I would clone Banner Box 2 to something like Banner Box 3 ... then customize it to use, where the Category for it to show is categories_id 10:

if ($show_banner_box3 == true && $current_category_id == 10) {
  // show it
  $show_banner_box3 == true;
} else {
  // do not show it
  $show_banner_box3 == false;
}


  if ($show_banner_box3 == true) {

The code in RED would go above the code in BLACK ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

4 Apr 2011, 2:42 PM
#3
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,808
Plugin Contributions:
22

Re: Side Banners in selected categories

Yes, it can be done, but you'll have to edit the code directly.

For example, let's use your banner_box sidebox.

Open your includes/modules/sideboxes/banner_box.php

After line 1, add following:

if($_GET['main_page']=='index' and $_GET['cPath']=='YOUR_CATEGORY_ID'){

and then close it before the final ?> so it looks like

}
?>

Of course, replace YOUR_CATEGORY_ID with the category id you want it to show under.

Now, setup your banners normally as you always would. All banners that are assigned to banner_box will show only under your desired category.

My site - Pro ZC Help
My portfolio | My plugins

4 Apr 2011, 2:45 PM
#4
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,808
Plugin Contributions:
22

Re: Side Banners in selected categories

Or you can use Ajeh's way if you wanna do it the easier and cleaner way... :blush:

My site - Pro ZC Help
My portfolio | My plugins

4 Apr 2011, 2:49 PM
#5
leest35 avatar

leest35

Zen Follower

Join Date:
May 2010
Location:
London UK
Posts:
134
Plugin Contributions:
0

Re: Side Banners in selected categories

That's great thank you i will have a play and see how i get on, much appreciated.

Lee