Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2006
    Posts
    213
    Plugin Contributions
    0

    Default How do I disable banners on selected pages?

    I only want certain banners to appear on selected pages. I know how to disable the right and left columns in tpl_main_page.php but I don't find any $flag_disable_banner function or similar. I guess I could wrap the banner display code in a conditional and use a array similar to the one for the side boxes, but is there a simpler way I'm missing?? And where do you suggest doing it? In tpl_main_page.php or tpl_footer.php or in some banner file?
    I guess I know just enough php to be dangerous

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: How do I disable banners on selected pages?

    You know just enough PHP to come up with the right answer.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Jul 2006
    Posts
    213
    Plugin Contributions
    0

    Default Re: How do I disable banners on selected pages?

    Kuroi,
    I am using Banner Displays Groups - Footer Position 2 (Banners_Group_Set5), so I added the conditional statement to /MYTEMPLATE/common/tpl_footer.php.
    <?php
    if (in_array($current_page_base,explode(",",'shopping_cart,checkout_shipping,checko ut_payment,checkout_confirmation,checkout_success')) || ($this_is_home_page)) {
    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
    } } }
    ?>
    It worked quite well. Then I realized that ALL the pages where I want the banner to appear are SSL pages. Is there a flag I could use instead of the list of pages to designate all the pages which are SSL? I tried if(ENABLE_SSL == 'true') and if($connection == 'SSL') but neither of those worked.

  4. #4
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: How do I disable banners on selected pages?

    Quote Originally Posted by mauryg View Post
    Is there a flag I could use instead of the list of pages to designate all the pages which are SSL?
    Try $request_type and test against 'SSL' or 'NONSSL'. Will only work if SSL is actually enabled, otherwise will always return 'NONSSL'.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #5
    Join Date
    Jul 2006
    Posts
    213
    Plugin Contributions
    0

    Default Re: How do I disable banners on selected pages?

    Thanks Kuroi,
    the $request_type == 'SSL' worked perfectly. The 'banner' I'm displaying is a collection of various security seals. Makes sense that they really only need to be displayed on SSL pages.

  6. #6
    Join Date
    Apr 2006
    Location
    Fort Bragg, North Carolina
    Posts
    153
    Plugin Contributions
    0

    Default Re: How do I disable banners on selected pages?

    How exactly do you make this work, I added the code:

    <?php
    if (in_array($current_page_base,explode(",",'shopping _cart,checkout_shipping,checkout_payment,checkout_ confirmation,checkout_success')) || ($this_is_home_page)) {
    if (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {
    if ($banner->RecordCount() > 0) {
    ?><div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
    }
    }
    }
    ?>


    to my tpl_main_page.php but my banner still shows. Is there something I'm missing. I think I should add the code: if ($this_is_home_page) { but I don't know where to add it or the complete code. Any help on this?

    Thanks

  7. #7
    Join Date
    Jul 2006
    Posts
    213
    Plugin Contributions
    0

    Default Re: How do I disable banners on selected pages?

    bigjoed,
    The code whiich I used and you copied is to set the banner to SHOW the banner only on the pages listed. The statement says if you are on one of the pages in the array OR you are on the home page, then if the banner is active, SHOW IT. If I understand your question, you are trying to turn OFF the banner on certain pages. Then you would use:
    Code:
    <?php
    if (!in_array($current_page_base,explode(",",'shopping _cart,checkout_shipping,checkout_payment,checkout_ confirmation,checkout_success')) || ($this_is_home_page == 'false')) {
    if (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {
    if ($banner->RecordCount() > 0) {
    ?><div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
    }}}
    ?>
    In my case, I wanted the banner to show ONLY on the secure SSL pages, so all I needed was if($request_type == 'SSL').
    BTW, YOu should be doing this on a copy of tpl_main_page.php in the override directory??

  8. #8
    Join Date
    Apr 2006
    Location
    Fort Bragg, North Carolina
    Posts
    153
    Plugin Contributions
    0

    Default Re: How do I disable banners on selected pages?

    Thanks for your reply.

    I'm still having problems, regardless which code I insert on my tpl_main_page in order to disable or enable the banner, it still shows on all pages.

    My intention is for the banner not to show on some specific pages. Is there some additional code that I'm missing. The code you gave me:

    <?php
    if (!in_array($current_page_base,explode(",",'shopping _cart,checkout_shipping,checkout_payment,checkout_ confirmation,checkout_success')) || ($this_is_home_page == 'false')) {
    if (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {
    if ($banner->RecordCount() > 0) {
    ?><div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
    }}}
    ?>

    is the only code I added for the purpose of disabling the banner. I have other modifications on that file but nothing that I think would create a conflict.

    Thanks for your help

  9. #9

    Default Re: How do I disable banners on selected pages?

    Is it possible to disable the banner for certain categories?

  10. #10
    Join Date
    Apr 2008
    Location
    Flint, Michigan
    Posts
    687
    Plugin Contributions
    0

    Default Re: How do I disable banners on selected pages?

    I am using bannerThree. I am trying to get banners NOT to show on login, shopping cart, checkout, etc.

    I copied code, but did not work.

    <?php
    if (!in_array($current_page_base,explode(",",'shopping _cart,checkout_shipping,checkout_payment,checkout_ confirmation,checkout_success')) || ($this_is_home_page == 'false')) {
    if (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {
    if ($banner->RecordCount() > 0) {
    ?><div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
    }}}
    ?>

 

 

Similar Threads

  1. Disable Banners On Specific Pages
    By PatF in forum Basic Configuration
    Replies: 3
    Last Post: 1 Sep 2011, 05:07 PM
  2. Side Banners in selected categories
    By leest35 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 4 Apr 2011, 03:49 PM
  3. How to enable category listing for selected pages only?
    By ak6000 in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 11 Jun 2010, 09:05 PM
  4. How do I disable paypal if another shipping method is selected?
    By soskuthy in forum Built-in Shipping and Payment Modules
    Replies: 9
    Last Post: 11 Jul 2009, 04:34 PM
  5. How to Disable Add to Cart if no Attribute is Selected?
    By Stenrique in forum Setting Up Categories, Products, Attributes
    Replies: 27
    Last Post: 29 Jun 2007, 03:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR