Shipping Module Programming Question about weight and free shipping
I would like to identify if a customer is a USA customer in shipping.php to make a decision on whether or not to add the Free Shipping weight back to $total_weight. Can someone direct me to the correct variable that would allow me to do this?
Something to the effect of:
if (USA customer)
$total_weight -= $_SESSION['cart']->free_shipping_weight();
else
$total_weight += $_SESSION['cart']->free_shipping_weight();
Thanks.
Re: Shipping Module Programming Question
Did you look at your original post and read the post that I just posted for reference?
http://www.zen-cart.com/forum/showth...75#post1050375
NOTE: if you continue to have problems, please respond to this post so we can work on your specific issues ...
Re: Shipping Module Programming Question
Thanks for the reply. This looks like the thing I wanted to do. The only question I have is how or where are the valid_zone_id's defined? I would like have free shipping to all 50 states + DC.
I assume that I would need to make similar changes to the UPS module as done for the USPS module to have both options?
Out of curiosity, was the way I was wanting to go about this not going to work or not the right way to do it? The reason I ask is that it seemed to work when testing by changing shipping.php and adding items either as a USA customer or changing shipping.php and adding items as a non-USA customer.
Thanks.
Re: Shipping Module Programming Question
To make Always Free Shipping only work for the US 50+ States ... you would first want to make sure it works with the USPS shipping as described in post #11 ...
If so, then you would need to adapt that code to UPS if you are also using that shipping module ...
Have you tried the customization on the USPS shipping module:
/includes/modules/shipping/usps.php
and the Shipping class file:
/includes/class/shipping.php
If so, is the USPS shipping module working correctly?
Re: Shipping Module Programming Question
Is the $valid_zone_id the number found in the geo_zone_id in table zones_to_geo_zones?
Re: Shipping Module Programming Question
I seemed to have answered my question from above. Now, I've implemented to changes but I need to do one more thing. I still need to show all of the shipping options with the actual weight used in the calculations even though Free Shipping is enabled to allow the customer the opportunity to select a faster option if they want. For Free Shipping, we will select the most cost effective method whereas the customer may want to use Express and pay the additional cost. How would I implement this option?
Re: Shipping Module Programming Question
What is the full goal here?
Do you want All US Customers to get Free Shipping plus the regular shipping methods and non-US to get just the regular shipping methods?
What shipping modules do you have installed? :unsure:
Re: Shipping Module Programming Question
Exactly. This way the customer gets to make the shipping choice that best fits their situation. My installed modules are Free Shipping, USPS, and UPS.
Re: Shipping Module Programming Question
Does the US always get the Free Shipping Option regardless of Products in the cart? :unsure:
Re: Shipping Module Programming Question
No. Only the products marked as Always Free Shipping for USA customers have that option. Everything else should add the associated weight to the total.