If you create a Zone Definition for who *IS* allowed to have Free Shipping for Products marked as Always Free Shipping, and add that Zone to the FREE SHIPPING! freeshipper shipping module ...
you can add the following code customizations in RED:
/includes/classes/shipping.php
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;
$this->notify('NOTIFY_SHIPPING_MODULE_PRE_CALCULATE_BOXES_AND_TARE');
/includes/modules/shipping/table.php
Code:
// bof: allow 1 zone only for Always Free Shipping
// if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
// }
// eof: allow 1 zone only for Always Free Shipping
if ($this->enabled) {
// check MODULE_SHIPPING_TABLE_HANDLING_METHOD is in
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_TABLE_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_TABLE_HANDLING_METHOD', 'Order', 'Do you want to charge Handling Fee Per Order or Per Box?', '6', '0', 'zen_cfg_select_option(array(\'Order\', \'Box\'), ', now())");
}
}
// 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) {
global $order, $db;
//echo 'I see quantity: ' . ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping', 1)) . '<br>';
$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
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLE_ZONE > 0) ) {
/includes/modules/shipping/zones.php
Code:
// disable only when entire cart is free shipping
// bof: allow 1 zone only for Always Free Shipping
// if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);
// }
// eof: allow 1 zone only for Always Free Shipping
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
$this->num_zones = 3;
// 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) {
global $order, $db;
//echo 'I see quantity: ' . ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping', 1)) . '<br>';
$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
if (IS_ADMIN_FLAG === true) {
// build in admin only additional zones if missing in the configuration table due to customization of default $this->num_zones = 3
Bookmarks