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

Pre-Login Shipping Calculator

   X-Cart forums > X-Cart 4 > Dev Questions
Thread Tools Search this Thread
Old 09-20-2008, 09:24 AM
bpuklich bpuklich is offline

Join Date: Jun 2007
Posts: 5

Default Re: Pre-Login Shipping Calculator

Originally Posted by ShopCart
Did anyone find a solution to the double listing problem?

I think I've found out why. The One Page Checkout module makes a call to the X-Cart function func_get_shiping_methods_list in the checkout_one_shipping.php file, and merges the results with the $shipping PHP variable. Unfortunately, $shipping already has values at this point (or gets them later - I haven't dug far enough to know yet). So, we get duplicate shipping methods.

You can temporarily test this by commenting out the offending line in the checkout_one_shipping.php file, however I'm sure that will break something else.

I'll probably add a hack to remove the duplicates from the $shipping array in the shipping_estimator.php file that BCSE supplied with their free mod, unless someone else has a better idea (and I'm sure there is, I just haven't dug far enough).
Blayne Puklich - excelcycle
X-Cart v4.4.4 linux
Reply With Quote
Old 11-14-2008, 05:14 PM
  Mudjocky's Avatar 
Mudjocky Mudjocky is offline

Advanced Member
Join Date: Nov 2008
Posts: 62

Default Re: Pre-Login Shipping Calculator

I have installed this code and it works great...however: I'd like to get it to not show up if there is only one item in the cart that has 'free shipping' or 'pre set shipping' as it comes up 'no shipping method to your zipcode' and I'm scared the customers may think something is broken. If there is not a way to do this is there a way to put a note on that page describing 'item with free shipping or set shipping surcharges will not function in shipping calculator". ? thank you so much in advance
Version 4.1.11
Version 4.2.2
Version 4.3.1
Version 4.4.2;3
Reply With Quote
Old 02-27-2009, 02:25 PM
brianlandis brianlandis is offline

Join Date: Mar 2007
Posts: 23

Default Re: Pre-Login Shipping Calculator

Is there any way to tie shipping markups into the shipping estimator? We're running real time shipping for UPS and USPS and we'd like the estimator to reflect an additional $5 for certain methods that are set up within "Shipping markups"
X-Cart Gold 4.1.6
Reply With Quote
Old 09-01-2010, 07:46 AM
bcam bcam is offline

Join Date: May 2005
Posts: 26

Default Re: Pre-Login Shipping Calculator

I know this is an old thread, but I'm wondering if I can enable both UPS and USPS calculations in this pre-login shipping cost calculator. Currently only UPS shows, while both show in the next checkout page.
X-Cart Gold 4.4.2
Linux VPS
Reply With Quote
Old 09-01-2010, 04:15 PM
starwest starwest is offline

Join Date: Sep 2006
Posts: 268

Default Re: Pre-Login Shipping Calculator

Originally Posted by bcam
I know this is an old thread, but I'm wondering if I can enable both UPS and USPS calculations in this pre-login shipping cost calculator. Currently only UPS shows, while both show in the next checkout page.

Yes, this is possible, and we have it setup on our site. Unfortunately, I'm not sure where the code changes need to be made. Perhaps someone else can chime in with that nugget. If not, any of the recommended developers could probably handle this for you in a few minutes.
X-Cart Gold v4.1.10 [unix]
AOM, Special Offers, CDSEO Pro, Remember Anon Carts, Back-In-Stock Notifications, MM3, Feed Manager
Reply With Quote
Old 11-29-2010, 09:16 AM
jillsybte jillsybte is offline

Join Date: Jun 2006
Location: New York, USA
Posts: 389

Default Re: Pre-Login Shipping Calculator

I have been using the BCSE pre-login shipping calculator with Xcart 4.1.8 for over 3 years. As far as I know, it has always worked correctly. I have never noticed a miscalculation myself or had a customer complain that final shipping charges were higher than those initially estimated.

I did change the estimator to allow for shipping calculations for both logged in and not logged in customers. When logged in, the shipping charges are displayed based on the customer's profile info.

