- Posts: 75
- Thank you received: 6
Wrong result on discount + coupon
3 years 6 months ago - 3 years 6 months ago #350005
by nico1979
Wrong result on discount + coupon was created by nico1979
-- url of the page with the problem -- :
www.erboristeriazambrini.it/
-- HikaShop version -- : 4.7.1
-- Joomla version -- : 3.10.11
-- PHP version -- : 7.4
-- Browser(s) name and version -- : All
Hi,
there is an error applying discount and coupon on the same product.
Example:
I've got a product 100€
This product has a discount 20% = 80€ Correct
I've made a 30% coupon with the field Coupon handling of discounted products set as Override discounted products.
The result isn't 70€ but 76€. Why?
If I unpublish the discount the result is correct 70€
If I set the discount as 10% the result is 73€
It seems that the discount value is applied to the coupon value.
100 - [(100 * 30%) - 20%] = 76
100 - [(100 * 30%) - 10%] = 73
Thank you
-- HikaShop version -- : 4.7.1
-- Joomla version -- : 3.10.11
-- PHP version -- : 7.4
-- Browser(s) name and version -- : All
Hi,
there is an error applying discount and coupon on the same product.
Example:
I've got a product 100€
This product has a discount 20% = 80€ Correct
I've made a 30% coupon with the field Coupon handling of discounted products set as Override discounted products.
The result isn't 70€ but 76€. Why?
If I unpublish the discount the result is correct 70€
If I set the discount as 10% the result is 73€
It seems that the discount value is applied to the coupon value.
100 - [(100 * 30%) - 20%] = 76
100 - [(100 * 30%) - 10%] = 73
Thank you
Last edit: 3 years 6 months ago by nico1979.
Please Log in or Create an account to join the conversation.
3 years 6 months ago #350009
by nicolas
Replied by nicolas on topic Wrong result on discount + coupon
Hi,
I think there is indeed an issue in that calculation mode.
Change the code:
to:
(several places) in the file administrator/components/com_hikashop/classes/discount.php and it should calculate based on the initial price and not the discounted price.
I think there is indeed an issue in that calculation mode.
Change the code:
Code:
$coupon->discount_flat_amount += ($coupon->discount_percent_amount * $product->prices[0]->$price) / 100;
Code:
$coupon->discount_flat_amount += ($coupon->discount_percent_amount * $product->prices[0]->$price_without_discount) / 100;
Please Log in or Create an account to join the conversation.
Time to create page: 0.171 seconds