View Single Post
  #250  
Old 10-29-2007, 05:02 AM
 
chris.barber chris.barber is offline
 

Advanced Member
  
Join Date: Sep 2007
Posts: 74
 

Default Re: Pre-Login Shipping Calculator

OK, I have sorted it for UK Postcodes, I have also managed to hide my £0.00 options when they are not valid.

Here's the code

{if not $login}
{if $estimate ne "NO"}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td align="right">
{$lng.txt_enter_zipcode}<br /><br />
<select name='country_estimate'>
{section name=country_idx loop=$countries}
<option value="{$countries[country_idx].country_code}"{if $config.General.default_country eq $countries[country_idx].country_code} selected="selected"{/if}>{$countries[country_idx].country|amp}</option>
{/section}
</select>
<input type="text" name='zip_estimate' size="8" maxlength="8" />
{include file="buttons/button.tpl" button_title=$lng.lbl_calculate_shipping href="javascript: document.cartform.submit()" js_to_href="Y"}
</td></tr>
</table>
{else}
{*<input id="sc" type="hidden" name="selected_carrier" value="" />*}
<table cellpadding="1" cellspacing="0" align="right">
{if $shipping[ship_num].rate eq "0.00" && $shipping[ship_num].shippingid eq "161" }
<tr><td><font class="SmallText">{$lng.lbl_Free_Local_Delivery_te xt}</font></td></tr>
{/if}
{section name=ship_num loop=$shipping}
{if $shipping[ship_num].rate eq "0.00" && $shipping[ship_num].shippingid eq "160" }
<tr><td><font class="Text">{$lng.lbl_Free_Local_Delivery_text}</font></td></tr>
{/if}
{if $shipping[ship_num].rate ne "0.00"}
<tr>
<td width="8"{if $shipping[ship_num].shippingid eq $cart.shippingid} class="TableHead"{/if}>
<input type="radio" name="shippingid" value="{$shipping[ship_num].shippingid}" {if $shipping[ship_num].shippingid eq $cart.shippingid}checked="checked"{else}onclick="j avascript:{*if $shipping[ship_num].code eq "UPS"} document.getElementById('sc').value = 'UPS';{/if*} this.form.submit();"{/if} />
</td>
<td{if $shipping[ship_num].shippingid eq $cart.shippingid} class="TableHead"{/if} align="left">
{$shipping[ship_num].shipping|trademark:$insert_trademark}
{if $shipping[ship_num].shipping_time ne ""} - {$shipping[ship_num].shipping_time}{/if}
{if $config.Appearance.display_shipping_cost eq "Y" && ($login ne "" || $config.General.apply_default_country eq "Y" || $cart.shipping_cost gt 0)} ({include file="currency.tpl" value=$shipping[ship_num].rate}){/if}
</td>
</tr>
{if $shipping[ship_num].warning ne ''}
<tr>
<td>&nbsp;</td>
<td class="SmallText">{$shipping[ship_num].warning}</td>
</tr>
{/if}
{/if}
{sectionelse}
<tr><td><font class="ErrorMessage">{$lng.lbl_no_shipping_for_loc ation}</font></td></tr>
{/section}
</table>
<br style="clear:both;" />
<div style="align:right;text-align:right;width:100%;padding-top:10px;"><a href="cart.php?zip_estimate=clear">{$lng.txt_click _change_zip}</a></div>
{/if}
<hr size="1" noshade="noshade" width="100%"/>
{/if}

You need to create a label called lbl_Free_Local_Delivery_text and amend your shippingid to match your setup, but this now works great, you can check it out at my store which is live so please no test orders, use PE1 1AA as your Free Delivery postcode and EC1a 1AA as your chargeable postcode, it's http://www.4furryfeet.com.

You don't need this part
{if $shipping[ship_num].rate eq "0.00" && $shipping[ship_num].shippingid eq "160" }
<tr><td><font class="Text">{$lng.lbl_Free_Local_Delivery_text}</font></td></tr>
{/if}

If you don't have a delivery zone that offers free shipping.

I am not a programmer as I have said before so I hope this jibberish makes sense, thanks.
__________________
Chris Barber
Version 4.1.9
MOD - BCSE Shipping Estimator
MOD - Shopzilla Feed
MOD - Price Match with Captcha
MOD - Links Manager 2008
MOD - One Page Checkout
MOD - Sitemap
Reply With Quote