The ultimate goal is to have just a few products that include Ground shipping. If a customer selects an item that is "free ship", they also have a choice to pay for faster shipping.
The ultimate goal is to have just a few products that include Ground shipping. If a customer selects an item that is "free ship", they also have a choice to pay for faster shipping.
If you add weight to all Products ... and mark those for Free Shipping to the US as Always Free Shipping ...
You can make the following customizations ...
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:
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_FREEOPTIONS_STATUS == 'True') ? true : false); } // bof: Always Free Shipping if (!IS_ADMIN_FLAG) { global $cart; echo 'Always Free: ' . $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') . ' Count: ' . $_SESSION['cart']->count_contents(); if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) { $this->enabled = true; } } // eof: Always Free Shipping if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {
Edit the code for the shipping class 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); // }
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 ...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)) {
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Thank you Oba-san. Let me try this out.
Ok, I put this up on the testing server and it works well.
I did have to change this
to thisPHP Code:if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
$this->enabled = true;
}
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.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;}
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:
to 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) );
What do you think ?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) );
}
Thanks
Are you saying ...
On a cart that is Always Free Shipping ...
the US only gets:
Always Free Shipping
International gets:
UPS for weight of the Product
On a cart that is mixed Normal products and Always Free Shipping ...
the US only gets:
UPS for the weight of ONLY the Products not marked Always Free Shipping
International gets:
UPS for weight of ALL the Products
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Yes, and at the same time, any cart with free ship items, mixed or not will have the ability to upgrade their shipping from Ground at the UPS weight of all the items.
Right now, the way the custom code is working is if the cart is Always Free Shipping products only, the US gets:
Free Shipping Options
UPS - for ALL Products with weight
So if you have a Product with the weight of 1.5lbs *and* marked as Always Free Shipping, the US gets the:
Free Shipping Options
UPS - for 1.5 lb quote
Non-US gets:
UPS - for 1.5 lb quote
If you have a Mixed cart where 1 Product is weight of 1.5lbs *and* marked as Always Free Shipping and another Product is weight 2lbs and NOT Always Free Shipping the US gets the:
UPS - for 3.5lb quotes
Non-US gets:
UPS - for 3.5lb quotes
What are you wanting that is different?![]()
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Note: If you're using anything prior to 1.3.9a you will need to correct the class shopping_cart.php as follows around 654:
// shipping adjustments
if (($product->fields['product_is_always_free_shipping'] == 1) or ($product->fields['products_virtual'] == 1) or (preg_match('^GIFT', addslashes($product->fields['products_model'])))) {
$this->free_shipping_item += $qty;
$this->free_shipping_price += zen_add_tax($products_price, $products_tax) * $qty;
//$this->free_shipping_weight += ($qty * $products_weight);
$this->free_shipping_weight += ($qty * $product->fields['products_weight']);
}