Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Coupon (by percent) calculation #9

Open
carco opened this issue Mar 28, 2014 · 1 comment
Open

Wrong Coupon (by percent) calculation #9

carco opened this issue Mar 28, 2014 · 1 comment

Comments

@carco
Copy link
Contributor

carco commented Mar 28, 2014

I have a coupoun with 10% discount, and I get:

Subtotal                         $88.00     
Discount (10%)                   -$9.53
Tax                               $6.87 
-------------------------------------------
Grand Total                      $85.34

And I expect a $8.8 discount.

After (not so) few research, I think that I find the problem:

But, in helper, you have "return false" in function discountTax:
https://github.com/onepica/avatax/blob/master/app/code/community/OnePica/AvaTax/Helper/Tax/Data.php#L119

The problem is, that exists some places, in magento:
app/code/core/Mage/Tax/Model/Sales/Total/Quote/Shipping.php
app/code/core/Mage/Tax/Model/Sales/Total/Quote/Subtotal.php

wich don't use Mage::helper('tax')->discountTax() to get this settings but:
$this->_config->discountTax($store) (_config is: Mage::getSingleton('tax/config'))

and, with no other settings, we have:

OnePica_AvaTax_Helper_Tax_Data::discountTax: false
Mage_Tax_Model_Config::discountTax: true

My solution was to change in avatax/.../config.xml: <discount_tax>0</discount_tax> (instead 1), but, if this settings was saved before Avatax install, this will not solve the problem.

Probably you need to rewrite Mage_Tax_Model_Config (instead of Mage_Tax_Helper_Data, because helper use Config) or, at install, update in core_config_data the keys:
tax/calculation/{based_on|price_includes_tax|shipping_includes_tax|apply_after_discount|discount_tax|apply_tax_on} we the needed values (same as in helper)

@grikka
Copy link
Contributor

grikka commented Apr 19, 2015

Hey, did you happen to do this change locally? If so, what were your before and after core_config values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants