Hello,
I have a private function that will calculate a discount price based on the discount percentage for a customer that is in the Wholesale Group (15% discount), but I have the discount percentage hardcoded ... I would like to somehow look up the discount percentage based on the customer_group_id. My function is below. So, on the line that says:
$discountPrice = $price - ($price * .15);
I have hardcoded the .15 because I know that the Wholesale group gets a 15 percent discount. But I don't want to hard code the .15, in case I change the Wholesale discount percentage later.
private function calculateDiscountPrice($price) {
if (!$this->customer->isLogged()) {
$this->data['discount_prices'] = false;
$discountPrice = $price;
} else {
$customer_group_id = $this->customer->getCustomerGroupId();
if ($customer_group_id == 6) { // Wholesale group
$this->data['discount_prices'] = true;
$discountPrice = $price - ($price * .15);
} else {
$discountPrice = $price;
$this->data['discount_prices'] = false;
}
}
return $discountPrice;
}
I found the public function getTotal in customer_group_discount.php that does what I want, but I don't understand the code that sets the "name" variable:
$this->name = basename(__FILE__, '.php');
if ($this->config->get($this->name . '_status')) {
// Get the Customer Group Id...
$customer_group_id = $this->customer->getCustomerGroupId();
if (!isset($customer_group_id)) { $customer_group_id = 0; }
$discount = $this->config->get($this->name . '_' . $customer_group_id . '_amount'); // THIS IS WHAT I WANT
}
Thanks in advance for any help!
Version 1.4.9.4
hello, i have the same problem. in how file, i can see de private function calculateDiscountPrice
thankyou

thankyou
Who is online
Users browsing this forum: No registered users and 5 guests