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"); with this code: Code:
x_session_register("cart"); 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"} 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. |
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? |
all I wish for is to offer free shipping based on certain states or countries.
|
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. |
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 :)) |
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. |
Rackit,
Please post that, it's awesome. |
Edit: moved the code to the first post.
|
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 8O 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 :roll: ), 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. :D [UPDATE] I guess I have to eat my words regarding hockey :oops: but at least I can wash them down with real beer :lol: |
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. |
removed
|
Anyone know the variables in 3.4.x that match those of this mod?
|
DogByteMan, unfortunately, I've never used 3.4.x so I'm not sure how to work it. If you send me a copy of your cart.php, I might be able to figure it out.
|
It appears that the variable in this line of code is wrong for 3.4.x
{if $not_logged_message eq "1"} Anybody know what this should be for 3.4.x in cart_totals.tpl Code:
{if $not_logged_message eq "1"} |
OK, it looks to me like 3.4.x doesn't have the equivalent of that variable, so we'll have to make one. Try adding this somewhere near the top of cart.php.
Code:
And, as always, BACK UP! :) |
That Did It! =D> \:D/
THANK YOU!!!! |
OK, first off a big THANK YOU to rackit for this mod!
rackit's mod for 3.4.x In Langages under Add New Entry enter the following lbl_calculate Calculate Calculate In edit templates - buttons/ create new file calculate.tpl Open calculate.tpl and insert this code Code:
<font class=FormButton>{$lng.lbl_calculate} <img { include file="buttons/go_image.tpl" }></font> In customer/cart.php Just Below This Code Code:
# Add This Code Code:
if(!$login){ Replacing or Deleting This Existing Code Which Is Already Included In The Above Code Code:
x_session_register("cart"); In customer/main/cart_totals.tpl Right Below This Code Code:
<TR> ADD This Code Code:
{if $not_logged_message eq "1"} Your Done! Again a HUGE THANK YOU to rackit! =D>[/code] |
\:D/
|
My post above has been edited to reflect a more consistent look and feel of the X-Cart
|
Has anyone gotten this to work on v3.5.8 yet? I had it working on 3.5.1 but have recently upgraded and can not get it to work again. Thanks!!
|
Anyone get this to work on version 3.3.5?
|
I am willing to pay if anyone can make this work with 3.3.5!
Please let me know! |
Quote:
LOL. I'll help you do it for free, but I'll have to see your cart.php and cart_totals.tpl files. Send me a message with them and I'll see what I can do. |
rackit is a true X-Cart community member =D>
|
Rackit,
I just sent you the code. Please let me know if you can help! Thanks a bunch!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! Quote:
|
Anything for v3.5.8 yet? Thanks!!
|
Kumar, I took a look at the code and I don't see a way to make it work. If I had access to all the functions, I might be able to make it work, but it would probably require a lot of changes. Sorry.
Donna, the original version was for 3.5.5, so I would imagine this works on 3.5.8. |
I've got version 3.4.14 and put in the code as stated above, but I get this error right below the form:Warning: Smarty error: unable to read template resource: "buttons/calculate.tpl" in /home/username/store-www/xcart/Smarty-2.5.0/Smarty.class.php on line 1042. I was wondering if anyone else is getting this error and if it is easily fixed. This is a great little mod and I would love to be able to use it.
-------------------------------------------------------------------------------- |
Rack-it--Your site looks great!
Unfortunately, I cannot get this to work in 3.5.8 either. I have the code in, the line and box appears in the cart, but when you enter the zip-code, the shipping stays at "N/A" and is not calculated. Any thoughts? |
If you send me your cart.php and cart_totals.tpl files, I can give it a try.
|
I would love to send you the files; I may be a moron, but can this be done via PM or can you PM me your email address?
|
you can copy and paste your code into the message or you can send an e-mail to greg@rack-it.com
|
modfied code
Hi,
I took a look at your cart.php and it looks exactly like mine. The only thing I can think off is that you maybe a slight error in adding the code. It might be easier if you send me your modified version of cart.php with my code in it. Greg |
Quote:
If your using Net::SSLeay, make sure you enter /usr/bin/perl as the full path to perl in the General Settings and see if that helps. If not, try libCURL to see if that makes it work. I had to change to libCURL to make it work originally, but once I entered the full path to perl i was able to switch back to Net::SSLeay. |
I am using Net::SSLeay, and I just added the /usr/bin/perl, but I still have the same result: I enter in a zip and the result shows "n/a"...it doesn't calculate. Any other ideas?
I hugely appreciate the help. |
I can't figure out why it isn't working in 3.5.8. Joe, have you tried setting up the default zip code in the settings? If so, does it work for you?
|
Are you using real-time shipping?
|
We are using FedEx rates, which were downloaded into x-cart.
When we turn on the default zip code and check the "When a customer isn't logged in, it is presumed that he is from a default country" box, the shipping rates are displayed properly. When we turn that option off and use the rack-it mod, it does not calculate shipping after entering a zip code. We have not changed to libCurl, because we had some major problems with it and authorize.net. Thanks for the help--I'm dying to get this to work! |
I'm afraid my experience is with UPS realtime shipping, but I can't see why it would not work for FedEx also.
|
Give Us Your Environment Info located in summary
|
All times are GMT -8. The time now is 12:33 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.