- Posts: 105
- Thank you received: 2
error in coupon display when the coupon is 100%
8 years 4 months ago #293639
by rfonta
error in coupon display when the coupon is 100% was created by rfonta
It seems there is an error in the show_block_cart file.
when the coupon is 100%, the variable $taxes is calculated to 0 because the final price is 0, but not the price before the discount
($taxes = round($cart->full_total->prices[0]->price_value_with_tax - $cart->full_total->prices[0]->price_value, $this->currencyClass->getRounding($cart->full_total->prices[0]->price_currency_id))
the consequence is that the coupon is displayed without tax, when the total before the coupon is displayed with tax; so it looks like there is an error (the final price after the discount is correctly displayed at 0;
I corrected it in the file by adding a condition (in orange) in these lines
if(($taxes == 0 && $cart->coupon->discount_percent_amount_orig<100) || empty($this->options))
echo $this->currencyClass->format(@$cart->coupon->discount_value_without_tax * -1, @$cart->coupon->discount_currency_id);
else
echo $this->currencyClass->format(@$cart->coupon->discount_value * -1, @$cart->coupon->discount_currency_id);
So now for me it works; but you may have a look at your code and verfiy the error I think I detected; if I am right you may modify it; if I am wrong, you may also tell me what is my error
kind regards
when the coupon is 100%, the variable $taxes is calculated to 0 because the final price is 0, but not the price before the discount
($taxes = round($cart->full_total->prices[0]->price_value_with_tax - $cart->full_total->prices[0]->price_value, $this->currencyClass->getRounding($cart->full_total->prices[0]->price_currency_id))
the consequence is that the coupon is displayed without tax, when the total before the coupon is displayed with tax; so it looks like there is an error (the final price after the discount is correctly displayed at 0;
I corrected it in the file by adding a condition (in orange) in these lines
if(($taxes == 0 && $cart->coupon->discount_percent_amount_orig<100) || empty($this->options))
echo $this->currencyClass->format(@$cart->coupon->discount_value_without_tax * -1, @$cart->coupon->discount_currency_id);
else
echo $this->currencyClass->format(@$cart->coupon->discount_value * -1, @$cart->coupon->discount_currency_id);
So now for me it works; but you may have a look at your code and verfiy the error I think I detected; if I am right you may modify it; if I am wrong, you may also tell me what is my error
kind regards
Please Log in or Create an account to join the conversation.
8 years 4 months ago #293643
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic error in coupon display when the coupon is 100%
Hello,
When you create a thread in our forum please provide the basis requested details, including the HikaShop version number.
You can also use the tag [ code ] (without the spaces) to paste PHP code in the forum.
Thanks
When you create a thread in our forum please provide the basis requested details, including the HikaShop version number.
You can also use the tag [ code ] (without the spaces) to paste PHP code in the forum.
Thanks
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Time to create page: 0.151 seconds