Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / New line or Add a Space in CSS Shipping Estimator

New line or Add a Space in CSS Shipping Estimator

Locked

Views: 4,418

Results 1 to 20 of 25
This thread is locked. New replies are disabled.
25 Apr 2009, 11:35 AM
#1
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

New line or Add a Space in CSS Shipping Estimator

If you look at my shipping estimator page:

http://www.limelites.co.uk/index.php?main_page=popup_shipping_estimator

You'll notice that there is no space between these fields:

Items in Cart: 1Weight: 0.2kgsAmount: £14.99

How do I either put each of those on a new line, or at least add a space between them?

25 Apr 2009, 1:27 PM
#3
s_t_e_v_e avatar

s_t_e_v_e

Zen Follower

Join Date:
Aug 2006
Location:
UK
Posts:
430
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

I noticed that the other day (in firefox)

There should be spaces in the language defines...

\includes\languages\CUSTOM\english\popup_shipping_estimator.php

define('HEADING_SEARCH_HELP', 'Shipping Estimator:');
define('TEXT_TOTAL_ITEMS', 'Total Items: ');
define('TEXT_TOTAL_WEIGHT', '  Weight: ');
define('TEXT_TOTAL_AMOUNT', '  Amount: ');

25 Apr 2009, 2:58 PM
#4
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

haredo:

Limey,
Looks great to me in firefox..

This is what I see:
http://www.limelites.co.uk/index.php?main_page=shopping_cart&number_of_uploads=0

Items in Cart: 1 Weight: 0.8kgs Amount: £49.99

That's odd, I'm using FF Mozilla/5.0 and I don't get those spaces. This is what I get:

No spaces.

s_t_e_v_e:

I noticed that the other day (in firefox)

There should be spaces in the language defines...

\includes\languages\CUSTOM\english\popup_shipping_estimator.php

define('HEADING_SEARCH_HELP', 'Shipping Estimator:');
define('TEXT_TOTAL_ITEMS', 'Total Items: ');
define('TEXT_TOTAL_WEIGHT', '  Weight: ');
define('TEXT_TOTAL_AMOUNT', '  Amount: ');

Hi Steve! I took a look in my popup_shipping_estimator.php and it is now identical to that you posted above. Unfortunately, still don't get any spaces. I'll try and add some tags to drop each onto a new line.

25 Apr 2009, 3:12 PM
#5
s_t_e_v_e avatar

s_t_e_v_e

Zen Follower

Join Date:
Aug 2006
Location:
UK
Posts:
430
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

hmmm... To test to see if this file is being used for the shipping estimator... I would change one of the defines to something else;

define('TEXT_TOTAL_WEIGHT', '  Weight: ');

to

define('TEXT_TOTAL_WEIGHT', '  TEST Weight TEST : ');

25 Apr 2009, 3:14 PM
#6
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

That's strange.... doesn't seem to be generated from popup_shipping_estimator.php........ I just changed those defines to these test values to see if I could force a new line, but the text, 'test' does not show up at all?

define('HEADING_SEARCH_HELP', 'TESTTESTTESTShipping Estimator:<dt>test</dt>');
define('TEXT_TOTAL_ITEMS', 'Total Items: <dt>test</dt>');
define('TEXT_TOTAL_WEIGHT', '  Weight: <dt>test</dt>');
define('TEXT_TOTAL_AMOUNT', '  Amount: <dt>test</dt>');

Either I have this file in the wrong place or it's coming from some place else?

I checked my overrides folder but my file is not in the folder you said Steve. My file is in /includes/languages/english

So, it's not being overridden?

25 Apr 2009, 3:15 PM
#7
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

I was actually doing that, just as you were advising me to do it.... I must be learning :D

25 Apr 2009, 3:18 PM
#8
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

I just tried placing the same file in \includes\languages\CUSTOM\english\popup_shipping_estimator.php but still not generating the test text.

25 Apr 2009, 3:22 PM
#9
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

OK, so it gets stranger. I just searched the text, "Estimate Shipping Costs" form the title in the popup page and the only file developers toolkit finds this text in is english.php

Why is DTK not finding it in popup file?

25 Apr 2009, 3:23 PM
#10
s_t_e_v_e avatar

s_t_e_v_e

