Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default How Do I Wrap This Conditional Array in tpl_main_page.php?

    Hi All,

    I'm trying to enable left column in just one page... this one:

    http://www.limelites.co.uk/index.php...=shopping_cart

    In my tpl_main_page.php I have put this:

    PHP Code:
      if (in_array($current_page_base,explode(",",'shopping_cart_empty')) ) {
      
    $flag_enable_left true
    But it has no effect... what's wrong with my code?? Please??

    I can't use just shopping_cart as I don't want left box enabled in main shopping cart page, only the empty cart page :-)
    Last edited by limelites; 8 Apr 2009 at 01:35 AM.

  2. #2
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: How Do I Wrap This Conditional Array in tpl_main_page.php?

    Or even easier, is there a way to redirect all empty carts to my home page? I have the Empty Cart Manager installed and although I don't use it, there is a useful script in the tpl_shopping_cart_default.php:

    PHP Code:
    <!-- BEGIN Empty Cart Manager 1/1 -->
    <?php
    if (DISPLAY_EMPTY_CART_MANAGER == 0) {
    } else { 
    ?>
    <br />
    <div align=center>
    <script type="text/javascript">
    document.write('<?php echo REDIRECT_MESSAGE_EMPTY_CART?>');
    setTimeout( "window.location.href = '<?php echo zen_href_link(FILENAME_CART_MANAGER'''NONSSL'); ?>'", 5*1000 );
    </script>
    <noscript></noscript>
    </div>
    <?php

    ?>
    <!-- END Empty Cart Manager 1/1 -->
    This script redirects to a custom page, but how do I change this so it re-directs to my home page?
    Last edited by limelites; 8 Apr 2009 at 01:45 AM.

  3. #3
    Join Date
    Jul 2006
    Location
    Montreal, Canada
    Posts
    2,279
    Plugin Contributions
    0

    Default Re: How Do I Wrap This Conditional Array in tpl_main_page.php?

    the code provided is not part of zencart . so some modification needed.

    insert this code just before closing div at tpl_shopping_cart_default.php

    <!-- BEGIN Empty Cart Manager 1/1 -->
    <?php
    if ($show_display_shopping_cart_empty == 0) {
    } else {
    ?>
    <br />
    <div align=center>
    <script type="text/javascript">
    document.write('<?php echo REDIRECT_MESSAGE_EMPTY_CART; ?>');
    setTimeout( "window.location.href = '<?php echo HTTP_SERVER . DIR_WS_CATALOG ; ?>'", 5*1000 );
    </script>
    <noscript></noscript>
    </div>
    <?php
    }
    ?>
    <!-- END Empty Cart Manager 1/1 -->

    this will redirect to your home page in 5 second once cart gets empty

  4. #4
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: How Do I Wrap This Conditional Array in tpl_main_page.php?

    Hi Tony,

    Didn't get a chance to try your code as I solved it last night by installing the Empty Cart Manager and then editing these two files:

    tpl_shopping_cart_default..... changed the new coding to this:
    PHP Code:
    <!-- BEGIN Empty Cart Manager 1/1 -->
    <?php
    if (DISPLAY_EMPTY_CART_MANAGER == 0) {
    } else { 
    ?>
    <br />
    <div align=center>
    <script type="text/javascript">
    document.write('<?php echo REDIRECT_MESSAGE_EMPTY_CART?>');
    setTimeout( "window.location.href = '<?php echo zen_href_link(FILENAME_DEFAULT'''NONSSL'); ?>'", 3*1000 );
    </script>
    <noscript></noscript>
    </div>
    <?php

    ?>
    <!-- END Empty Cart Manager 1/1 -->

    cart_manager_defines..... customised language code to this:
    PHP Code:
            if (DISPLAY_EMPTY_CART_MANAGER == 2) {
              
    define('REDIRECT_MESSAGE_EMPTY_CART''You are being redirected to our home page<p><img src="http://www.limelites.co.uk/includes/templates/freetemplate2/images/ajax-loader.gif"></p><p><img src="http://www.limelites.co.uk/includes/templates/freetemplate2/images/white.jpg"></p>' );
            } 
    It's a sort of cheating solution that uses a large white .jpg to hide the page temporarily while the ajax.loader is displayed under the text... seems to work well though and I'm happy with it :-)

    Another solution that's come to light, might have been to edit the main file I was trying to use to enable the left column again, something like this should work (but has not been tested) - thanks s_t_e_v_e for the following suggestion which knowing you will almost certainly work:

    tpl_main_page.php....
    PHP Code:
      if (in_array($current_page_base,explode(",",'login,checkout,account,create_account')) ) {
      
    $flag_disable_left true;
      }
      
      if (
    in_array($current_page_base,explode(",",'login,account')) ) {
      
    $flag_disable_footer true;
      }
      
      if (
    in_array($current_page_base,explode(",",'login')) ) {
      
    $flag_disable_header true;
      }
      
      if (
    $current_page_base == 'shopping_cart' && $_SESSION['cart']->count_contents() > ) {
        
    $flag_disable_left true;
      } 

 

 

Similar Threads

  1. how do i access require($body_code) found in tpl_main_page.php?
    By tcarden in forum Customization from the Admin
    Replies: 2
    Last Post: 11 Dec 2012, 01:46 AM
  2. need html_header.php & tpl_main_page.php files
    By marvin in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 23 Nov 2011, 06:32 PM
  3. PHP help with broken tpl_main_page.php
    By HeresySnowboarding in forum General Questions
    Replies: 4
    Last Post: 18 Sep 2008, 07:48 PM
  4. How to add a static Banner to the tpl_main_page.php
    By djfranknitti in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 23 Jul 2008, 02:39 PM
  5. Replies: 1
    Last Post: 14 Mar 2008, 02:58 AM

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