Ok I think I got it.
For a Store that offers free UPS GROUND shipping on only some items to only the Lower 48.
Cart ->No Free Ship Items
Display -> Regular UPS Shipping Rates
---
Cart -> Free Ship Items Only
Display -> Free Shipping Options
Display -> UPS Upgraded Shipping Rates with no Ground Option
---
Cart -> Mixed Cart
Display -> UPS Ground Option based on the NON Free Ship Items
Display -> UPS Upgraded Shipping Rates based on All Items
Here is the First part based on Ajeh's Code on #8
Make a Zone Definition defined for the US Only ...
Install the Free Shipping Options freeoptions instead of the FREE SHIPPING! freeshipper ... and set the Total >= 0 and set the Zone to the new Zone Definition for the US Only ...
Edit the code for:
/includes/modules/shipping/freeoptions.php
to include 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) ) {
Edit the code for the UPS shipping module with the code in RED:
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);
// }
Edit the code for the shipping class with the code in RED:
Code:
function calculate_boxes_weight_and_tare() {
global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;
// bof: add back Free Shipping
global $cart;
$total_weight += $_SESSION['cart']->free_shipping_weight;
//
if (is_array($this->modules)) {
Now the Free Shipping Options freeoptions will only show for the US when the whole order is Always Free Shipping and the UPS will always show with the proper weight ...
Here is the Next Part of my solution for the mixed cart:
Around line 192 in the UPS shipping module, i changed this:
PHP Code:
$methods[] = array('id' => $type,
'title' => $this->types[$type],
'cost' => ($cost * $shipping_num_boxes ) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) );
to this:
PHP Code:
global $db, $order, $cart;
$valid_zone_id = (int)MODULE_SHIPPING_FREEOPTIONS_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 ($type=='GND' && $_SESSION['cart']->free_shipping_weight !=0 && $check_flag == true) {
if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
} else {
$adjusted_weight = ($ups_shipping_weight * $shipping_num_boxes) - ($_SESSION['cart']->free_shipping_weight);
(SHIPPING_MAX_WEIGHT > $adjusted_weight ? $adjusted_boxes = 1: $adjusted_boxes = ceil($adjusted_weight / SHIPPING_MAX_WEIGHT));
$adjusted_package = $adjusted_weight / $adjusted_boxes;
$this->_upsAction(3);
$this->_upsWeight($adjusted_package);
$gndQuote = $this->_upsGetQuote();
$gndcost = $gndQuote[0]['GND'];
$methods[] = array('id' => $type,
'title' => $this->types[$type] . " (Free Shipping + " . ($adjusted_package * $adjusted_boxes) ." lbs.)",
'cost' => ($gndcost * $adjusted_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $adjusted_boxes : MODULE_SHIPPING_UPS_HANDLING) );
}
} else {
$methods[] = array('id' => $type,
'title' => $this->types[$type],
'cost' => ($cost * $shipping_num_boxes ) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) );
}
I hope this helps someone too.
~D
Bookmarks