Hello,
I have a module that was built where if multiples of 3 are put into the cart then, one of the products is free.
Today, I modified the code so that the first product would be £5.99 then every product after would be discounted by £3.49. The problem is that for every multiple of two products that are added £3.49 is deducted!
I'm sure it should be a simple coding fix? I would really appreciate it if someone could take a minute to have a look at the relevant bit and tell me what I need to change. Please. :)
Here's the code:
Code:
}
$disc_amount += $this->get_disc_amount($all_items, $price);
$this->explanation = YOUR_CURRENT_3_FOR_2_DISCOUNT_CONFETTI . "\\n" . "\\n";
$this->explanation .= "\\n\\n" . TOTAL_DISCOUNT . $this->print_amount($disc_amount);
$od_amount['total'] = round($disc_amount, 2);
return $od_amount;
}
function get_disc_amount($count,$price) {
$disc_amount = 0;
$new_count = $count - ($count%2);
// if (($count % 2) == 0) {
$disc_amount = ($new_count/2) * 3.49;
// }
return $disc_amount;
}
Many thanks,
Gary
Bookmarks