There are several steps to follow to allow Free Shipping for 1 Zone and everyone else gets charged ...
Edit the file:
/includes/classes/shipping.php
and add the 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
// Always Free Shipping added back except for anyone in MODULE_SHIPPING_FREESHIPPER_ZONE
global $db, $order, $cart;
$valid_zone_id = MODULE_SHIPPING_FREESHIPPER_ZONE;
$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;
}
// Always Free Shipping added back except for anyone in MODULE_SHIPPING_FREESHIPPER_ZONE
// eof: allow 1 zone only for Always Free Shipping
$this->abort_legacy_calculations = FALSE;
Edit the file:
/includes/modules/shipping/usps.php
and add the code in RED:
Code:
function update_status() {
global $order, $db;
if (IS_ADMIN_FLAG == TRUE) return;
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code) == FALSE) $this->enabled = FALSE;
// bof: allow 1 zone only for Always Free Shipping
// Always Free Shipping added back except for anyone in MODULE_SHIPPING_FREESHIPPER_ZONE
if (!IS_ADMIN_FLAG) {
//echo 'I see quantity: ' . ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping', 1)) . '<br>';
$this->enabled = (MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false;
if ($this->enabled) {
$valid_zone_id = MODULE_SHIPPING_FREESHIPPER_ZONE;
$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) {
if ($_SESSION['cart']->count_contents() == $_SESSION['cart']->in_cart_check('product_is_always_free_shipping', 1)) {
$this->enabled = false;
} else {
$this->enabled = true;
}
} else {
$this->enabled = true;
}
}
}
// bof: allow 1 zone only for Always Free Shipping
// Always Free Shipping added back except for anyone in MODULE_SHIPPING_FREESHIPPER_ZONE
if ($this->enabled == true) {
if ((int)MODULE_SHIPPING_USPS_ZONE > 0) {
Now set the Zone on the Modules ... Shipping ... FREE SHIPPING freeshipper to your US 48 shipping zone ...
What this should do is allow the Free Shipping to work for the US 48 and everyone else will be charged the weight from the Product Weight ...
See if this does it for you ...
Bookmarks