If I understand what you are trying to do, then you appear to want to add another 5% to Category X products if over 50.00 ...
Eidt the file:
/includes/classes/shopping_cart.php
and add the code in RED to the bottom of the file:
Code:
function in_cart_product_total_price_category($category_id) {
$products = $this->get_products();
//echo '<pre>'; echo print_r($products); echo '</pre>';
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
$productsName = $products[$i]['name'];
$ppe = $products[$i]['final_price'];
$ppt = $ppe * $products[$i]['quantity'];
$productsPriceEach = $ppe + $products[$i]['onetime_charges'];
$productsPriceTotal = $ppt + $products[$i]['onetime_charges'];
if ($products[$i]['category'] == $category_id) {
$in_cart_product_price += $productsPriceTotal;
}
} // end FOR loop
return $in_cart_product_price;
}
}
NOTE: that is added just before the existing closing bracket ...
Then, add the code in RED to the file:
/includes/modules/order_total/ot_coupon.php
Code:
$od_amount = array('tax'=>0, 'total'=>0);
global $discount_coupon;
$dc_check = $discount_coupon->fields['coupon_code'];
// bof: coupon add 5% to 1 category if over 50.00
if ($dc_check == '10OFFALL') {
$cat_id = 10;
$chk_disc = 0.00;
$chk_amount = $_SESSION['cart']->in_cart_product_total_price_category($cat_id);
if ($chk_amount >= 50.00) {
$chk_disc = $chk_amount * .05;
}
}
// bof: coupon add 5% to 1 category if over 50.00
if ($_SESSION['cc_id'])
and a little further down:
Code:
case 'P': // percentage
$od_amount['total'] = zen_round($orderTotalDetails['orderTotal']*($coupon->fields['coupon_amount']/100) + $chk_disc, $currencyDecimalPlaces);
$od_amount['type'] = $coupon->fields['coupon_type'];
$ratio = $od_amount['total']/$orderTotalDetails['orderTotal'];
break;
case 'E': // percentage & Free Shipping
$od_amount['total'] = zen_round($orderTotalDetails['orderTotal']*($coupon->fields['coupon_amount']/100) + $chk_disc, $currencyDecimalPlaces);
$od_amount['type'] = $coupon->fields['coupon_type'];
$ratio = $od_amount['total']/$orderTotalDetails['orderTotal'];
// add in Free Shipping
$od_amount['total'] = $od_amount['total'] + $orderTotalDetails['shipping'];
$od_amount['tax'] = ($this->calculate_tax == 'Standard') ? $orderTotalDetails['shippingTax'] : 0;
if (isset($_SESSION['shipping_tax_description']) && $_SESSION['shipping_tax_description'] != '') {
$od_amount['tax_groups'][$_SESSION['shipping_tax_description']] = $od_amount['tax'];
}
break;
See if that does what you are trying to do ...
Bookmarks