Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Pre-Login Shipping Calculator

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 03-30-2004, 03:39 PM
 
rackit rackit is offline
 

Advanced Member
  
Join Date: Jan 2004
Posts: 31
 

Default Pre-Login Shipping Calculator

It would great if users could fill in their zip code and receive an estimate on their shipping cost based on the items currently in their cart. I know that some customers don't want to fill in all their contact information to find out the shipping charge. Does anyone else think this would be a good addition?

Edit: Here's my solution..

This works using a lot of methods already built into X-Cart. All that was required was manipulating them to do what I wanted. There's an option in General Settings that allows you to presume a customer is from a default country when not logged in. When this option is enabled, shipping charges are calculated automatically as items are added to the cart. What this modification does is enable this option when a user enters his/her zip code and changes the default zip code to what was entered.

To start off, the option "When a customer isn't logged in, it is presumed that he is from a default country." must be UNCHECKED (disabled). Secondly, replace this code in cart.php:

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");

with this code:

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("zipcode_estimate"); if($HTTP_GET_VARS['zip_estimate'] == "clear"){ $zipcode_estimate = ""; func_header_location("cart.php"); } if(!empty($HTTP_POST_VARS['zip_estimate'])){ $zipcode_estimate = $_POST['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 = "";} func_header_location("cart.php"); } if($zipcode_estimate != ""){ $config["General"]["apply_default_country"] = "Y"; $config["General"]["default_zipcode"] = $zipcode_estimate; $smarty->assign("estimate","NO"); }


The last thing to do is add the the input box in a template. cart_total.tpl seems like an obvious place for me. This is the code I put in my template:

Code:
{if $not_logged_message eq "1"} {if $estimate ne "NO"} Enter your zip code to calculate shipping charges. <input type=TEXT name='zip_estimate' size=5 maxlength=5> <input type=image alt="Calculate Shipping" src="../skin1/images/calculate.gif" border=0 align=middle name=btnCalculate > {else} Click here to change your zip code {/if} {/if}

You can check it out in action at www.rack-it.com. A quick warning, if you add any product made by Yakima on my site that is over $50, the shipping will be free and this mod won't do anything.
Reply With Quote
  #2  
Old 03-30-2004, 05:25 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Tried to get something like this built, but the developer came up short.

Would be a handy item to have, but first we need shipping by Postal Code up here in CANADA. X-Cart are you listening?
Reply With Quote
  #3  
Old 03-30-2004, 09:26 PM
 
jeeya jeeya is offline
 

X-Adept
  
Join Date: May 2003
Location: USA
Posts: 807
 

Default

all I wish for is to offer free shipping based on certain states or countries.
__________________
X-Cart Version 4.1.8
Hosted on Linux
Reply With Quote
  #4  
Old 03-30-2004, 10:02 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Raxitpatel,

You can already so this. I checked your site and the rates look like you are not using the USPS realtime shipping. All of your shipping is manual.

Just put the states or countries you want to have free shipping in their own individual zones. Then create new "Free Shipping" methods and link them to the zones in the Shipping charges page.

I hope this makes sense. I am really tired. I'll check back tomorrow.
Reply With Quote
  #5  
Old 04-02-2004, 04:51 PM
 
rackit rackit is offline
 

Advanced Member
  
Join Date: Jan 2004
Posts: 31
 

Default

Ok, I figured out a way to do this, but I need a little bit of help. If anyone knows how to set up session variables, it would great if you could help me out. It works the way I have it right now, but I would like the shopping cart to remember the person's zip code through the first step of checkout or if the person goes to shop around a bit more and then goes back to the cart.

edit: Nevermind!

I figured out the session variable thing. I'll try to have it done and posted in an hour or so, but it's friday night and I have better things to do. (oddly )
Reply With Quote
  #6  
Old 04-04-2004, 09:54 PM
 
rackit rackit is offline
 

Advanced Member
  
Join Date: Jan 2004
Posts: 31
 

Default

It's up and running now. Check it out www.rack-it.com

My code is sloppy right now so I'm cleaning it up. I'll post it when it's nice and neat.
Reply With Quote
  #7  
Old 04-06-2004, 07:16 AM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Rackit,

Please post that, it's awesome.
Reply With Quote
  #8  
Old 04-06-2004, 07:16 PM
 
rackit rackit is offline
 

Advanced Member
  
Join Date: Jan 2004
Posts: 31
 

Default

Edit: moved the code to the first post.
Reply With Quote
  #9  
Old 05-27-2004, 11:52 AM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

Looks good.... just one problem, I'm from Canada and I buy most of my big ticket items on the web. My postal code is P0H 1A0... doesn't work.
I'm more of an American at heart really, I've travelled through the U.S. more than I have Canada and I buy a lot from the States. I know every single person we've had running our country has been an idiot who can't speak right or has some wierd deformation but the rest of us up here are really o.k. (and we're better at hockey and your beer is for little girls ), so you Southern Boys are gonna' have to allow for Canadian purchases. I don't blame you for wanting to shut us out because of the people running this place but give the rest of us a break.

[UPDATE] I guess I have to eat my words regarding hockey but at least I can wash them down with real beer
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #10  
Old 05-27-2004, 08:07 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Most shipping calculators that are built into sites do not allow for international postal code lookup.

I will test integration of this into the Canada Post Sell Online module built into 3.5.x and report back if I can get lookup for Canadian business to Canadian addresses working.

All you need to do is add a note under the text box for postal code, indicating that non US customers click HERE for a pop up rate box.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:37 AM.

   

 
X-Cart forums © 2001-2020