Apply discounts before taxes doesnt work correctly

  • Posts: 41
  • Thank you received: 9
11 years 7 months ago #130782

-- 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
.

Attachments:
Last edit: 11 years 7 months ago by Savickis.

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

  • Posts: 83933
  • Thank you received: 13588
  • MODERATOR
11 years 7 months ago #130848

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.

  • Posts: 41
  • Thank you received: 9
11 years 6 months ago #133871

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.

Attachments:
Last edit: 11 years 6 months ago by Savickis.

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

  • Posts: 41
  • Thank you received: 9
11 years 6 months ago #134058

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: 11 years 6 months ago by Savickis.

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

  • Posts: 41
  • Thank you received: 9
11 years 6 months ago #134209

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

echo $this->currencyHelper->format($this->full_total->prices[0]->price_value_with_tax,$this->full_total->prices[0]->price_currency_id);
with
$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: 11 years 6 months ago by Savickis.

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

  • Posts: 41
  • Thank you received: 9
11 years 6 months ago #134853

Any updates?

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

  • Posts: 73
  • Thank you received: 7
11 years 3 months ago #143923

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.089 seconds
Powered by Kunena Forum