If, for example, you were trying to do this with USPS you could edit the shipping class:
/includes/classes/shipping.php
and add the code in RED:
Then edit the USPS shipping module: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 (int)MODULE_SHIPPING_FREESHIPPER_ZONE global $db, $order, $cart; $valid_zone_id = (int)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; } // bof: allow 1 zone only for Always Free Shipping
/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 (int)MODULE_SHIPPING_FREESHIPPER_ZONE $this->enabled = TRUE; // eof: allow 1 zone only for Always Free Shipping (int)MODULE_SHIPPING_FREESHIPPER_ZONE if ($this->enabled == true) {then, on the Products for Always Free Shipping, mark them as such and add the weight that the shipping modules should use when the Product is not being sent to a Zone for Free Shipping ...Code:// bof: allow 1 zone only for Always Free Shipping (int)MODULE_SHIPPING_FREESHIPPER_ZONE //echo 'I see quantity: ' . ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping', 1)) . '<br>'; $valid_zone_id = (int)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; } // eof: allow 1 zone only for Always Free Shipping (int)MODULE_SHIPPING_FREESHIPPER_ZONE global $template, $current_page_base; // CUSTOMIZED CONDITIONS GO HERE
Now, in the shipping module for FREE SHIPPING! freeshipper, set your Zone that is allowed the Always Free Shipping on these Products ...


Reply With Quote
