View Single Post
  #202  
Old 06-28-2007, 05:09 PM
 
jeanne jeanne is offline
 

Advanced Member
  
Join Date: Aug 2004
Posts: 85
 

Default Re: Pre-Login Shipping Calculator

I'm working on a 4.1.8 site using Fast Lane Checkout and user defined shipping rates. All my shipping rates and taxes are set by zipcode only. No states.

In cart.php right after
x_session_register("ga_track_commerce");

add this:
Code:
x_session_register("zipcode_estimate"); x_session_register("default_country_estimate"); if($zip_estimate == "clear") { $zipcode_estimate = ""; func_header_location("cart.php"); } if(!empty($zip_estimate)) { $zipcode_estimate = $zip_estimate; $default_country_estimate= $country_estimate; if($country_estimate == "US") { $count = substr_count($zipcode_estimate,"0") + substr_count($zipcode_estimate,"1") + substr_count($zipcode_estimate,"2") + substr_count($zipcode_estimate,"3") + substr_count($zipcode_estimate,"4") + substr_count($zipcode_estimate,"5") + substr_count($zipcode_estimate,"6") + substr_count($zipcode_estimate,"7") + substr_count($zipcode_estimate,"8") + substr_count($zipcode_estimate,"9"); if($count != 5) //checking for 5 digits $zipcode_estimate = ""; } if(($country_estimate == "CA" || $country_estimate == "GB") && strlen($zipcode_estimate)!=6) $zipcode_estimate= ""; if($mode=="checkout") func_header_location("cart.php?mode=checkout"); else func_header_location("cart.php"); } if($zipcode_estimate != "") { $config["General"]["default_country"] = $default_country_estimate; $config["General"]["apply_default_country"] = "Y"; $config["General"]["default_zipcode"] = $zipcode_estimate; $config["General"]["default_state"] = ""; $smarty->assign("estimate","NO"); } $smarty->assign("zipcode_estimate",$zipcode_estimate);

In /skin1/modules/Fast_Lane_Checkout/cart_subtotal.tpl right after

{$cart.applied_giftcerts[gc].giftcert_id} <a href="cart.php?mode=unset_gc&gcid={$cart.applied_g iftcerts[gc].giftcert_id}"><img src="{$ImagesDir}/clear.gif" width="11" height="11" border="0" valign="top" alt="{$lng.lbl_unset_gc|escape}" /></a> : <font class="ProductPriceSmall">{include file="currency.tpl" value=$cart.applied_giftcerts[gc].giftcert_cost}</font><br />
{/section}
{/if}

add
Code:
{* BCSE Begin *} {if $login} {else} {if $estimate ne "NO"} <br> <BR>Zip Code: <input type=TEXT name='zip_estimate' size=6 maxlength=6>&nbsp;&nbsp; <select name='country_estimate'> <option value="US">United States</option> <option value="CA">Canada</option> <option value="GB">United Kingdom</option> </select>&nbsp;&nbsp; {include file="buttons/button.tpl" button_title="Calculate Shipping" href="javascript: document.cartform.submit()" js_to_href="Y"} <br> {$lng.txt_order_total_msg} {else} <p>Current zip code: {$zipcode_estimate} <a href="cart.php?zip_estimate=clear">Click here to change your zip code</a> {/if} <BR><BR> {/if} {* BCSE End *} {if $login ne "" || $config.General.apply_default_country eq "Y" || $cart.shipping_cost gt 0 || $estimate eq "NO"} {foreach from=$shipping item=s} <table cellpadding="1" cellspacing="0" width="50%"{cycle values=" class='TableSubHead', "}> <tr> <td align="right"><label for="shippingid{$s.shippingid}">{$s.shipping|trademark:$insert_trademark}{if $s.shipping_time ne ""} - {$s.shipping_time}{/if}{if $config.Appearance.display_shipping_cost eq "Y" and ($login ne "" or $config.General.apply_default_country eq "Y" or $cart.shipping_cost gt 0)} ({include file="currency.tpl" value=$s.rate}){/if}</label></td> </tr> </table> {/foreach} <br /><br /> {/if}

It displays the costs for shipping but does not allow for a selection. I tried a bit but couldn't get it the selection to pass through to the rest of the checkout. Taxes show up also.

Jeanne
-------------
4.0.18 live store
4.1.8 in development
Reply With Quote