Originally Posted by
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.
Code:
<?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 == '') && (!$_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)
?>
<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>
Bookmarks