View Single Post
  #206  
Old 07-29-2007, 06:29 PM
  DogByteMan's Avatar 
DogByteMan DogByteMan is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 833
 

Default Re: Pre-Login Shipping Calculator

WARNING: I am not a programmer and I only tested this on my soon to be live 4.1.8 test store. But it is goooooood....

That Being said....

Pre-Login Shipping Calculator for X-Cart 4.1.8 With Fast Lane Checkout


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("anonymous_checkout"); x_session_register("payment_cc_fields"); x_session_register("current_carrier","UPS");

Insert:

Code:
#SHIPPING CALCULATOR 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"); } $intershipper_recalc = "Y"; #SHIPPING CALCULATOR

Copy the entire contents of skin1/customer/main/cart_totals.tpl

Highlight the entire contents of skin1/modules/Fast_Lane_Checkout/cart_subtotal.tpl and paste the contents of cart_totals.tpl over it.

(The contents of cart_subtotal.tpl is merely a stripped out version of cart_totals.tpl taking out the very thing we all want)


Now in the newly completely changed skin1/modules/Fast_Lane_Checkout/cart_subtotal.tpl place:

Code:
{* BCSE Begin *} {if $login} {else} {if $estimate ne "NO"} <br><b>Enter your zip code below to calculate shipping charges.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b><p><b>Enter Zip Code&nbsp;</b> <input type=TEXT name='zip_estimate' size=5 maxlength=5>&nbsp;&nbsp; {include file="buttons/button.tpl" button_title="Click Here To Calculate Shipping" href="javascript: document.cartform.submit()" js_to_href="Y"}&nbsp; {else} <p><a href="cart.php?zip_estimate=clear">Click here to change your zip code</a> ({$userinfo.s_zipcode}) {/if} <BR><BR> {/if} {* BCSE End *}

Just before:

Code:
{if $not_logged_message eq "1"} {$lng.txt_order_total_msg}{/if}

Finally, in languages, make a label "lbl_calc_title". It should say something like this "Order - Shipping Calculator"

In skin1/modules/Fast_Lane_Checkout/cart_subtotal.tpl find all occurences (3) of {$lng.lbl_delivery} and replace them with {$lng.lbl_calc_title}

If customer is logged in, Taxes will show on the cart/calculator page and this mod appears to not affect the checkout process at all.

YOUR DONE!!!!
__________________
Dedicated Server provided by EWD Hosting
X-Cart version 4.1.12
PHP 5.3.2
MySQL server 5.0.87-community
Operation system Linux
Perl 5.008008
dogbytecomputer.com
Reply With Quote