X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Pre-Login Shipping Calculator (https://forum.x-cart.com/showthread.php?t=6927)

bpuklich 09-20-2008 09:24 AM

Re: Pre-Login Shipping Calculator
 
Quote:

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).

Mudjocky 11-14-2008 05:14 PM

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

brianlandis 02-27-2009 02:25 PM

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"

bcam 09-01-2010 07:46 AM

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.

starwest 09-01-2010 04:15 PM

Re: Pre-Login Shipping Calculator
 
Quote:

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.

jillsybte 11-29-2010 09:16 AM

Re: Pre-Login Shipping Calculator
 
3 Attachment(s)
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]:
Code:

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]:
Code:

# 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.

Thanks,
Jill

PS
I did try emptying the shipping_cache table and that didn't help.


All times are GMT -8. The time now is 05:51 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.