I just installed this on a 4.0.4 version today. Here's the code I used:
In cart.php After:
Code:
x_session_register("cart");
x_session_register("intershipper_rates");
x_session_register("intershipper_recalc");
x_session_unregister("secure_oid");
x_session_register("extended_userinfo");
x_session_register("anonymous_checkout");
x_session_register("payment_cc_fields");
x_session_register("current_carrier");
Insert:
Code:
x_session_register("zipcode_estimate");
if($zip_estimate == "clear")
{
$zipcode_estimate = "";
func_header_location("cart.php");
}
if(!empty($zip_estimate))
{
$zipcode_estimate = $zip_estimate;
$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($mode=="checkout")
func_header_location("cart.php?mode=checkout");
else
func_header_location("cart.php");
}
if($zipcode_estimate != "")
{
$config["General"]["apply_default_country"] = "Y";
$config["General"]["default_zipcode"] = $zipcode_estimate;
$smarty->assign("estimate","NO");
}
Then in skin1/customer/main/cart_totals.tpl Before:
Code:
{if $not_logged_message eq "1"}{$lng.txt_order_total_msg}{/if}
Add:
Code:
{* BCSE Begin *}
{if $login}
{else}
{if $estimate ne "NO"}
Enter your zip code to calculate shipping charges.
<input type=TEXT name='zip_estimate' size=5 maxlength=5>
{include file="buttons/button.tpl" button_title="Calculate Shipping" href="javascript: document.cartform.submit()" js_to_href="Y"}
{else}
Click here to change your zip code
{/if}
{/if}
{* BCSE End *}
Hope this helps! Thanks for the original code rackit!
Carrie