Hey BSCE,
I have X-Cart 4.0.19 I installed your modification but I found a little glitch in my site with it. Goto
www.biodieselwarehouse.com then add some items to your cart. Then put in a test zip code....then click CHECKOUT....it will then ask you for all your personal info...but BEFORE entering it....click the
Click to change your Zip Code link. It ends up making my layout all screwy. ANy suggestions? Thanks!
-Mike Lannen
-X-Cart Gold 4.0.19
-Linux
-UPS Real Time Calculator
Quote:
Originally Posted by BCSE
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
|