Oba-san
- Join Date:
- Sep 2003
- Location:
- Ohio
- Posts:
- 62,757
- Plugin Contributions:
- 1
Apply coupon discount to more than one line item
This should work for you ...
Edit the file:
/includes/modules/order_total/ot_coupon.php
and add the code in RED:
if (strval($orderTotalDetails['orderTotal']) >= $coupon->fields['coupon_minimum_order'])
{
[B]if ($coupon->fields['coupon_type'] == 'F' || $coupon->fields['coupon_type'] == 'O') {
global $cart;
$products = $_SESSION['cart']->get_products();
$coupon_product_count = 0;
for ($i=0; $i<sizeof($products); $i++) {
if (is_product_valid($products[$i]['id'], $coupon->fields['coupon_id'])) {
$coupon_product_count += $_SESSION['cart']->get_quantity($products[$i]['id']);
}
}
//$messageStack->add_session('checkout_payment', 'Coupon cont: ' . $coupon_product_count, 'caution');
}
[/B] switch($coupon->fields['coupon_type'])
Then edit the line:
case 'F':
$od_amount['total'] = zen_round($coupon->fields['coupon_amount'] * ($orderTotalDetails['orderTotal']>0)[B] * $coupon_product_count[/B], $currencyDecimalPlaces);
$od_amount['type'] = $coupon->fields['coupon_type']; // amount off 'F' or amount off and free shipping 'O'
$ratio = $od_amount['total']/$orderTotalDetails['orderTotal'];
break;
Linda McGrath
If you have to think ... you haven't been zenned ...
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!