Make sure ALL Products have weight to them ...
For Products with Free Shipping to the US, mark those as:
Always Free Shipping
To have it so that a shopping cart of:
1 ALL Always Free Shipping
Free Shipping
USPS for FULL weight of Always Free Shipping
2 MIXED Cart
USPS for weight of ONLY Products NOT Always Free Shipping
3 International
USPS for FULL weight regardless of Always Free Shipping
Try this ...
Make your Zone Definition for the US and check what it's zID is in the URL ... that number should be used where you see the 21 for the:
Code:
$valid_zone_id = 21;
to your zID ...
edit the file:
/includes/classes/shipping.php
and use this code in RED:
Code:
function calculate_boxes_weight_and_tare() {
global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;
// bof: allow 1 zone only for Always Free Shipping
//echo '<br>Starting weight: ' . $total_weight . '<br>';
global $db, $order, $cart;
$valid_zone_id = 21;
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . $valid_zone_id . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
$check->MoveNext();
}
// if not valid_zone_id
if ($check_flag == false) {
$total_weight += $_SESSION['cart']->free_shipping_weight;
//echo 'International ' . $total_weight . '<br>';
}
// if not valid_zone_id
if ($check_flag == true) {
if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
// add in weight if NOT ALL Always Free shipping
$total_weight += $_SESSION['cart']->free_shipping_weight;
//echo 'USA ALL FREE add weight ' . $total_weight . '<br>';
} else {
// do not add in weight if ALL Always Free shipping
//echo 'USA MIXED just non free shipping ' . $total_weight . '<br>';
}
}
// bof: allow 1 zone only for Always Free Shipping
if (is_array($this->modules)) {
The USPS shipping module:
/includes/modules/shipping/usps.php
should have:
Code:
// disable only when entire cart is free shipping
// if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
// }
The Free Shipping Options freeoptions:
/includes/modules/shipping/freeoptions.php
Make sure that you have that set for:
Total >= 0.00
and you should then have the US Zone set on it ...
Then, you should have the code in RED:
Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
}
// bof: Always Free Shipping
if (!IS_ADMIN_FLAG) {
global $cart;
if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
$this->enabled = true;
} else {
$this->enabled = false;
}
}
// eof: Always Free Shipping
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {
Does this do what you are trying to do here?
I would really consider how you are managing the US Free Shipping Only vs the US Mixed Cart ... make sure you really want to charge for the USPS in this manner ...
Put in your heaviest Always Free Shipping Product and look at the shipping ...
Now add in your lightest NOT Always Free Shipping Product ... and look at the shipping ... are you sure you want it to work like that?
Bookmarks