Zen Cart Show Banners on Main Page Only

The zen cart banner manager is a powerful interface that allows you to easily add banners to your zen cart. By default, zen cart comes with 3 header banner groups, 3 footer banner groups, and 3 sidebox banner groups. Say that you have a special, sale, or announcement that you would like to draw your customers attention to when they first enter your store, but you don’t want the same banner to follow them throughout every page that they click on. This is good policy as it may negatively effect your conversion rates and frustrate shoppers to see the same banner over and over throughout your site. This Easy Help tutorial will show you how to add some custom php code to your zen cart files which will allow banners to only show on the main page of your site and not on the other pages.

In your favorite plain text editor open the includes/templates/override/common/tpl_main_page.php file. If you do not already have an override for this tile, create one by copying the includes/templates/template_default/common/tpl_main_page.php to the includes/templates/override/common/tpl_main_page.php.

Find this code:


<?php
              if (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) {
                if ($banner->RecordCount() > 0) {
?>

And change it to:


<?php
     if ($this_is_home_page && (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1))) {
                if ($banner->RecordCount() > 0) {
?>

Do this for each of the banner groups in the tpl_main_page.php, tpl_header.php, and tpl_footer.php files.

Save your changes and upload the files to your server making sure that you have specified to overwrite the file on your server. Navigate to your site and refresh the page to see the changes.

If you need help with your zen cart web site, absolute web solutions zen cart programmerplease contact us for a quote.

Picaflor Azul specializes in responsive zen cart design. Contact us to convert your current zen cart to a responsive design, or to have a fantastic new custom design made just for your business.

zen cart plus picaflor azul equals success

Leave a Reply