Skip to main content

Apply discounts before taxes doesnt work correctly

13 years 3 weeks ago - 13 years 3 weeks ago #130782 by Savickis
-- url of the page with the problem -- : http://pastastacija[dot]lv/lv/ieg%C4%81d%C4%81ties-kodu
-- HikaShop version -- : HikaShop Business 2.2.2
-- Joomla version -- : 2.5.14
-- PHP version -- : 5.24

Hello! Our accountant pointed out that there is slight error in the way how hikashop applys bulk-order discounts. Problem, as it seems, is that option "Apply discounts After/Before taxes" doesn't work as it should. Please see attached order invoice as it's generated now:





You can see this in action by visiting link above, placing any of the products in cart, and then changing quantity to 10 - it will apply 5% discount, and You can instantly see this miscalculation in cart table.

Of course, I could just edit attachinvoice/invoice.php to correct invoices, but than price totals in Hikashop backend won't mach the ones in invoices sent to clients, so I'd like to undertstand what's wrong with current calculation logic...

Thanks for helping sort this out in advance.
Best regards, Arthur
.
Last edit: 13 years 3 weeks ago by Savickis.

Please Log in or Create an account to join the conversation.

13 years 3 weeks ago #130848 by nicolas
Hi,

There are several ways to calculate the amount of a coupon based on the taxes or not.
First, you have the option "Apply discounts" of the configuration that you can change.
Then, in the options of the coupon itself, you have the "tax category" option that you can change.
You should try the different combinations of these two options. One of them should allow the system to calculate the taxes/coupon value like you want.

Please Log in or Create an account to join the conversation.

13 years 4 days ago - 13 years 2 days ago #133871 by Savickis
Nicolas, thanks for Your advice, but I have tried ALL possible setting combinations, and this still happens. Could You be so kind and check this out - I presume that I'm not the only one with this problem. Please see man current configuration below:



Up to this moment I simply rewrote attachinvoice.php, but it's not the solution, as You can understand - it's just a temporary fix becaus all the data stored in hikashop backend is still incorrect.
Last edit: 13 years 2 days ago by Savickis.

Please Log in or Create an account to join the conversation.

13 years 3 days ago - 13 years 2 days ago #134058 by Savickis
Just to be sure - what I need is that "TOTAL" for order would be as follows:

TOTAL = (Total without tax - Discount) + ((Total without tax - Discount)*tax)

so as in example in the first post -

18.69 = (16.45 - 1.00) + ((16.45 - 1.00) * 0.21)

Could You please tell me, where the Total calculation logic is stored to make it work like in my example above?
Last edit: 13 years 2 days ago by Savickis.

Please Log in or Create an account to join the conversation.

13 years 1 day ago - 13 years 1 day ago #134209 by Savickis
Any ideas? I presume it's really small change in existing calculation continuity, so could Nicolas point the file to start digging?

Temporary workaround that I'm using right now:

Through "Hikashop settings > Display > Views" option I edited "Checkout > Cart" template.
Replaced line
Code:
echo $this->currencyHelper->format($this->full_total->prices[0]->price_value_with_tax,$this->full_total->prices[0]->price_currency_id);
with
Code:
$pricevar = $this->currencyHelper->format($this->full_total->prices[0]->price_value); $price= str_replace(',','.',$pricevar); $taxvar = $this->currencyHelper->format($tax->tax_amount); $tax= str_replace(',','.',$taxvar); $total = $price + $tax; $result = round($total, 2); echo '' .$result. ' EUR';

And the same in "siteroot\plugins\hikashop\attachinvoice\attachinvoice\attachinvoice.php"

But as I mentioned before - order totals in system doesn't match up, so this is just a temporary fix! Please reply to question stated above - how to change existing calculation continuity?
Last edit: 13 years 1 day ago by Savickis.

Please Log in or Create an account to join the conversation.

12 years 11 months ago #134853 by Savickis

Please Log in or Create an account to join the conversation.

12 years 9 months ago #143923 by Tristan
Hi,

We updated Hikashop recently, and made some changes on discounts applied before / after tax. Download the very latest version on our website, and install it (without changes you made). You shouldn't have any problem with those discounts anymore.

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum