[TYPO3-commerce] Different tax rates based on country

Georg Schönweger georg.schoenweger at gmail.com
Tue Apr 27 11:33:25 CEST 2010


Hi Bart,

we are calculating the delivery and payment costs based on the user
selected country. In order to do this we are showing in the basket only
the net price, and only in the last step (listing) we are showing the
gross price. There the prices gets changed based on the user selected
country. I think you could do the something similar for tax rates. We
are using the Hook "preSwitch" in pi3/class.tx_..._pi3.php which gets
executed before the calculation of gross price is made. In your hook
method you can set something like:

function preSwitch($currentStep,$lThis) {
    if($currentStep == "listing" || $currentStep == "finish" ||
$currentStep == "payment") {
        // code will be executed only in last step..
        $curCountry = $lThis->MYSESSION["delivery"]["country"] ?
$lThis->MYSESSION["delivery"]["country"] :
$lThis->MYSESSION["billing"]["country"];
        $basketObj = $GLOBALS['TSFE']->fe_user->tx_commerce_basket;
        ....
       
$basketObj->changePrices($articleUid,$newPriceGross,$newPriceNet); //
just as an example..

        $basketObj->store_data(); // store in DB, maybe you don't need
this..
        $basketObj->recalculate_sums();
    }
}

you can see it in action: http://www.snillo.it

By the way i would like to say thanks for this great commerce extension!
Because of the flexibility of commerce we can sell personalized products
(t-shirts, gadgets ecc.), dynamic categories / dynamic products only by
using hooks.

regards,
Georg

Am 27.04.2010 10:20, schrieb Erik Sokoll:
> Hello Bart,
> this example only solves the problem if you have to show, or not to show
> the tax depending on the region you are going to buy (see listing
> below). So it's only 'TAX=YES' or 'TAX=NO'.
>
> There is only one special situation: If the shop sells to (german)
> dealers/merchant... let's say B2B in Germany... the dealer has to pay
> the tax in the end but while browsing the webpage he needs to see NET
> prices. So for products his ID (in this case 3) gets NET templates and
> only for checkout id 3 has the GROSS template.
>
> Here a small listing, regarding Germany:
> B2C-D     Tax is shown
> B2B-D     Tax is not shown but has to be payed in the end
> B2C-EU    Tax is shown
> B2B-EU    No Tax at all
> B2C-WORLD No Tax at all
> B2B-WORLD No Tax at all
>
> (ok... you could break this down to 3 groups but we need it like this)
>
> About your problem, it is maybe what you need. Because the billing has
> to be done regarding the law of the country where you are going to sell.
> Here we have (at the moment) 19 or 7 percent an it sticks to a certain
> article. Only some "groups" don't need to pay the tax at all.
>
> If you want to set the tax free from the product and want to sell the
> same product with e.g. 5, 16, 20 and 47.11 percent, I guess you have to
> create articles more often and than restrict them to groups.
> But I have no idea in which case you will need this.
>
> Greetings...
> Erik
>
>
> Bartbogdan schrieb:
> > This way you could hide all gross prices. But this doesn't solve the
> > billing problem, right?
> > Somehow the tax should actually be changed in the order and the gross
> > price should be recalculated. I'm trying to find the proper hook to call
> > before payment, but it's hard to find one. Many hooks exist to alter the
> > price after payment, but that doesn't help. As it should be changed on
> > the basis of the selected country I was trying to use the hook that is
> > called when adding a delivery article, but there I'm only able to change
> > the price of the regular articles (not the payment and delivery
> > articles), and the changes don't "stick". Any help in finding the proper
> > hook is appreciated!
>
> > Best regards,
>
> > Bart
>
>
>
> > Op 2010-04-20 12:09:21 +0200, zei Erik Sokoll <erik at t3media.de>:
>
> > I did it by CONDITIONs and choose a different template (e.g.
> > product.tmpl and product_net.tmpl) if the user belongs to a specific
> > FE_users group.
>
> > [usergroup = 3,5,6,7]
> >     plugin.tx_commerce_pi1.templateFile =
> > fileadmin/templates/ext/commerce/product_netto.html
> >     plugin.tx_commerce_pi2.templateFile =
> > fileadmin/templates/ext/commerce/basket_netto.html
> > [else]
> >     plugin.tx_commerce_pi1.templateFile =
> > fileadmin/templates/ext/commerce/product.html
> >     plugin.tx_commerce_pi2.templateFile =
> > fileadmin/templates/ext/commerce/basket.html
> > [end]
>
> > But remember that in this case you have to move the user to this group.
> > In our case it's not (yet) done automatically and on the other side a
> > human has to decide if the user e.g. has the 'licence' to deal inside
> > Germany.
>
> > Anyhow you might use other conditions which fit your needs.
>
> > Greetings...
> > Erik
>
>
> > Bartbogdan schrieb:
> >>>> Hi all,
> >>>>
> >>>> Is there a way to apply a different tax rate based on the destination
> >>>> country? We would like to apply a tax rate of 0% when shipping to
> >>>> retailers in foreign countries.
> >>>>
> >>>> Best regards,
> >>>>
> >>>> Bart
> >>>>
> >>>> _______________________________________________
> >>>> TYPO3-project-commerce mailing list
> >>>> TYPO3-project-commerce at lists.typo3.org
> >>>>
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-commerce
>
>
>
> > _______________________________________________
> > TYPO3-project-commerce mailing list
> > TYPO3-project-commerce at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-commerce
>
>
>
>
_______________________________________________
TYPO3-project-commerce mailing list
TYPO3-project-commerce at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-commerce



More information about the TYPO3-project-commerce mailing list