Recently, I made a change to include/func/func.cart.php to allow for a percent shipping discount. I added a parameter called disc_p to the shipping_rates table and added to the shipping calculation in func.cart.php to allow disc_p/100 * shipping cost to be subtracted from the shipping cost. This was several weeks ago and I didn't notice any problems with the shipping estimator at the time. However, last night, I noticed the estimator was giving lower-than-actual rates when the customer is not logged in. For instance, when an item of 3 lbs was in the cart, the initial rates returned were for 1 lb. Refreshing the cart.php page returned the correct rates, and the correct rates showed when logged in.

I have attached the original and modified xcart/skin1/customer/main/shipping_estimator.tpl in case anyone sees an error I have made that could be causing this problem. I have also attached include/shipping_estimator.php, which shows the small bit of code I commented out.

For the disc_p addition, I changed the calculations in func.cart.php to [lines 997-1004]:
if ($shipping && $total_ship_items > 0) { $shipping_cost = $shipping[0]["rate"] + ($total_weight_shipping * $shipping[0]["weight_rate"]) + ($total_ship_items * $shipping[0]["item_rate"]) + ($total_shipping * $shipping[0]["rate_p"] / 100); $shipping_cost -= ($shipping_cost * ($shipping[0]["disc_p"] / 100)); }

AND [lines 1007-1018]:
# Get realtime shipping rates # $result = func_query_first ("SELECT * FROM $sql_tbl[shipping] WHERE shippingid='$shipping_id' AND code!=''"); if ($config["Shipping"]["realtime_shipping"]=="Y" && $result && $total_ship_items>0) { $shipping_cost = func_real_shipping($shipping_id); $customer_zone = func_get_customer_zone_ship($customer_info, $provider,"R"); $shipping_rt = func_query("SELECT * FROM $sql_tbl[shipping_rates] WHERE shippingid='$shipping_id' $provider_condition AND zoneid='$customer_zone' AND mintotal<='$total_shipping' AND maxtotal>='$total_shipping' AND minweight<='$total_weight_shipping' AND maxweight>='$total_weight_shipping' AND type='R' ORDER BY maxtotal, maxweight"); # Added percent shipping discount to formula if ($shipping_rt && $shipping_cost > 0) $shipping_cost += $shipping_rt[0]["rate"]+$total_weight_shipping*$shipping_rt[0]["weight_rate"]+$total_ship_items*$shipping_rt[0]["item_rate"]+$total_shipping*$shipping_rt[0]["rate_p"]/100; $shipping_cost -= ($shipping_cost*($shipping_rt[0]["disc_p"]/100)); }

I also use real-time shipping (USPS only) and the BCSE shipping-per-product mod. The disc_p value is 0 for all subtotals below $50. Then it is 100 for USPS Media Mail (so MM orders of $50+ ship free anywhere), and 10 to 70 for other methods and destinations.

I have been staring at this too long and hop that a fresh look by someone may reveal an answer. One solution would seem to be to get the cart.php page to refresh on its own. Is there a good way to do that? Any other suggestions would be appreciated. I like online stores that allow me to preview shipping costs so I would like to continue offering this feature in my store.

I don't like to leave my site link here, but if anyone wants to try the shipping calculator in my store and report his/her results, PM me for the link.


I did try emptying the shipping_cache table and that didn't help.
Attached Files
File Type: tpl shipping_estimatorOrig.tpl (2.2 KB, 115 views)
File Type: tpl shipping_estimator.tpl (7.3 KB, 120 views)
File Type: php shipping_estimator.php (914 Bytes, 108 views)
X-Cart Gold 4.1.8 (Live)
BCSE Shipping Estimator for FLC Mod
BCSE Shipping Methods per Product Mod
BCSE Customer Review Management Mod
BCSE Catalog Order Form Mod
X-Cart Gold 4.5.2 (Building/Testing)
Reply With Quote

The following user thanks jillsybte for this useful post:
exitodirect (11-19-2011)
   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 09:43 AM.


X-Cart forums © 2001-2020