Override tax calculation management in Magento - magento

I need to override the way magento calculates taxes.
I need to change a customer's tax class on the fly, when he changes his addresses o fills a VAT number.
To do this i figured out that rewriting the Customer method getTaxClassId() was enough but it is not. I found out that to make its calculations Magento uses the customer's tax class and also his group's tax class.
To calculate the right rate, group and customer tax class must be the same.
The problem is that I can't override group's tax class ID because when you do
Mage::getModel("customer/group")->getTaxClassId($groupID)
I can't determine what customer it is referencing to.
So maybe I can try another approach: I was thinking to rewrite the tax rule calculation class. The goal is to redefine tax rules on a Product Tax Class, CUSTOMER Tax Class but I'm unable to understand where Magento does this.
Can anyone help me?
Thank you!

Related

Magento - How can I add a non-taxable fee to a taxable product?

We are using Magento EE 1.12. We have associated fees with individual products that cannot be taxed, however the product itself can be. The desired solution will be similar to a custom option where the fee is included on the same line item as the product and included in the product's price and therefore in the order subtotal. The only problem with a custom option is that the fee is taxed along with the product.
We've gone through several scenarios but I think the most likely solution is to use a custom option, but after the tax has been calculated we will reduce the tax to the correct amount. We tax on the subtotal and shipping. We will have access to the amount of fees so we can get the tax on that total and reduce the order tax amount.
Does this seem like a good solution? Does anyone have other ideas?
Make it a bundle product, and put in a product which is not taxable.

Shipping Amount for different payment method in magento

how to apply different shipping amount for each payment method in magento? Now i am currently using two payment methods.
1) credit cart
2) Cash on delivery.
When customer selecting credit cart payment method shipping price is free.
and when customer selecting Cash on delivery payment method shipping price is 100.
FYI : my default shipping amount is 100.
Can anyone explain me briefly?
Thank
Prakash.
The problem is that the payment method is chosen based on the shipping method, so you can't change the shipping after choosing a payment method.
One possibility is to offer to different shipping method which restrict the payment methods after selecting.
I've created a magento module which does this, feel free to take a look on the sourcecode how it restricts payment methods based on shipping rates. This is the way I'd go.
https://github.com/thebod/Thebod_Shippingrates
You can create a Promotion rule with the Shopping Cart Price Rule for specific Payment Methods.

Remove Tax at Checkout for B2B customers in Magento

I need to dynamicaly remove tax during checkout for business to business customers in Magento. I have a module which asks for a VAT ID during checkout and checks it against the European Online VAT-ID Validation Service. If the VAT ID is valid, the tax should be removed during checkout.
The module already assigns new customers with valid VAT ID to the according business to business group in Magento. Customers who order for the first time and create their account during that first checkout, get charged VAT (even with valid VAT-ID).
I basically need to know, how this can be done, which methods involved, etc.
I've got a similar setup going on at the moment, what I have done is if the VAT# at checkout is stored in mage_checkout_model_session. The call
Mage::getSingleton('checkout/session')->getQuote()->getCustomerTaxvat()
In my instance is returning the VAT number for me to check elsewhere. Your VAT# validator is certainly setting something similar to this. At this point you can either create a new module to modify the tax, or override the controller with
$x = Mage::getSingleton('where_your_extension/stores_the_value)->getIsVatValid();
if ($x) $this->setTaxValue( 0 );
else //magento sets it automatically
and it will set the tax rate to zero for the remainder of the session. It will work with guests and registered customers.

Programmatically apply a discount price in product list

I would like to programmatically display a discounted price on the product list/page so that each customer as a personal price shown based on a customer attribute (like gender for instance, and of course let it be assigned as new price for the user session) but I can't see a viable option via the magento catalog price rules involving customer attributes other than the assigned group.
I'm using the group to do different kind of discounts and categorization of the customers, so the path of "split the customers on the gender" (or similar) is not an option unfortunately, since I can't assign more than 1 group per customer.
At the moment I was thinking about setting up a custom observer to check for calls to the price generation and then let it consider my customer attributes when calculating the price.
Is that possible? if so, any pointers about?
Would you suggest something different?
Thanks a lot to everyone for your time.
As I was thinking before, I solved my issue creating a custom module with an observer looking for catalog_product_get_final_price calls, getting the customer details from the current customer session.
It works great, I just need to let it display the correct price in the catalog product list, but is minimal, as the price seems to be calculated correctly inside the product page and the cart

10cent per product tax magento

I would like to apply a flat 10 cent per product tax to my magento store, is there a way to set this up within the system already?
Read this article about setting up tax rules in Magento. Another resource here.
Create Product Tax Class (Sales->Tax->Product Tax Classes)
Create Tax Rate (Sales->Tax->Manage Tax Zones & Rates)
Create Tax Rule (Sales->Tax->Manage Tax Rules)
While creating product, apply that Product Tax Class to the product.

Resources