This takes a little work ...
Let's say we do not want to have products_id 47 and 32 included in the price check when the Free Shipping in the Modules ... Order Totals ... Shipping ot_shipping is set to 50.00 and enabled ...
First, create a new file:
/includes/functions/extra_functions/reduce_free_shipping.php
and add the code:
Code:
<?php
// calculate amount not to be used for Products 186 and 10 for free shipping
function reduce_free_shipping() {
global $cart;
$exclude_products = "47, 32";
$products = $_SESSION['cart']->get_products();
$chk_price = 0;
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
if (in_array((int)$products[$i]['id'], explode(",", $exclude_products))) {
$chk_price += $products[$i]['final_price'] * $products[$i]['quantity'];
}
} // end FOR loop
return $chk_price;
}
?>
Next, we have to customize a few files:
/includes/modules/shipping_estimator.php
and use your templates and overrides for:
/includes/modules/your_template_dir/shipping_estimator.php
and change around line 158:
Code:
if ( ($pass == true) && ($_SESSION['cart']->show_total() - reduce_free_shipping() >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) {
Then we have to adjust the headers for the checkout_shipping, checkout_payment and checkout_confirmation ...
Change the code around line 121:
/includes/modules/pages/checkout_shipping/header_php.php
Code:
if ( ($pass == true) && ($_SESSION['cart']->show_total() - reduce_free_shipping() >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
Change the code around line 36:
/includes/modules/pages/checkout_payment/header_php.php
Code:
if (isset($_SESSION['shipping']['id']) && $_SESSION['shipping']['id'] == 'free_free' && defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER') && $_SESSION['cart']->show_total() - reduce_free_shipping() < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
Change the code around line 43:
/includes/modules/pages/checkout_confirmation/header_php.php
Code:
if (isset($_SESSION['shipping']['id']) && $_SESSION['shipping']['id'] == 'free_free' && defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER') && $_SESSION['cart']->show_total() - reduce_free_shipping() < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
Then, what I think is the final change around line 34:
/includes/modules/order_total/ot_shipping.php
Code:
if ( ($pass == true) && ( (($order->info['total'] - reduce_free_shipping()) - $order->info['shipping_cost']) >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
Now, if the Order Total, less the amount of the Products with products_id 47 and 32, is >= 50.00, as set in the Shipping ot_shipping, the shipping will be Free ...
Easy smeazy, eh?
That only took all morning ...
Bookmarks