Zen Follower

Join Date:
Aug 2006
Location:
UK
Posts:
430
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

Have you changed the shipping estimator template? May be the template is not using the Defines...

\includes\templates\custom\templates\tpl_modules_shipping_estimator.php

line 22

<?php if (!empty($totalsDisplay)) { ?> <div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div> <?php } ?>
25 Apr 2009, 3:28 PM
#11
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

s_t_e_v_e:

Have you changed the shipping estimator template? May be the template is not using the Defines...

\includes\templates\custom\templates\tpl_modules_shipping_estimator.php

line 22

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

Just checked and I've never changed this file. It's still in the default template files, never been touched. I double checked line 22 and it's exactly as above.

25 Apr 2009, 3:31 PM
#12
s_t_e_v_e avatar

s_t_e_v_e

Zen Follower

Join Date:
Aug 2006
Location:
UK
Posts:
430
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

The only other place those constants are defined is in;
\includes\languages\english\shopping_cart.php

but the popup shipping estimator shouldnt be using those... but... have a look.

25 Apr 2009, 3:36 PM
#13
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

I already tried that, again just as you were typing... I uploaded a copy of shopping_cart with some TEST TEXT and nothing appeared.

Bizarre, right? I don't know why my popup language file isn't changing the popup page. It's not a big issue, but an interesting one :-)

25 Apr 2009, 3:38 PM
#14
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

Just double check this with me. Here's the file contents:

<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce                                       |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers                           |
// |                                                                      |
// | http://www.zen-cart.com/index.php                                    |
// |                                                                      |
// | Portions Copyright (c) 2003 osCommerce                               |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | [email protected] so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
// $Id: popup_shipping_estimator.php 2642 2005-12-21 15:35:44Z ajeh $
//
define('HEADING_SEARCH_HELP', 'TESTTESTTESTShipping Estimator:<dt>test</dt>');
define('TEXT_TOTAL_ITEMS', 'Total Items: <dt>test</dt>');
define('TEXT_TOTAL_WEIGHT', '  Weight: <dt>test</dt>');
define('TEXT_TOTAL_AMOUNT', '  Amount: <dt>test</dt>'); 
?>

Location and exact spelling:

"h t t p://w w w . l i m e l i t e s . c o . u k /includes/languages/english/popup_shipping_estimator.php"

25 Apr 2009, 3:59 PM
#15
s_t_e_v_e avatar

s_t_e_v_e

Zen Follower

Join Date:
Aug 2006
Location:
UK
Posts:
430
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

Looks OK to me. (although I wouldnt have used DT tags...)

Check that you are overwriting the file when uploading...

25 Apr 2009, 4:09 PM
#16
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

I'll ditch the dt tags if I can get it working. Just checked and yes, 100% definitely overwriting when uploading. I downloaded it again to a different location and opened it to find the TEST text in the file that's currently on the server.

Maybe something in \includes\templates\custom\templates\tpl_modules_shipping_estimator.php is interfering but I've never modified this?

<?php
/**
 * Module Template - for shipping-estimator display
 *
 * @package templateSystem
 * @copyright Copyright 2003-2007 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 5853 2007-02-20 05:49:48Z drbyte $
 */
?>
<div id="shippingEstimatorContent">
<?php echo zen_draw_form('estimator', zen_href_link($show_in, '', 'NONSSL'), 'post'); ?>
<?php echo zen_draw_hidden_field('scid', $selected_shipping['id']); ?>
<?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();" name="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{
?>
<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
   }
  }
?>
</form>
</div>
25 Apr 2009, 4:40 PM
#17
s_t_e_v_e avatar

s_t_e_v_e

Zen Follower

Join Date:
Aug 2006
Location:
UK
Posts:
430
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

that file uses $totalsDisplay which is initialised in;

\includes\modules\shipping_estimator.php (unless you have an override folder)
line 236

