Here is a little MOD that might help a few folks out.
We have two types of products. Those that are eligible for a global discount and those that are not. However, your total order determines if the eligible get discounted. X-Cart only uses the total of the eligible items to determine if you qualify for the discount.
Examples:
20% Discount given on $120.00 Order
X-Cart's Way Our Way
Eligible Item
Product A qty. 10 @ $10.00 $100.00 $100.00
Non-Eligible Item
Product B qty 10 @ $2.00 $20.00 $20.00
Sub-Total $120.00 $120.00
Discount 0 $20.00
Order Total $120.00 $100.00
In the "Our Way" example you get your discount on all eligible items regardless how much of the total is made up of non-eligible items.
To accomplish this make the following adjustments to your func.php file located in the include directory.
find definition of function func_calculate_discount
and replace in the function:
$avail_discount_total = 0;
with
$avail_discount_total = 0;
$applicable_discount_total = 0;
then replace
if ($product["discount_avail"] == "Y")
$avail_discount_total += $product["price"] * $product["amount"];
with
$avail_discount_total += $product["price"] * $product["amount"];
if ($product["discount_avail"] == "Y") {
$applicable_discount_total += $product["price"] * $product["amount"];
}
and then replace
$updated = func_distribute_discount("discount", $products,
$discount_info["discount"], $discount_info["discount_type"],
$avail_discount_total);
with
$updated = func_distribute_discount("discount", $products,
$discount_info["discount"], $discount_info["discount_type"],
$applicable_discount_total);
Hope this will be of use to some of you. I have gleemed plenty off of here, thought it was time to contribute more than questions.
BTW, this works on 4.0.18 I have no idea about any of the other versions.
Mike