Ok, I put this up on the testing server and it works well.
I did have to change this
PHP Code:
if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
$this->enabled = true;
}
to this
PHP Code:
if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
$this->enabled = true;
} else {$this->enabled = false;}
So the problem then became how do we handle a mixed cart. With the above solution, A mixed cart would force the customer to pay shipping on the items that were free ship.
I came up with a way to handle a mixed cart, Although my method for recalculating the ground shipping "$mycost" was feeble at best, it's was only off by a dollar or so. I'm hoping there is a more accurate way to do it.
Here is what I did:
Around line 196, 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:
if ($type=='GND' && $_SESSION['cart']->free_shipping_weight !=0 ) {
if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
} else {
$mycost = $cost * (1-($_SESSION['cart']->free_shipping_weight / ($_SESSION['cart']->free_shipping_weight + $ups_shipping_weight)));
$methods[] = array('id' => $type,
'title' => $this->types[$type] . " (Free Shipping + " . (($ups_shipping_weight * $shipping_num_boxes) - $_SESSION['cart']->free_shipping_weight) ." lbs.)",
'cost' => ($mycost * $shipping_num_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_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) );
}
What do you think ?
Thanks