The following solution seems to be working as I intended in my previous post.
Around line 200 of includes/modules/order_total/ot_coupon.php
PHP Code:
$products = $_SESSION['cart']->get_products();
$foundvalid = true;
if ($foundvalid == true) {
$foundvalid = false;
for ($i=0; $i<sizeof($products); $i++) {
if (is_product_valid($products[$i]['id'], $coupon_result->fields['coupon_id'])) {
$foundvalid = true;
continue;
}
}
}
//BOF Restrictive Free Shipping -- Invalidate Coupon if order contains ANY restricted items
if ($coupon_result->fields['coupon_type'] == 'S') {
$products = $_SESSION['cart']->get_products();
$validproducts = 0;
$totalproducts= sizeof($products);
for ($i=0; $i<sizeof($products); $i++) {
if (is_product_valid($products[$i]['id'], $coupon_result->fields['coupon_id'])) {
$validproducts= $validproducts +1;
continue;
}
}
}
if ($totalproducts > $validproducts) {
$messageStack->add_session('redemptions', TEXT_INVALID_RESTRICTIVE_FREE_SHIPPING,'caution');
$this->clear_posts();
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL',true, false));
}
//EOF Restrictive Free Shipping
if (!$foundvalid) {
$this->clear_posts();
}
add the following line somewhere in includes/languages/custom/english.php :
PHP Code:
define('TEXT_INVALID_RESTRICTIVE_FREE_SHIPPING', 'Some items in your cart do not qualify for FREE SHIPPING. Remove them and re-enter coupon code.'
Bookmarks