Jump to content

[1.7] Disable double discounts for group reductions + quantity discounts


tumil

Recommended Posts

Hello!

Customers' groups in my store have different discounts for different categories (set in groups' properties).

Now I want to add some quantity discounts for certain products (e.g. if customer gets more than 30 pcs of product, the price for one piece changes to some specific value).

The thing is... the group reductions are still applied to these lowered prices. And I don't want them to. I tried editting:

- Product.php class (around line 3160)

  • changed this:
        // Group reduction
		if ($use_group_reduction) {
			$reduction_from_category = GroupReduction::getValueForProduct($id_product, $id_group);
			if ($reduction_from_category !== false) {
				$group_reduction = $price * (float)$reduction_from_category;
			} else { // apply group reduction if there is no group reduction for this category
				$group_reduction = (($reduc = Group::getReductionByIdGroup($id_group)) != 0) ? ($price * $reduc / 100) : 0;
			}

			$price -= $group_reduction;
		}
  • to that:
        // Group reduction
		if ($quantity_discount != 0 || $specific_price_reduction) {
		}
		else {
			if ($use_group_reduction) {
				$reduction_from_category = GroupReduction::getValueForProduct($id_product, $id_group);
				if ($reduction_from_category !== false) {
					$group_reduction = $price * (float)$reduction_from_category;
				} else { // apply group reduction if there is no group reduction for this category
					$group_reduction = (($reduc = Group::getReductionByIdGroup($id_group)) != 0) ? ($price * $reduc / 100) : 0;
				}

				$price -= $group_reduction;
			}
		}

 

- ProductController.php controller (around line 950)

  • changed this:
		$group_reduction = GroupReduction::getValueForProduct($this->product->id, (int) Group::getCurrent()->id);
		if ($group_reduction === false) {
			$group_reduction = Group::getReduction((int) $this->context->cookie->id_customer) / 100;
		}
        $product_full['customer_group_discount'] = $group_reduction;
  • to that:
		if ($quantity_discounts) {
			$group_reduction = 0;
		}
		else {
			$group_reduction = GroupReduction::getValueForProduct($this->product->id, (int) Group::getCurrent()->id);
			if ($group_reduction === false) {
				$group_reduction = Group::getReduction((int) $this->context->cookie->id_customer) / 100;
			}
		}
        $product_full['customer_group_discount'] = $group_reduction;

but none of these operations seem to work.

How can I fix my problem?

Thanks for help

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...