Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Hide Available Shipping Methods table until Shipping Estimator runs

Hide Available Shipping Methods table until Shipping Estimator runs

Views: 10,113

Results 1 to 19 of 19
2 Aug 2012, 1:56 AM
#1
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Hide Available Shipping Methods table until Shipping Estimator runs

Client offers other flat rates along with UPS and doesn't want the Available Shipping Methods table to display on the
http: // yoursite(dot)com/index(dot)php? main_page=shopping_cart page until the shipping estimator rates are returned. Is this something easily achieved and does any one have a hint how to go about this??

21 Aug 2012, 3:24 PM
#2
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Hide Available Shipping Methods table until Shipping Estimator runs

DivaVocals:

Client offers other flat rates along with UPS and doesn't want the Available Shipping Methods table to display on the
http: // yoursite(dot)com/index(dot)php? main_page=shopping_cart page until the shipping estimator rates are returned. Is this something easily achieved and does any one have a hint how to go about this??
Hate to bump this, but I am stumped here.. Anyone got any ideas???

Here what the page looks like. Note that the Available Shipping Methods table displays.
[Attachment no longer available]

After you enter the location and postal code information then the rest of the shipping rates display.
[Attachment no longer available]

I want to know how NOT to display the entire Available Shipping Methods table until you enter the location and postal code information. This way all the available shipping methods are displayed together. (flat rates as well as UPS)

22 Aug 2012, 11:55 AM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Hide Available Shipping Methods table until Shipping Estimator runs

Give this a shot; it's a replacement for your /includes/templates/YOUR_TEMPLATE/templates/tpl_modules_shipping_estimator.php. There are two areas that were changed, just look for the //-bof and //-eof comments.

<?php
/**
 * Module Template - for shipping-estimator display
 *
 * @package templateSystem
 * @copyright Copyright 2003-2011 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_modules_shipping_estimator.php 18695 2011-05-04 05:24:19Z drbyte $
 */
?>
<div id="shippingEstimatorContent">
<?php echo zen_draw_form('estimator', zen_href_link($show_in, '', $request_type), 'post'); ?>
<?php echo zen_draw_hidden_field('scid', $selected_shipping['id']); ?>
<?php echo zen_draw_hidden_field('action', 'submit'); ?>
<?php
  if($_SESSION['cart']->count_contents()) {
    if ($_SESSION['customer_id']) {
?>
<h2><?php echo CART_SHIPPING_OPTIONS; ?></h2>


<?php if (!empty($totalsDisplay)) { ?>
<div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div>
<?php } ?>

<?php
    // only display addresses if more than 1
      if ($addresses->RecordCount() > 1){
?>
<label class="inputLabel" for="seAddressPulldown"><?php echo CART_SHIPPING_METHOD_ADDRESS; ?></label>
<?php echo zen_draw_pull_down_menu('address_id', $addresses_array, $selected_address, 'onchange="return shipincart_submit();" id="seAddressPulldown"'); ?>
<?php
      }
?>

<div class="bold back" id="seShipTo"><?php echo CART_SHIPPING_METHOD_TO; ?></div>
<address class="back"><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br />'); ?></address>
<br class="clearBoth" />
<?php
    } else {
?>
<h2><?php echo CART_SHIPPING_OPTIONS; ?></h2>
<?php if (!empty($totalsDisplay)) { ?>
<div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div>
<?php } ?>
<?php
      if($_SESSION['cart']->get_content_type() != 'virtual'){
?>

<label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
<?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" onchange="update_zone(this.form);"'); ?>
<br class="clearBoth" />

<label class="inputLabel" for="stateZone" id="zoneLabel"><?php echo ENTRY_STATE; ?></label>
<?php echo zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down($selected_country), $state_zone_id, 'id="stateZone"');?>
<br class="clearBoth" id="stBreak" />
<label class="inputLabel" for="state" id="stateLabel"><?php echo $state_field_label; ?></label>
<?php echo zen_draw_input_field('state', $selectedState, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40') . ' id="state"') .' <span class="alert" id="stText"> </span>'; ?>
<br class="clearBoth" />

<?php
        if(CART_SHIPPING_METHOD_ZIP_REQUIRED == "true"){
?>
<label class="inputLabel"><?php echo ENTRY_POST_CODE; ?></label>
<?php echo  zen_draw_input_field('zip_code', $zip_code, 'size="7"'); ?>
<br class="clearBoth" />
<?php
        }
?>
<div class="buttonRow forward"><?php echo  zen_image_submit(BUTTON_IMAGE_UPDATE, BUTTON_UPDATE_ALT); ?></div>
<br class="clearBoth" />
<?php
      }
    }
    if($_SESSION['cart']->get_content_type() == 'virtual'){
?>
<?php echo CART_SHIPPING_METHOD_FREE_TEXT .  ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS; ?>
<?php
    }elseif ($free_shipping==1) {
?>
<?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)); ?>
<?php
    }else{
//-bof-No display until country/state/zip are entered (1 of 2)
      if ($selected_country == 0 || ($selectedState == '' && $state_zone_id == 0) || $zip_code == '') {
	    if (!defined(TEXT_ENTER_ALL_VALUES)) define ('TEXT_ENTER_ALL_VALUES', 'Please select your country, state and zipcode so that we can can retrieve an accurate shipping estimate.');
	    echo '<p>' . TEXT_ENTER_ALL_VALUES . '</p>';
	  } else {
//-eof-No display until country/state/zip are entered (1 of 2)
?>
<table width="100%" border="1" cellpadding="2" cellspacing ="2">
<?php if ($_SESSION['customer_id'] < 1 ){ ?>
    <tr>
      <td colspan="2" class="seDisplayedAddressLabel">
        <?php echo CART_SHIPPING_QUOTE_CRITERIA; ?><br />
        <?php echo '<span class="seDisplayedAddressInfo">' . zen_get_zone_name($selected_country, $state_zone_id, '') . ($selectedState != '' ? ' ' . $selectedState : '') . ' ' . $order->delivery['postcode'] . ' ' . zen_get_country_name($order->delivery['country_id']) . '</span>'; ?>
      </td>
    </tr>
<?php } ?>
     <tr>
       <th scope="col" id="seProductsHeading"><?php echo CART_SHIPPING_METHOD_TEXT; ?></th>
       <th scope="col" id="seTotalHeading"><?php echo CART_SHIPPING_METHOD_RATES; ?></th>
     </tr>
<?php
      for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
        if(sizeof($quotes[$i]['methods'])==1){
          // simple shipping method
          $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][0]['id'];
?>
     <tr class="<?php echo $extra; ?>">
<?php
          if($quotes[$i]['error']){
?>
         <td colspan="2"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['error']; ?>)</td>
       </tr>
<?php
          }else{
            if($selected_shipping['id'] == $thisquoteid){
?>
         <td class="bold"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][0]['title']; ?>)</td>
         <td class="cartTotalDisplay bold"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])); ?></td>
       </tr>
