Okay let's try this one ...
REMOVE the Free Shipping Options freeoptions ...
INSTALL the FREE SHIPPING freeshipper and set the Zone to the US Only ...
Change the shipping class file:
/includes/classes/shipping.php
to read:
Code:
function calculate_boxes_weight_and_tare() {
global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;
// Add in Free Weight for anyone not in 1 zone
// bof: allow 1 zone only for Always Free Shipping
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 ($check_flag == false) {
$total_weight += $_SESSION['cart']->free_shipping_weight;
}
// bof: allow 1 zone only for Always Free Shipping
if (is_array($this->modules)) {
Change the UPS file:
/includes/modules/shipping/ups.php
Code:
// disable only when entire cart is free shipping
// if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_UPS_STATUS == 'True') ? true : false);
// }
if ($this->enabled) {
// check MODULE_SHIPPING_UPS_HANDLING_METHOD is in
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_UPS_HANDLING_METHOD'");
if ($check_query->EOF) {
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Handling Per Order or Per Box', 'MODULE_SHIPPING_UPS_HANDLING_METHOD', 'Box', 'Do you want to charge Handling Fee Per Order or Per Box?', '6', '0', 'zen_cfg_select_option(array(\'Order\', \'Box\'), ', now())");
}
}
// bof: turn off if zone 1 and weight is 0
if (!IS_ADMIN_FLAG) {
global $db, $order, $cart;
$chk_weight = round($_SESSION['cart']->show_weight(),9);
$chk_free_weight = round($_SESSION['cart']->free_shipping_weight, 9);
$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 ($check_flag == true && $chk_weight == 0) {
$this->enabled = false;
} else {
$this->enabled = true;
}
// echo '<BR>USPS shipping class delivery: ' . 'chk_weight: ' . $chk_weight . ' chk_free_weight: ' . $chk_free_weight . '<br>checkflag: ' . $check_flag . '<br> shipping: ' . $order->delivery['country']['id'] . ' state: ' . $order->delivery['state'] . ' zone: ' . $order->delivery['zone']['id'] . '<br><br>';
}
// eof: turn off if zone 1 and weight is 0
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_UPS_ZONE > 0) ) {
Change the USPS shipping module:
/includes/modules/shipping/usps.php
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);
// }
if ($this->enabled) {
// check MODULE_SHIPPING_USPS_HANDLING_METHOD is in
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_USPS_HANDLING_METHOD'");
if ($check_query->EOF) {
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Handling Per Order or Per Box', 'MODULE_SHIPPING_USPS_HANDLING_METHOD', 'Box', 'Do you want to charge Handling Fee Per Order or Per Box?', '6', '0', 'zen_cfg_select_option(array(\'Order\', \'Box\'), ', now())");
}
}
// bof: turn off if zone 1 and weight is 0
if (!IS_ADMIN_FLAG) {
global $db, $order, $cart;
$chk_weight = round($_SESSION['cart']->show_weight(),9);
$chk_free_weight = round($_SESSION['cart']->free_shipping_weight, 9);
$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 ($check_flag == true && $chk_weight == 0) {
$this->enabled = false;
} else {
$this->enabled = true;
}
// echo '<BR>USPS shipping class delivery: ' . 'chk_weight: ' . $chk_weight . ' chk_free_weight: ' . $chk_free_weight . '<br>checkflag: ' . $check_flag . '<br> shipping: ' . $order->delivery['country']['id'] . ' state: ' . $order->delivery['state'] . ' zone: ' . $order->delivery['zone']['id'] . '<br><br>';
}
// eof: turn off if zone 1 and weight is 0
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_USPS_ZONE > 0) ) {
Now see if a Cart of just Free US Products Only shows the FREE SHIPPING free shipper for the US and shows the UPS and USPS for the International ...
A Cart of Non-Free Shipping Products the US sees UPS and USPS and shows the UPS and USPS for the International ...
And a mixed cart for the US shows the UPS and USPS for only the weight that is not part of the Free Shipping Products and the International UPS and USPS shows the full weight of the Free Shipping Products plus the Non-Free Products ...
Bookmarks