// This is done after quote-calcs in order to include Tare info accurately.  NOTE: tare values are *not* included in weights shown on-screen.
  $totalsDisplay = '';
  if (SHOW_SHIPPING_ESTIMATOR_BUTTON != 2) {
    switch (true) {
      case (SHOW_TOTALS_IN_CART == '1'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_WEIGHT . $shipping_estimator_display_weight . TEXT_PRODUCT_WEIGHT_UNIT . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
      case (SHOW_TOTALS_IN_CART == '2'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($shipping_estimator_display_weight > 0 ? TEXT_TOTAL_WEIGHT . $shipping_estimator_display_weight . TEXT_PRODUCT_WEIGHT_UNIT : '') . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
      case (SHOW_TOTALS_IN_CART == '3'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
    }
  }

I must be missing something... so I will re trace how the page is constructed...

25 Apr 2009, 5:09 PM
#18
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

I still use the original shipping_estimator. I downloaded and checked to confirm. Here is a copy of my shipping_estimator:

<?php
/**
 * Shipping Estimator module
 *
 * Customized by: Linda McGrath [email protected] to:
 * - Handles Free Shipping for orders over $total as defined in the Admin
 * - Shows Free Shipping on Virtual products
 *
 * @package modules
 * @copyright Copyright 2003-2007 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * portions Copyright (c) 2003 Edwin Bekaert ([email protected])
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: shipping_estimator.php 6996 2007-09-13 22:36:54Z ajeh $
 */
if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}

// load JS updater
if ($current_page_base != 'popup_shipping_estimator') {
  require(DIR_WS_MODULES . '/pages/popup_shipping_estimator/jscript_addr_pulldowns.php');
}
?>
<!-- shipping_estimator //-->

<script language="javascript" type="text/javascript">
function shipincart_submit(){
  document.estimator.submit();
  return false;
}
</script>

<?php
// Only do when something is in the cart
if ($_SESSION['cart']->count_contents() > 0) {
   $zip_code = (isset($_SESSION['cart_zip_code'])) ? $_SESSION['cart_zip_code'] : '';
   $zip_code = (isset($_POST['zip_code'])) ? strip_tags(addslashes($_POST['zip_code'])) : $zip_code;
   $state_zone_id = (isset($_SESSION['cart_zone'])) ? (int)$_SESSION['cart_zone'] : '';
   $state_zone_id = (isset($_POST['zone_id'])) ? (int)$_POST['zone_id'] : $state_zone_id;
   $selectedState = zen_db_input($_POST['state']);
  // Could be placed in english.php
  // shopping cart quotes
  // shipping cost
  require_once('includes/classes/http_client.php'); // shipping in basket

/*
// moved below and altered to include Tare
  // totals info
  $totalsDisplay = '';
  switch (true) {
    case (SHOW_TOTALS_IN_CART == '1'):
    $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_WEIGHT . $_SESSION['cart']->show_weight() . TEXT_PRODUCT_WEIGHT_UNIT . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
    break;
    case (SHOW_TOTALS_IN_CART == '2'):
    $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($_SESSION['cart']->show_weight() > 0 ? TEXT_TOTAL_WEIGHT . $_SESSION['cart']->show_weight() . TEXT_PRODUCT_WEIGHT_UNIT : '') . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
    break;
    case (SHOW_TOTALS_IN_CART == '3'):
    $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
    break;
  }
*/

  //if($cart->get_content_type() !== 'virtual') {
  if ($_SESSION['customer_id']) {
    // user is logged in
    if (isset($_POST['address_id'])){
      // user changed address
      $sendto = $_POST['address_id'];
    }elseif ($_SESSION['cart_address_id']){
      // user once changed address
      $sendto = $_SESSION['cart_address_id'];
      //        $sendto = $_SESSION['customer_default_address_id'];
    }else{
      // first timer
      $sendto = $_SESSION['customer_default_address_id'];
    }
    $_SESSION['sendto'] = $sendto;
    // set session now
    $_SESSION['cart_address_id'] = $sendto;
    // set shipping to null ! multipickjup changes address to store address...
    $shipping='';
    // include the order class (uses the sendto !)
    require(DIR_WS_CLASSES . 'order.php');
    $order = new order;
  }else{
    // user not logged in !
    if (isset($_POST['zone_country_id'])){
      // country is selected
      $_SESSION['country_info'] = zen_get_countries($_POST['zone_country_id'],true);
      $country_info = $_SESSION['country_info'];
      $order->delivery = array('postcode' => $zip_code,
                               'country' => array('id' => $_POST['zone_country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                               'country_id' => $_POST['zone_country_id'],
                               //add state zone_id
                               'zone_id' => $state_zone_id,
                               'format_id' => zen_get_address_format_id($_POST['zone_country_id']));
      $_SESSION['cart_country_id'] = $_POST['zone_country_id'];
      //add state zone_id
      $_SESSION['cart_zone'] = $state_zone_id;
      $_SESSION['cart_zip_code'] = $zip_code;
    } elseif ($_SESSION['cart_country_id']){
      // session is available
      $_SESSION['country_info'] = zen_get_countries($_SESSION['cart_country_id'],true);
      $country_info = $_SESSION['country_info'];
      // fix here - check for error on $cart_country_id
      $order->delivery = array('postcode' => $_SESSION['cart_zip_code'],
                               'country' => array('id' => $_SESSION['cart_country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                               'country_id' => $_SESSION['cart_country_id'],
                               'zone_id' => $state_zone_id,
                               'format_id' => zen_get_address_format_id($_SESSION['cart_country_id']));
    } else {
      // first timer
      $_SESSION['cart_country_id'] = STORE_COUNTRY;
      $_SESSION['country_info'] = zen_get_countries(STORE_COUNTRY,true);
      $country_info = $_SESSION['country_info'];
      $order->delivery = array(//'postcode' => '',
                               'country' => array('id' => STORE_COUNTRY, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                               'country_id' => STORE_COUNTRY,
                               'zone_id' => $state_zone_id,
                               'format_id' => zen_get_address_format_id($_POST['zone_country_id']));
    }
    // set the cost to be able to calculate free shipping
    $order->info = array('total' => $_SESSION['cart']->show_total(), // TAX ????
                         'currency' => $currency,
                         'currency_value'=> $currencies->currencies[$currency]['value']);
  }
  // weight and count needed for shipping !
  $total_weight = $_SESSION['cart']->show_weight();
  $shipping_estimator_display_weight = $total_weight;
  $total_count = $_SESSION['cart']->count_contents();
  require(DIR_WS_CLASSES . 'shipping.php');
  $shipping_modules = new shipping;
  $quotes = $shipping_modules->quote();
  //print_r($quotes);
  //die('here');
  $order->info['subtotal'] = $_SESSION['cart']->show_total();

  // set selections for displaying
  $selected_country = $order->delivery['country']['id'];
  $selected_address = $sendto;
  //}
  // eo shipping cost
  // check free shipping based on order $total
  if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true')) {
    switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
      case 'national':
      if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
      case 'international':
      if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
      case 'both':

      $pass = true; break;
      default:
      $pass = false; break;
    }
    $free_shipping = false;
    if ( ($pass == true) && ($_SESSION['cart']->show_total() >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) {
      $free_shipping = true;
      include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/order_total/ot_shipping.php');
    }
  } else {
    $free_shipping = false;
  }
  // begin shipping cost
  if(!$free_shipping && $_SESSION['cart']->get_content_type() !== 'virtual'){
    if (zen_not_null($_POST['scid'])){
      list($module, $method) = explode('_', $_POST['scid']);
      $_SESSION['cart_sid'] = $_POST['scid'];
    }elseif ($_SESSION['cart_sid']){
      list($module, $method) = explode('_', $_SESSION['cart_sid']);
    }else{
      $module="";
      $method="";
    }
    if (zen_not_null($module)){
      $selected_quote = $shipping_modules->quote($method, $module);
      if($selected_quote[0]['error'] || !zen_not_null($selected_quote[0]['methods'][0]['cost'])){
        $selected_shipping = $shipping_modules->cheapest();
        $order->info['shipping_method'] = $selected_shipping['title'];
        $order->info['shipping_cost'] = $selected_shipping['cost'];
        $order->info['total']+= $selected_shipping['cost'];
      }else{
        $order->info['shipping_method'] = $selected_quote[0]['module'].' ('.$selected_quote[0]['methods'][0]['title'].')';
        $order->info['shipping_cost'] = $selected_quote[0]['methods'][0]['cost'];
        $order->info['total']+= $selected_quote[0]['methods'][0]['cost'];
        $selected_shipping['title'] = $order->info['shipping_method'];
        $selected_shipping['cost'] = $order->info['shipping_cost'];
        $selected_shipping['id'] = $selected_quote[0]['id'].'_'.$selected_quote[0]['methods'][0]['id'];
      }
    }else{
      $selected_shipping = $shipping_modules->cheapest();
      $order->info['shipping_method'] = $selected_shipping['title'];
      $order->info['shipping_cost'] = $selected_shipping['cost'];
      $order->info['total']+= $selected_shipping['cost'];
    }
  }
  // virtual products need a free shipping
  if($_SESSION['cart']->get_content_type() == 'virtual') {
    $order->info['shipping_method'] = CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS;
    $order->info['shipping_cost'] = 0;
  }
  if($free_shipping) {
    $order->info['shipping_method'] = MODULE_ORDER_TOTAL_SHIPPING_TITLE;
    $order->info['shipping_cost'] = 0;
  }
  $shipping=$selected_shipping;
  if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '1') {
    $show_in = FILENAME_POPUP_SHIPPING_ESTIMATOR;
  } else {
    $show_in = FILENAME_SHOPPING_CART;
  }
//  if(sizeof($quotes)) {
    if ($_SESSION['customer_id']) {
      $addresses = $db->execute("select address_book_id, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
      // only display addresses if more than 1
      if ($addresses->RecordCount() > 1){
        while (!$addresses->EOF) {
          $addresses_array[] = array('id' => $addresses->fields['address_book_id'], 'text' => zen_address_format(zen_get_address_format_id($addresses->fields['country_id']), $addresses->fields, 0, ' ', ' '));
          $addresses->MoveNext();
        }
      }
    } else {
      if($_SESSION['cart']->get_content_type() != 'virtual'){
        $state_array[] = array('id' => '', 'text' => PULL_DOWN_SHIPPING_ESTIMATOR_SELECT);
        $state_values = $db->Execute("select zone_name, zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$selected_country . "' order by zone_country_id DESC, zone_name");
        while (!$state_values->EOF) {
          $state_array[] = array('id' => $state_values->fields['zone_id'],
                                 'text' => $state_values->fields['zone_name']);
          $state_values->MoveNext();
        }
      }
    }
//  }

// This is done after quote-calcs in order to include Tare info accurately.  NOTE: tare values are *not* included in weights shown on-screen.
  $totalsDisplay = '';
  if (SHOW_SHIPPING_ESTIMATOR_BUTTON != 2) {
    switch (true) {
      case (SHOW_TOTALS_IN_CART == '1'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_WEIGHT . $shipping_estimator_display_weight . TEXT_PRODUCT_WEIGHT_UNIT . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
      case (SHOW_TOTALS_IN_CART == '2'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($shipping_estimator_display_weight > 0 ? TEXT_TOTAL_WEIGHT . $shipping_estimator_display_weight . TEXT_PRODUCT_WEIGHT_UNIT : '') . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
      case (SHOW_TOTALS_IN_CART == '3'):
      $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
      break;
    }
  }  

  if (!isset($tplVars['flagShippingPopUp']) || $tplVars['flagShippingPopUp'] !== true) {
/**
 * use the template tpl_modules_shipping_estimator.php to display the result
 *
**/
    require($template->get_template_dir('tpl_modules_shipping_estimator.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_shipping_estimator.php');
  }
} else { // Only do when something is in the cart
?>
<h2><?php echo CART_SHIPPING_OPTIONS; ?></h2>
<div class="cartTotalsDisplay important"><?php echo EMPTY_CART_TEXT_NO_QUOTE; ?></div>
<?php
}
?>
<script type="text/javascript" language="javascript">update_zone(document.estimator); </script>
<!-- shipping_estimator_eof //-->
25 Apr 2009, 5:51 PM
#19
s_t_e_v_e avatar

s_t_e_v_e

Zen Follower

Join Date:
Aug 2006
Location:
UK
Posts:
430
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

I've ran out of ideas for the moment... we have checked language files/ modules/ templates/ override folders and correct spelllings of files...

The next stage would be to alter modules/ templates/ to further trace how the page is generated and find out where those values are coming from...

25 Apr 2009, 5:54 PM
#20
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: New line or Add a Space in CSS Shipping Estimator

Hi Steve,

Don't waste any more time on it, it's taken up too much of your time already.

It's a tiny glitch at any rate :-)