<?php
            }else{
?>
          <td><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][0]['title']; ?>)</td>
          <td class="cartTotalDisplay"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])); ?></td>
       </tr>
<?php
            }
          }
        } else {
          // shipping method with sub methods (multipickup)
          for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
            $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][$j]['id'];
?>
    <tr class="<?php echo $extra; ?>">
<?php
            if($quotes[$i]['error']){
?>
         <td colspan="2"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['error']; ?>)</td>
       </tr>
<?php
            }else{
              if($selected_shipping['id'] == $thisquoteid){
?>
         <td class="bold"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td>
         <td class="cartTotalDisplay bold"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td>
       </tr>
<?php
              }else{
?>
        <td><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td>
        <td class="cartTotalDisplay"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td>
      </tr>
<?php
              }
            }
          }
        }
      }
?>
</table>
<?php
   }
//-bof-No display until country/state/zip are entered (2 of 2)
   }
//-eof-No display until country/state/zip are entered (2 of 2)
  }
?>
</form>
</div>
22 Aug 2012, 12:52 PM
#4
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Hide Available Shipping Methods table until Shipping Estimator runs

You are awesome!!!! This worked perfectly!!! thank you thank you thank you!!!!!!!!!!!!:clap:

lat9:

Give this a shot; it's a replacement for your /includes/templates/YOUR_TEMPLATE/templates/tpl_modules_shipping_estimator.php. There are two areas that were changed, just look for the //-bof and //-eof comments.

