How To Add more banner display groups?
I was looking for a way to add more banner display groups to my clients shop so I could track clicks on home page banners that are the main focus of the home page. While looking around the forums I could not find any info on how to do this so I am sharing my sollution here.
By default there are 9 display groups:
Code:
SHOW_BANNERS_GROUP_SET1
...
...
SHOW_BANNERS_GROUP_SET8
&
SHOW_BANNERS_GROUP_SET_ALL
1. Now how many new Banner display groups do you want? This is how many inserts you will need to make into your 'configuration' table.
2. Open up your database admin.
3. Insert your new banner display groups into the 'configuration' table, set values as follows (all blanks will be auto filled no need to enter a value:
Code:
configuration_id:
configuration_title: Banner Display Groups - 'New Group Name'
configuration_key: SHOW_BANNERS_GROUP_SET9 (The next set would be 10 and so on for each new group you add)
configuration_value: 'you will be able to set this is admin just like other banner groups'
configuration_description: The Banner Display Groups can be from 1 Banner Gro... (you can copy this from an existing banner group not vital for it to work)
configuration_group_id: 19 (this may be different for some see other groups it should be the same)
sort_order: 75 (I started with 75 and went up from there this could be changed)
last_modified:
date_added:
use_function:
set_function:
You have now added xx number of new banner group sets good job.
4. In the admin go to configuration -> Layout Settings. You will now see your new banner display groups here and you can set the banner display groups just as you would with the preinstalled groups. Add your banners in Tools -> Banner Manager just as you normaly would.
5. Now to add the banners to your template you must enter this code in your template where you want each group displayed.
PHP Code:
<?php
//You will have to change 'SHOW_BANNERS_GROUP_SET9' for each different group you added to display the proper banners
if (SHOW_BANNERS_GROUP_SET9 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET9))
{
if ($banner->RecordCount() > 0)
{
echo zen_display_banner('static', $banner);
}
}?>
6. Your banners are now placed and you can track their performance.
See how I implemented it on http://www.aikenskincare.us. All of the main home page images are banners so I can track which ones users click on, very useful.
Hope this helps some people.
Re: How To Add more banner display groups
NOTE: be careful on the use of the directory /banners for your images ...
Some popup blockers such as Norton Security etc. can block these banners based on the path to the images ...
This is always something to check on your site to ensure half your site isn't shut off when utilizing banners ...
Re: How To Add more banner display groups
Thank you I had no idea some security software would block a certian directory. This is even true when they are not pop-ups?
Re: How To Add more banner display groups
Depends on the configuation of the security software ...
Re: How To Add more banner display groups
Cuda,
Thanks for your tip, this helped me enormously with adding a cluster of three banners on the main page instead of just one big banner. Since I am still a beginner with zencart and web design, it took me quite a while to figure out how to do this, even with your instructions. I will post the details of my solution just in case it can help someone further:
First, I added the new banner groups to the database as described by Cuda. I use MAMP for development, so I went to the phpMyAdmin page (not part of Zen Cart) and selected my database. I clicked on the Configuration link on at the top.
http://homepage.mac.com/fbroz/zcart/myPhpAdmin.png
I inserted the first banner with these values (yours may be different!)
Code:
configuration_id:
configuration_title: Banner Display Groups - 'Top Right Main'
configuration_key: SHOW_BANNERS_TOP_RIGHT_MAIN
configuration_value:
configuration_description: The Banner Display Groups can be from 1 Banner Group or Multiple Banner Groups<br /><br />For Multiple Banner Groups enter the Banner Group Name separated by a colon <strong>:</strong><br /><br />Example: Wide-Banners:SideBox-Banners<br /><br />What Banner Group(s) do you want to use in the Header Position 3?<br />Leave blank for none
configuration_group_id: 19
sort_order: 75
last_modified:
date_added:
use_function:
set_function:
Then I inserted the next banner with very similar values:
Code:
configuration_id:
configuration_title: Banner Display Groups - 'Bottom Right Main'
configuration_key: SHOW_BANNERS_BOTTOM_RIGHT_MAIN
configuration_value:
configuration_description: The Banner Display Groups can be from 1 Banner Group or Multiple Banner Groups<br /><br />For Multiple Banner Groups enter the Banner Group Name separated by a colon <strong>:</strong><br /><br />Example: Wide-Banners:SideBox-Banners<br /><br />What Banner Group(s) do you want to use in the Header Position 3?<br />Leave blank for none
configuration_group_id: 19
sort_order: 85
last_modified:
date_added:
use_function:
set_function:
http://homepage.mac.com/fbroz/zcart/tableinsert.png
Next, I modified the /includes/templates/<template name>/common/tpl_main_page.php file to place the new banner groups where I wanted them. My code looked like this:
Code:
<?php
if ($this_is_home_page and SHOW_BANNERS_GROUP_SET3 != '' && ($banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) && ($bannert = zen_banner_exists('dynamic', SHOW_BANNERS_TOP_RIGHT_MAIN)) && ($bannerb = zen_banner_exists('dynamic', SHOW_BANNERS_BOTTOM_RIGHT_MAIN))) {
if ($banner->RecordCount() > 0) {
?>
<!-- my custom banner wrapper -->
<div id="mainBannerWrapper">
<!-- existing template code -->
<div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
<!-- wrapper for the two banners on the right -->
<div id="rightBannerWrapper">
<!-- new banner groups -->
<div class="rightBanners"><?php echo zen_display_banner('static', $bannert); ?></div>
<div class="rightBanners"><?php echo zen_display_banner('static', $bannerb); ?></div>
<!-- close rightBannerWrapper-->
</div>
<!-- this fixes layout problems AFTER the banner cluster -->
<div style="clear:both;"></div>
<!-- close mainBannerWrapper -->
</div>
<?php
}
}
?>
I added a wrapper for the whole banner cluster called "mainBannerWrapper"
mainBannerWrapper contains the main banner on the left and another wrapper on the right for the two smaller banners. The main banner on the left is the original bannerThree that Zen Cart originally put in this location. That line is unchanged.
The rightBannerWrapper is something I added to hold the two new banner groups that I added to the database, those get their own divs.
Below that is a "clear: both". without it, the content below this section flys off to the right instead of falling down below.
We still have to edit the css file so that everything gets positioned correctly.
Here are my changes to the css file (Your changes will probably be different!)
Code:
/* Removed #bannerThree from below to remove the padding. */
#bannerOne, #bannerTwo, #bannerFour, #bannerFive, #bannerSix {
padding:.8em;
}
#bannerTRM {
float:top;
}
#bannerBRM {
float:bottom;
}
#rightBannerWrapper {
float:right;
width:180px;
}
#bannerThree {
width:550px;
float:left;
}
#bannerClusterWrapper {
width:730px;
margin:0 auto;
}
Finally, you must also turn on the banners in Layout Manager by adding a banner group to them:
http://homepage.mac.com/fbroz/zcart/layoutmanager.png
Hope this helps anyone out there adding new banner display groups.
Frank
Re: How To Add more banner display groups
Thanks fbroz for your extra details I have found using banners to be a very effective inner site marketing tool and much easier to manage changes on the home page....
cheers
Re: How To Add more banner display groups
Hi Cuba,
Your solution is perfect.
One thing I have trouble with, is to make the "new banner group" display on the left column.
Could you please help me understand where I should place it inside the "tpl_main_page.php" in order to appear on the left side column ?
Thank you for a great contribution.
Re: How To Add more banner display groups
Quote:
Originally Posted by
Alex123
Hi Cuba,
Your solution is perfect.
One thing I have trouble with, is to make the "new banner group" display on the left column.
Could you please help me understand where I should place it inside the "tpl_main_page.php" in order to appear on the left side column ?
Thank you for a great contribution.
First it's Cu'd'a :smile: not CU'B'A the country or Gooding Jr......
To add a new banner group in your main template to a side column you need to just insert something like this in your columns where you would like it to appear:
Code:
if (SHOW_BANNERS_GROUP_SET10 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET10))
{
if ($banner->RecordCount() > 0)
{
echo zen_display_banner('static', $banner);
}
}
and change the "SET10" to the correct number.
or you could create a new sidebox, there are many explanations of this look here at the wiki:
http://www.zen-cart.com/wiki/index.php/Tutorial
Hope that helps
Cuda
Re: How To Add more banner display groups
Sorry Cuda for changing your name :oops:
Thank you for the explanation, its a great contibution :clap:
Re: How To Add more banner display groups
No worries actually gave me a laugh :laugh:....Glad this was helpful for you. If you have any insight or tricks that helped you with this post them here to help others