<?php /** * Module Template - for shipping-estimator display * * @package templateSystem * @copyright Copyright 2003-2011 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: tpl_modules_shipping_estimator.php 18695 2011-05-04 05:24:19Z drbyte $ */ ?> <div id="shippingEstimatorContent"> <?php echo zen_draw_form('estimator', zen_href_link($show_in, '', $request_type), 'post'); ?> <?php echo zen_draw_hidden_field('scid', $selected_shipping['id']); ?> <?php echo zen_draw_hidden_field('action', 'submit'); ?> <?php if($_SESSION['cart']->count_contents()) { if ($_SESSION['customer_id']) { ?> <h2><?php echo CART_SHIPPING_OPTIONS; ?></h2> <?php if (!empty($totalsDisplay)) { ?> <div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div> <?php } ?> <?php // only display addresses if more than 1 if ($addresses->RecordCount() > 1){ ?>

<label class="inputLabel" for="seAddressPulldown"><?php echo CART_SHIPPING_METHOD_ADDRESS; ?></label>

<?php echo zen_draw_pull_down_menu('address_id', $addresses_array, $selected_address, 'onchange="return shipincart_submit();" id="seAddressPulldown"'); ?> <?php } ?> <div class="bold back" id="seShipTo"><?php echo CART_SHIPPING_METHOD_TO; ?></div> <address class="back"><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br />'); ?></address> <br class="clearBoth" /> <?php } else { ?> <h2><?php echo CART_SHIPPING_OPTIONS; ?></h2> <?php if (!empty($totalsDisplay)) { ?> <div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div> <?php } ?> <?php if($_SESSION['cart']->get_content_type() != 'virtual'){ ?>

<label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>

<?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" onchange="update_zone(this.form);"'); ?> <br class="clearBoth" />

<label class="inputLabel" for="stateZone" id="zoneLabel"><?php echo ENTRY_STATE; ?></label>

<?php echo zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down($selected_country), $state_zone_id, 'id="stateZone"');?> <br class="clearBoth" id="stBreak" /> <label class="inputLabel" for="state" id="stateLabel"><?php echo $state_field_label; ?></label> <?php echo zen_draw_input_field('state', $selectedState, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40') . ' id="state"') .' <span class="alert" id="stText"> </span>'; ?> <br class="clearBoth" /> <?php if(CART_SHIPPING_METHOD_ZIP_REQUIRED == "true"){ ?>

<label class="inputLabel"><?php echo ENTRY_POST_CODE; ?></label>

<?php echo zen_draw_input_field('zip_code', $zip_code, 'size="7"'); ?> <br class="clearBoth" /> <?php } ?> <div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_UPDATE, BUTTON_UPDATE_ALT); ?></div> <br class="clearBoth" /> <?php } } if($_SESSION['cart']->get_content_type() == 'virtual'){ ?> <?php echo CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS; ?> <?php }elseif ($free_shipping==1) { ?> <?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)); ?> <?php }else{ //-bof-No display until country/state/zip are entered (1 of 2) if ($selected_country == 0 || ($selectedState == '' && $state_zone_id == 0) || $zip_code == '') { if (!defined(TEXT_ENTER_ALL_VALUES)) define ('TEXT_ENTER_ALL_VALUES', 'Please select your country, state and zipcode so that we can can retrieve an accurate shipping estimate.'); echo '<p>' . TEXT_ENTER_ALL_VALUES . '</p>'; } else { //-eof-No display until country/state/zip are entered (1 of 2) ?> <table width="100%" border="1" cellpadding="2" cellspacing ="2"> <?php if ($_SESSION['customer_id'] < 1 ){ ?> <tr> <td colspan="2" class="seDisplayedAddressLabel"> <?php echo CART_SHIPPING_QUOTE_CRITERIA; ?><br /> <?php echo '<span class="seDisplayedAddressInfo">' . zen_get_zone_name($selected_country, $state_zone_id, '') . ($selectedState != '' ? ' ' . $selectedState : '') . ' ' . $order->delivery['postcode'] . ' ' . zen_get_country_name($order->delivery['country_id']) . '</span>'; ?> </td> </tr> <?php } ?> <tr> <th scope="col" id="seProductsHeading"><?php echo CART_SHIPPING_METHOD_TEXT; ?></th> <th scope="col" id="seTotalHeading"><?php echo CART_SHIPPING_METHOD_RATES; ?></th> </tr> <?php for ($i=0, $n=sizeof($quotes); $i<$n; $i++) { if(sizeof($quotes[$i]['methods'])==1){ // simple shipping method $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][0]['id']; ?> <tr class="<?php echo $extra; ?>"> <?php if($quotes[$i]['error']){ ?> <td colspan="2"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['error']; ?>)</td> </tr> <?php }else{ if($selected_shipping['id'] == $thisquoteid){ ?> <td class="bold"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][0]['title']; ?>)</td> <td class="cartTotalDisplay bold"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php }else{ ?> <td><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][0]['title']; ?>)</td> <td class="cartTotalDisplay"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php } } } else { // shipping method with sub methods (multipickup) for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) { $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][$j]['id']; ?> <tr class="<?php echo $extra; ?>"> <?php if($quotes[$i]['error']){ ?> <td colspan="2"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['error']; ?>)</td> </tr> <?php }else{ if($selected_shipping['id'] == $thisquoteid){ ?> <td class="bold"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td> <td class="cartTotalDisplay bold"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php }else{ ?> <td><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td> <td class="cartTotalDisplay"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php } } } } } ?> </table> <?php } //-bof-No display until country/state/zip are entered (2 of 2) } //-eof-No display until country/state/zip are entered (2 of 2) } ?> </form> </div> ```
1 Jan 2013, 6:21 PM
#5
olcs avatar

olcs

New Zenner

Join Date:
Dec 2011
Posts:
92
Plugin Contributions:
0

Re: Hide Available Shipping Methods table until Shipping Estimator runs

Hi DivaVocals,

Are you able to tell me how you inserted you extra bullet pointed list beneath the available shipping options please? I too, would like to be able to some further guidance to make our shipping costs clearer.

Thanks

22 Aug 2013, 4:47 AM
#6
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Hide Available Shipping Methods table until Shipping Estimator runs

Hate to bump an old post, but I need some help.. Just discovered today that the shipping estimator does not work when a customer logs in. The ONLY modification to the shipping estimator was the code below. How does this need to be modified so that the shipping estimator will work when a customer is logged in as well??

ETA: I just tested what happens when I comment this code out.. the shipping estimator does display when logged in.. So I need help making the corrections to the modified code below so that the shipping estimator displays whether logged in or not..

lat9:

Give this a shot; it's a replacement for your /includes/templates/YOUR_TEMPLATE/templates/tpl_modules_shipping_estimator.php. There are two areas that were changed, just look for the //-bof and //-eof comments.

<?php /** * Module Template - for shipping-estimator display * * @package templateSystem * @copyright Copyright 2003-2011 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: tpl_modules_shipping_estimator.php 18695 2011-05-04 05:24:19Z drbyte $ */ ?> <div id="shippingEstimatorContent"> <?php echo zen_draw_form('estimator', zen_href_link($show_in, '', $request_type), 'post'); ?> <?php echo zen_draw_hidden_field('scid', $selected_shipping['id']); ?> <?php echo zen_draw_hidden_field('action', 'submit'); ?> <?php if($_SESSION['cart']->count_contents()) { if ($_SESSION['customer_id']) { ?> <h2><?php echo CART_SHIPPING_OPTIONS; ?></h2> <?php if (!empty($totalsDisplay)) { ?> <div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div> <?php } ?> <?php // only display addresses if more than 1 if ($addresses->RecordCount() > 1){ ?>

<label class="inputLabel" for="seAddressPulldown"><?php echo CART_SHIPPING_METHOD_ADDRESS; ?></label>

<?php echo zen_draw_pull_down_menu('address_id', $addresses_array, $selected_address, 'onchange="return shipincart_submit();" id="seAddressPulldown"'); ?> <?php } ?> <div class="bold back" id="seShipTo"><?php echo CART_SHIPPING_METHOD_TO; ?></div> <address class="back"><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br />'); ?></address> <br class="clearBoth" /> <?php } else { ?> <h2><?php echo CART_SHIPPING_OPTIONS; ?></h2> <?php if (!empty($totalsDisplay)) { ?> <div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div> <?php } ?> <?php if($_SESSION['cart']->get_content_type() != 'virtual'){ ?>

<label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>

<?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" onchange="update_zone(this.form);"'); ?> <br class="clearBoth" />

<label class="inputLabel" for="stateZone" id="zoneLabel"><?php echo ENTRY_STATE; ?></label>

<?php echo zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down($selected_country), $state_zone_id, 'id="stateZone"');?> <br class="clearBoth" id="stBreak" /> <label class="inputLabel" for="state" id="stateLabel"><?php echo $state_field_label; ?></label> <?php echo zen_draw_input_field('state', $selectedState, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40') . ' id="state"') .' <span class="alert" id="stText"> </span>'; ?> <br class="clearBoth" /> <?php if(CART_SHIPPING_METHOD_ZIP_REQUIRED == "true"){ ?>

<label class="inputLabel"><?php echo ENTRY_POST_CODE; ?></label>

<?php echo zen_draw_input_field('zip_code', $zip_code, 'size="7"'); ?> <br class="clearBoth" /> <?php } ?> <div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_UPDATE, BUTTON_UPDATE_ALT); ?></div> <br class="clearBoth" /> <?php } } if($_SESSION['cart']->get_content_type() == 'virtual'){ ?> <?php echo CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS; ?> <?php }elseif ($free_shipping==1) { ?> <?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)); ?> <?php }else{ //-bof-No display until country/state/zip are entered (1 of 2) if ($selected_country == 0 || ($selectedState == '' && $state_zone_id == 0) || $zip_code == '') { if (!defined(TEXT_ENTER_ALL_VALUES)) define ('TEXT_ENTER_ALL_VALUES', 'Please select your country, state and zipcode so that we can can retrieve an accurate shipping estimate.'); echo '<p>' . TEXT_ENTER_ALL_VALUES . '</p>'; } else { //-eof-No display until country/state/zip are entered (1 of 2) ?> <table width="100%" border="1" cellpadding="2" cellspacing ="2"> <?php if ($_SESSION['customer_id'] < 1 ){ ?> <tr> <td colspan="2" class="seDisplayedAddressLabel"> <?php echo CART_SHIPPING_QUOTE_CRITERIA; ?><br /> <?php echo '<span class="seDisplayedAddressInfo">' . zen_get_zone_name($selected_country, $state_zone_id, '') . ($selectedState != '' ? ' ' . $selectedState : '') . ' ' . $order->delivery['postcode'] . ' ' . zen_get_country_name($order->delivery['country_id']) . '</span>'; ?> </td> </tr> <?php } ?> <tr> <th scope="col" id="seProductsHeading"><?php echo CART_SHIPPING_METHOD_TEXT; ?></th> <th scope="col" id="seTotalHeading"><?php echo CART_SHIPPING_METHOD_RATES; ?></th> </tr> <?php for ($i=0, $n=sizeof($quotes); $i<$n; $i++) { if(sizeof($quotes[$i]['methods'])==1){ // simple shipping method $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][0]['id']; ?> <tr class="<?php echo $extra; ?>"> <?php if($quotes[$i]['error']){ ?> <td colspan="2"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['error']; ?>)</td> </tr> <?php }else{ if($selected_shipping['id'] == $thisquoteid){ ?> <td class="bold"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][0]['title']; ?>)</td> <td class="cartTotalDisplay bold"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php }else{ ?> <td><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][0]['title']; ?>)</td> <td class="cartTotalDisplay"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php } } } else { // shipping method with sub methods (multipickup) for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) { $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][$j]['id']; ?> <tr class="<?php echo $extra; ?>"> <?php if($quotes[$i]['error']){ ?> <td colspan="2"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['error']; ?>)</td> </tr> <?php }else{ if($selected_shipping['id'] == $thisquoteid){ ?> <td class="bold"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td> <td class="cartTotalDisplay bold"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php }else{ ?> <td><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td> <td class="cartTotalDisplay"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php } } } } } ?> </table> <?php } //-bof-No display until country/state/zip are entered (2 of 2) } //-eof-No display until country/state/zip are entered (2 of 2) } ?> </form> </div> ```
22 Aug 2013, 4:59 AM
#7
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Hide Available Shipping Methods table until Shipping Estimator runs

DivaVocals:

Hate to bump an old post, but I need some help.. Just discovered today that the shipping estimator does not work when a customer logs in. The ONLY modification to the shipping estimator was the code below. How does this need to be modified so that the shipping estimator will work when a customer is logged in as well??

ETA: I just tested what happens when I comment this code out.. the shipping estimator does display when logged in.. So I need help making the corrections to the modified code below so that the shipping estimator displays whether logged in or not..
Nevermind.. I think the issue is that this code conflicts with the changes to the UPS and Flat Rate shipping modules that Ajeh just helped me with today:
http://www.zen-cart.com/showthread.php?209661-Disable-Flat-Rate-if-UPS-offers-a-lower-option

Gonna back out the shipping estimator code and test to see if this fixes things..

22 Sep 2013, 1:47 PM
#8
beagle avatar

beagle

New Zenner

Join Date:
Sep 2008
Location:
Toronto, ON
Posts:
2
Plugin Contributions:
0

Re: Hide Available Shipping Methods table until Shipping Estimator runs

DivaVocals:

Hate to bump an old post, but I need some help.. Just discovered today that the shipping estimator does not work when a customer logs in. The ONLY modification to the shipping estimator was the code below. How does this need to be modified so that the shipping estimator will work when a customer is logged in as well??

ETA: I just tested what happens when I comment this code out.. the shipping estimator does display when logged in.. So I need help making the corrections to the modified code below so that the shipping estimator displays whether logged in or not..

Just tried to implement this myself with same issue. Think I've managed to fix it.

Alter the first if statement in the modification so it also checks if customer logged in.

From:

if ($selected_country == 0 || ($selectedState == '' && $state_zone_id == 0) || $zip_code == '') {

To:

if (($selected_country == 0 || ($selectedState == '' && $state_zone_id == 0) || $zip_code == '')  && (!$_SESSION['customer_id'])) {

I'm have some basic programming skills but am not knowledgeable about PHP. Just put this together from following the logic and copying some code from above in the file. Seems to work (1.3.9h) but please test first.

22 Sep 2013, 6:04 PM
#9
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Hide Available Shipping Methods table until Shipping Estimator runs

Beagle:

Just tried to implement this myself with same issue. Think I've managed to fix it.

Not the SAME issue at all.. you have the same SYMPTOM.. (yes there is a difference)

So let me be CLEAR.. The code posted in post #3 (http://www.zen-cart.com/showthread.php?198719-Hide-Available-Shipping-Methods-table-until-Shipping-Estimator-runs&p=1145497#post1145497) worked JUST FINE for me (and it will for others too) until I made OTHER changes ELSEWHERE to some shipping modules which caused the shipping estimator to not work when a customer logged in.
As I stated in post #7 here:

I think the issue is that this code conflicts with the changes to the UPS and Flat Rate shipping modules that Ajeh just helped me with today:
http://www.zen-cart.com/showthread.p...a-lower-option

The changes I made to the UPS and Flat Rate shipping modules conflicted with the code posted in post #3, and in a fact the changes I made to my UPS and Flat Rate shipping modules made the need for the changes in post #3 OBSOLETE..

Beagle:

Alter the first if statement in the modification so it also checks if customer logged in.

From:

if ($selected_country == 0 || ($selectedState == '' && $state_zone_id == 0) || $zip_code == '') {

> 
> To:
> 
> ```
if (($selected_country == 0 || ($selectedState == '' && $state_zone_id == 0) || $zip_code == '')  && (!$_SESSION['customer_id'])) {

I'm have some basic programming skills but am not knowledgeable about PHP. Just put this together from following the logic and copying some code from above in the file. Seems to work (1.3.9h) but please test first.Your solution only adds the customer being logged in as an additional condition required before the shipping estimator will display.. Means that customers who are NOT logged in will NOT see the shipping estimator..

22 Sep 2013, 11:12 PM
#10
beagle avatar

beagle

New Zenner

Join Date:
Sep 2008
Location:
Toronto, ON
Posts:
2
Plugin Contributions:
0

Re: Hide Available Shipping Methods table until Shipping Estimator runs

DivaVocals:

Not the SAME issue at all.. you have the same SYMPTOM.. (yes there is a difference)

Fair enough. Did not mean to suggest that this change would fix a conflict with a shipping module.

DivaVocals:

Your solution only adds the customer being logged in as an additional condition required before the shipping estimator will display.. Means that customers who are NOT logged in will NOT see the shipping estimator..

Note the ! - checks for customer NOT logged in.

The logic of the shipping estimator is something like:

IF (customer is logged in) THEN
Use customer's address information for shipping estimate
ELSE
Present form to collect Country, State, Zip and use this for shipping estimate
END IF

But if the customer is logged in, the variables set by the form under ELSE are not set. Therefore the display of the shipping estimate is not presented, since the modification discussed here disables the display if any of the variables are not set. My additional condition ignores all the other conditions if the customer is logged in.

I present this should someone else have the same display issue - as far as I can tell, the original code cannot work if the customer is logged in.

23 Sep 2013, 12:24 AM
#11
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Hide Available Shipping Methods table until Shipping Estimator runs

Beagle:

Fair enough. Did not mean to suggest that this change would fix a conflict with a shipping module.

Note the ! - checks for customer NOT logged in.

The logic of the shipping estimator is something like:

IF (customer is logged in) THEN
Use customer's address information for shipping estimate
ELSE
Present form to collect Country, State, Zip and use this for shipping estimate
END IF

But if the customer is logged in, the variables set by the form under ELSE are not set. Therefore the display of the shipping estimate is not presented, since the modification discussed here disables the display if any of the variables are not set. My additional condition ignores all the other conditions if the customer is logged in.

I present this should someone else have the same display issue - as far as I can tell, the original code cannot work if the customer is logged in.

Read your ealier post a bit too fast.. So I stand corrected.. You are right the original code probably never worked when a customer was logged in.. (admittedly I never tested this when I first used it..) so in the name of clarity gonna post the FULL change (makes it easier for folks following this if they don't have to piece together the change)

This is a replacement for the ** /includes/templates/YOUR_TEMPLATE/templates/tpl_modules_shipping_estimator.php**. There are two areas that were changed, just look for the //-bof and //-eof comments.

<?php
      }
    }
    if($_SESSION['cart']->get_content_type() == 'virtual'){
?>
<?php echo CART_SHIPPING_METHOD_FREE_TEXT .  ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS; ?>
<?php
    }elseif ($free_shipping==1) {
?>
<?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)); ?>
<?php
    }else{
[B]//-bof-No display until country/state/zip are entered (1 of 2)
      if (($selected_country == 0 || ($selectedState == '' && $state_zone_id == 0) || $zip_code == '')  && (!$_SESSION['customer_id'])) {
        if (!defined(TEXT_ENTER_ALL_VALUES)) define ('TEXT_ENTER_ALL_VALUES', 'Please select your country, state and zipcode so that we can can retrieve an accurate shipping estimate.');
        echo '<p>' . TEXT_ENTER_ALL_VALUES . '</p>';
      } else {
//-eof-No display until country/state/zip are entered (1 of 2)[/B]
?>
<table width="100%" border="1" cellpadding="2" cellspacing ="2">
<?php if ($_SESSION['customer_id'] < 1 ){ ?>
    <tr>
      <td colspan="2" class="seDisplayedAddressLabel">
        <?php echo CART_SHIPPING_QUOTE_CRITERIA; ?><br />
        <?php echo '<span class="seDisplayedAddressInfo">' . zen_get_zone_name($selected_country, $state_zone_id, '') . ($selectedState != '' ? ' ' . $selectedState : '') . ' ' . $order->delivery['postcode'] . ' ' . zen_get_country_name($order->delivery['country_id']) . '</span>'; ?>
      </td>
    </tr>
<?php } ?>
     <tr>
       <th scope="col" id="seProductsHeading"><?php echo CART_SHIPPING_METHOD_TEXT; ?></th>
       <th scope="col" id="seTotalHeading"><?php echo CART_SHIPPING_METHOD_RATES; ?></th>
     </tr>
<?php
      for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
        if(sizeof($quotes[$i]['methods'])==1){
          // simple shipping method
          $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][0]['id'];
?>
     <tr class="<?php echo $extra; ?>">
<?php
          if($quotes[$i]['error']){
?>
         <td colspan="2"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['error']; ?>)</td>
       </tr>
<?php
          }else{
            if($selected_shipping['id'] == $thisquoteid){
?>
         <td class="bold"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][0]['title']; ?>)</td>
         <td class="cartTotalDisplay bold"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])); ?></td>
       </tr>
<?php
            }else{
?>
          <td><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][0]['title']; ?>)</td>
          <td class="cartTotalDisplay"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])); ?></td>
       </tr>
<?php
            }
          }
        } else {
          // shipping method with sub methods (multipickup)
          for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
            $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][$j]['id'];
?>
    <tr class="<?php echo $extra; ?>">
<?php
            if($quotes[$i]['error']){
?>
         <td colspan="2"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['error']; ?>)</td>
       </tr>
<?php
            }else{
              if($selected_shipping['id'] == $thisquoteid){
?>
         <td class="bold"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td>
         <td class="cartTotalDisplay bold"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td>
       </tr>
<?php
              }else{
?>
        <td><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td>
        <td class="cartTotalDisplay"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td>
      </tr>
<?php
              }
            }
          }
        }
      }
?>
</table>
<?php
   }
[B]//-bof-No display until country/state/zip are entered (2 of 2)[/B]
[B]   }[/B]
[B]//-eof-No display until country/state/zip are entered (2 of 2)[/B]
  }
?>
</form>
</div>
23 Sep 2013, 2:56 AM
#12
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Hide Available Shipping Methods table until Shipping Estimator runs

DivaVocals:

Read your ealier post a bit too fast.. So I stand corrected.. You are right the original code probably never worked when a customer was logged in.. (admittedly I never tested this when I first used it..) so in the name of clarity gonna post the FULL change (makes it easier for folks following this if they don't have to piece together the change)

This is a replacement for the ** /includes/templates/YOUR_TEMPLATE/templates/tpl_modules_shipping_estimator.php**. There are two areas that were changed, just look for the //-bof and //-eof comments.

<?php } } if($_SESSION['cart']->get_content_type() == 'virtual'){ ?> <?php echo CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS; ?> <?php }elseif ($free_shipping==1) { ?> <?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)); ?> <?php }else{ [B]//-REMOVE -- REMOVE --[/B][B] REMOVE -- REMOVE --[/B][B] if (($selected_country == 0 || ($selectedState == '' && $state_zone_id == 0) || $zip_code == '') && (!$_SESSION['customer_id'])) { if (!defined(TEXT_ENTER_ALL_VALUES)) define ('TEXT_ENTER_ALL_VALUES', 'Please select your country, state and zipcode so that we can can retrieve an accurate shipping estimate.'); echo '<p>' . TEXT_ENTER_ALL_VALUES . '</p>'; } else { //-[/B][B]REMOVE -- REMOVE --[/B][B] REMOVE -- REMOVE --[/B] ?>

[B]//-BOF REMOVE TABLE TILL ZIP CODE ENTERED OR CUSTOMER SESSION EXISTS[/B]
[B]<?php if ($_SESSION['customer_id'] < '1' and !empty($order->delivery['postcode']) or $_SESSION['customer_id']){ ?>[/B]
[B]//-[/B][B]EOF REMOVE TABLE TILL ZIP CODE ENTERED OR CUSTOMER SESSION EXISTS[/B]

<table width="100%" border="1" cellpadding="2" cellspacing ="2"> [B]//-MOVE ABOVE <HTML TABLE> AND CHANGE TO [/B][B]RED CODE[/B] <?php if ($_SESSION['customer_id'] < 1 ){ ?> [B]//-[/B][B]MOVE ABOVE <HTML TABLE>[/B][B] AND CHANGE TO [/B][B]RED CODE[/B] <tr> <td colspan="2" class="seDisplayedAddressLabel"> <?php echo CART_SHIPPING_QUOTE_CRITERIA; ?><br /> <?php echo '<span class="seDisplayedAddressInfo">' . zen_get_zone_name($selected_country, $state_zone_id, '') . ($selectedState != '' ? ' ' . $selectedState : '') . ' ' . $order->delivery['postcode'] . ' ' . zen_get_country_name($order->delivery['country_id']) . '</span>'; ?> </td> </tr> [B]//-REMOVE -- REMOVE --[/B][B] REMOVE -- REMOVE --[/B] <?php } ?>[B] //-REMOVE -- REMOVE --[/B][B] REMOVE -- REMOVE --[/B] <tr> <th scope="col" id="seProductsHeading"><?php echo CART_SHIPPING_METHOD_TEXT; ?></th> <th scope="col" id="seTotalHeading"><?php echo CART_SHIPPING_METHOD_RATES; ?></th> </tr> <?php for ($i=0, $n=sizeof($quotes); $i<$n; $i++) { if(sizeof($quotes[$i]['methods'])==1){ // simple shipping method $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][0]['id']; ?> <tr class="<?php echo $extra; ?>"> <?php if($quotes[$i]['error']){ ?> <td colspan="2"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['error']; ?>)</td> </tr> <?php }else{ if($selected_shipping['id'] == $thisquoteid){ ?> <td class="bold"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][0]['title']; ?>)</td> <td class="cartTotalDisplay bold"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php }else{ ?> <td><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][0]['title']; ?>)</td> <td class="cartTotalDisplay"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php } } } else { // shipping method with sub methods (multipickup) for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) { $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][$j]['id']; ?> <tr class="<?php echo $extra; ?>"> <?php if($quotes[$i]['error']){ ?> <td colspan="2"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['error']; ?>)</td> </tr> <?php }else{ if($selected_shipping['id'] == $thisquoteid){ ?> <td class="bold"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td> <td class="cartTotalDisplay bold"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php }else{ ?> <td><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td> <td class="cartTotalDisplay"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td> </tr> <?php } } } } } ?> </table> <?php } [B]//-bof-No display until country/state/zip are entered (2 of 2)[/B] [B]KEEP[/B] [B] }[/B] [B]//-eof-No display until country/state/zip are entered (2 of 2)[/B] [B]KEEP[/B] } ?> </form> </div> ```

Hope this helps and what you are looking to do.

23 Sep 2013, 3:43 AM
#13
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Hide Available Shipping Methods table until Shipping Estimator runs

rbarbour:

Hope this helps and what you are looking to do.

Honestly speaking what you posted isn't clear all.. the blue and red coloring confuses rather than clarifies things.. I tried your code and it doesn't work, and breaks a few things.. The code I posted (lat9's original code + the changes Beagle made) does achieve the original objective "Hide Available Shipping Methods table until Shipping Estimator runs", and now it works whether you are logged in or not.. Plus it has the added bonus of providing a nice on-screen message to remind the site visitor to enter the required info needed to obtain a shipping estimate..

23 Sep 2013, 3:49 AM
#14
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Hide Available Shipping Methods table until Shipping Estimator runs

DivaVocals:

Honestly speaking what you posted isn't clear all.. the blue and red coloring confuses rather than clarifies things.. I tried your code and it doesn't work, and breaks a few things..

"Hit" Post Quick Reply prematurely, to late to edit and I figured I would get a response anyways.

DivaVocals:

The code I posted (lat9's original code + the changes Beagle made) does achieve the original objective "Hide Available Shipping Methods table until Shipping Estimator runs", and now it works whether you are logged in or not.. Plus it has the added bonus of providing a nice on-screen message to remind the site visitor to enter the required info needed to obtain a shipping estimate..

Yes it does, maybe I will read entire threads before I post. lol

23 Sep 2013, 3:56 AM
#15
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Hide Available Shipping Methods table until Shipping Estimator runs

rbarbour:

"Hit" Post Quick Reply prematurely, to late to edit and I figured I would get a response anyways.

Yes it does, maybe I will read entire threads before I post. lol

:laugh: Yeah.. well I did the same thing earlier in this thread.. It's all good!!

30 Jul 2014, 5:15 PM
#16
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Hide Available Shipping Methods table until Shipping Estimator runs

This snippet can also be found here:
https://gist.github.com/DivaVocals/8303bef759f9648cbf86

13 Apr 2023, 11:59 AM
#17
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide Available Shipping Methods table until Shipping Estimator runs

How would i add this to zen 1.56c shipping estimator file

10 Dec 2024, 11:40 PM
#18
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide Available Shipping Methods table until Shipping Estimator runs

trying to add this to zen version 2.10 with php 8.0 and am getting this error

[10-Dec-2024 18:29:48 America/New_York] Request URI: /index.php?main_page=shopping_cart, IP address: 35.139.236.145, Language id 1
#1 require(/includes/templates/wokiee/templates/tpl_modules_shipping_estimator.php) called at [/includes/modules/shipping_estimator.php:302]
#2 require(/includes/modules/shipping_estimator.php) called at [/includes/templates/wokiee/templates/tpl_shopping_cart_default.php:188]
#3 require(/includes/templates/wokiee/templates/tpl_shopping_cart_default.php) called at [/includes/templates/wokiee/common/tpl_main_page.php:167]
#4 require(/includes/templates/wokiee/common/tpl_main_page.php) called at [/index.php:94]
--> PHP Warning: Undefined variable $zip_code in /includes/templates/wokiee/templates/tpl_modules_shipping_estimator.php on line 115.

[10-Dec-2024 18:29:48 America/New_York] Request URI: /index.php?main_page=shopping_cart, IP address: 35.139.236.145, Language id 1
#1 require(/includes/templates/wokiee/templates/tpl_modules_shipping_estimator.php) called at [/includes/modules/shipping_estimator.php:302]
#2 require(/includes/modules/shipping_estimator.php) called at [/includes/templates/wokiee/templates/tpl_shopping_cart_default.php:188]
#3 require(/includes/templates/wokiee/templates/tpl_shopping_cart_default.php) called at [/includes/templates/wokiee/common/tpl_main_page.php:167]
#4 require(/includes/templates/wokiee/common/tpl_main_page.php) called at [/index.php:94]
--> PHP Warning: Undefined array key "customer_id" in /includes/templates/wokiee/templates/tpl_modules_shipping_estimator.php on line 115.

[10-Dec-2024 18:29:48 America/New_York] PHP Fatal error: Uncaught Error: Undefined constant "TEXT_ENTER_ALL_VALUES" in /includes/templates/wokiee/templates/tpl_modules_shipping_estimator.php:116
Stack trace:
#0 /includes/modules/shipping_estimator.php(302): require()
#1 /includes/templates/wokiee/templates/tpl_shopping_cart_default.php(188): require('...')
#2 /includes/templates/wokiee/common/tpl_main_page.php(167): require('...')
#3 /index.php(94): require('...')
#4 {main}
thrown in /includes/templates/wokiee/templates/tpl_modules_shipping_estimator.php on line 116

[10-Dec-2024 18:29:48 America/New_York] Request URI: /index.php?main_page=shopping_cart, IP address: 35.139.236.145
--> PHP Fatal error: Uncaught Error: Undefined constant "TEXT_ENTER_ALL_VALUES" in /includes/templates/wokiee/templates/tpl_modules_shipping_estimator.php:116
Stack trace:
#0 /includes/modules/shipping_estimator.php(302): require()
#1 /includes/templates/wokiee/templates/tpl_shopping_cart_default.php(188): require('...')
#2 /includes/templates/wokiee/common/tpl_main_page.php(167): require('...')
#3 /index.php(94): require('...')
#4 {main}
thrown in /includes/templates/wokiee/templates/tpl_modules_shipping_estimator.php on line 116.

[10-Dec-2024 18:29:48 America/New_York] Request URI: /index.php?main_page=shopping_cart, IP address: 35.139.236.145
--> PHP Fatal error: Uncaught Error: Undefined constant "TEXT_ENTER_ALL_VALUES" in /includes/templates/wokiee/templates/tpl_modules_shipping_estimator.php:116
Stack trace:
#0 /includes/modules/shipping_estimator.php(302): require()
#1 /includes/templates/wokiee/templates/tpl_shopping_cart_default.php(188): require('...')
#2 /includes/templates/wokiee/common/tpl_main_page.php(167): require('...')
#3 /index.php(94): require('...')
#4 {main}
thrown in /includes/templates/wokiee/templates/tpl_modules_shipping_estimator.php on line 116.
27 Dec 2024, 12:59 AM
#19
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
971
Plugin Contributions:
0

Re: Hide Available Shipping Methods table until Shipping Estimator runs

added this ```
'TEXT_ENTER_ALL_VALUES' => 'Please select your country, state and zipcode so that we can can retrieve an accurate shipping estimate.',

to lang.english.php
than i changed $zip_code to $postcode
and modified this 

//-bof-No display until country/state/zip are entered (1 of 2)
if (($selected_country == 0 || ($selectedState == '' && $state_zone_id == 0) || $postcode == '') && (!$_SESSION['customer_id'])) {
echo '<p>' . TEXT_ENTER_ALL_VALUES . '</p>';
} else {
//-eof-No display until country/state/zip are entered (1 of 2)

this works in zen 210