Americanization of Tax

Hello Folks,

Re: Oxid CE v.4.7.6

My next step is to Americanize the tax. In the United States, taxes are applied to residents of a state. I must apply a sales tax to any and all customers residing in the GREAT State of “Missouri.” There is no sales tax for the country, United States, only for in my case the state of Missouri. All other states are not required to pay a sales tax when ordering from the internet.

The old NA_Module had an array configuration to set this up in the config.inc.php file, but the powers that be took it out of the latest and greatest version. Was this to make it more difficult for us pokey hackers? So now what do I do?

How do I add a tax for a state?

Thank you,

Ray :slight_smile:

Hello Ray,

okay, here we come to the real cruxes and I reckon we have to discuss it a bit at first.

In Europe, there is a general sales tax all over the country, no difference between states (provinces). This tax can differ from country to country: in Germany, one had to pay 19% for example as in Austria it is at 20%. For delivery to non-EU countries (Switzerland, Norway, the US) from inside the EU, it is possible to deliver without charging any sales tax.

Now one of my best mates is a Canuck expat and he tried to explain me how it works over there a while ago. I guess, the similar goes to the rest of North America. To say that upfront: he’s neither an e-commerce expert nor a tax adviser.

As he told me, there is a GST (general sales tax, 8%) that is valid and has to be paid all over the country, no matter where the online store is based and no matter where do you deliver.

Additionally (so he told me) and dependent from where the online store is based, there has to be paid the PST (province sales tax, differing between 0 and 8%). That’d be the reason why everybody tries to order online in Alberta as it is supposed to be a “rich” province with 0% province tax (so you’d have to pay the 8% GST only).

The point is to declare that at the end of the checkout process, seperating GST and PST. Unless you could simply add GST + PST and enter it to the general tax field for your present project.

Could you please check this “issue” for the US if maybe the modus operandi is a bit different or just the same?

Additional technical information:

Sort this out and you are the greatest hmmmmhmmmmhmmmm (no I don’t swear at this point) :slight_smile:

Cheers!

OK Marco, thanks, I will check it out. I’ll be back (to steal a term).

Ray

OK, seems using the GST + PST format, one should be able to set the GST=0 and the PST=the state sales tax rate here in the US. Here is what I have done.

  1. I installed modvatselector.php in its own modvatselector directory under modules.
  2. Added “Missouri” to Countries in Admin.
  3. Added “$this->aCountryVat = array( “8f241f11096877ac0.98748826” => 1, //Missouri );” to the config.inc.php file with only “Missouri” as the country using the country number from the oxstates table.
  4. Added “oxvatselector => modvatselector” to config/systems in Admin.
  5. Tried adding Missouri to the oxcountry table but error message stated it is a primary key. I do not see how but that was the message.
  6. Cleared smarty templates.
  7. Updated db views.
  8. Refreshed Admin page.

Result: Does not work.
If I add a default vat amt in admin, it shows for all customers as it should. If I delete it in admin, it shows for no one which is not what we want. We do want it to show for Missouri only.

Further issues now as a result of these changes:

  1. Admin Countries no longer loads country when double clicked to bottom of admin page. It is locked up or frozen even after clearing template, updating db views and refreshing admin page.
  2. Front end shopping cart will not open when item is added from front “Just Arrived” page but will display when added to cart from the details page.

I now looking to see how to add the percent of tax for the Missouri residents. Seems in NA_module it was added in the config.inc.php file. I will look at that now.

Any other suggestions are most welcome.

Thank you,

Ray

I think I must add Missouri to the oxcountry db table and simply tax Missouri as a country. So far when I specify Missouri in the config.inc.php file, it has only the United States country id listed. I must get a country id for Missouri and try it that way. Will take a closer look at that perhaps tomorrow.

Cheers,

Ray

The string “8f241f11096877ac0.98748826” is the country ID for the United States. All such strings in the oxstates table have the country string and there is no state string. I will look further.

Ray

OK, I added Missouri to oxcountry table and added the Missouri oxid to the config.inc.php file. I tried the storefront but have no idea if it is working because nowhere have I entered the actual tax amount. Also added oxcountry Missouri’s oxid to Missouri’s oxstate table.

Where do I enter the actual tax amount? Should be in the config file but how?
$this->aRegionTax = array( ‘MO’ => array(‘PST’ => 5.75), // PST

skips the GST altogether. Where is “aRegionalTax?” Is that part of v.7.4.6 at all?

perhaps $this->aRegionTax = array( ‘MO’ => array(‘GST’ => 5, ‘PST’ => 0.75*(1 + 5/100)),

or better yet since MO is now a country, just enter MO with a GST:

$this->aRegionTax = array( ‘MO’ => array(‘GST’ => 5.75), // GST

OK, will try these.

As Arnold Schwarzenegger says, “I’ll be back!”

Ray

These do not work in config.inc.php:

$this->aCountryVat = array(‘MO’ => array(‘GST’ => 5, ‘PST’ => 8.5*(1 + 5/100)),
$this->aCountryVat = array( ‘MO’ => array(‘PST’ => 5.75), // PST
$this->aCountryVat= array( ‘MO’ => array(‘GST’ => 5.75), // GST
$this->aCountryVat = array( “8048a7ca81314e398a0f15107de9191c” => 1, //Missouri
’MO’ => array(‘GST’ => 5), // GST Missouri

Any ideas?

Ray

In modvatselector.php it states:

/**

[B] * get Country specific VAT for user[/B]
*
* @param oxUser $oUser given user object
* @param bool $blCacheReset reset cache
*
* @throws oxObjectException if wrong country
* @return double | false
/
public function getUserVat( oxUser $oUser, $blCacheReset = false )
{
/
*
* - Vat config via config.inc.php
*
$this->aCountryVat = array( “8f241f11096877ac0.98748826” => 1, // Vereinigte Staaten von Amerika
"a7c40f632a0804ab5.18804076" => 2, // Vereinigtes Königreich
"a7c40f6321c6f6109.43859248" => 3, // Schweiz
"a7c40f6320aeb2ec2.72885259" => 4, // Österreich
"a7c40f631fc920687.20179984" => 5, // Deutschland
);


How does that array identify the VAT amount?

Ray

It seems this is going to go nowhere. In the admin panel under Countries, there is fixed on the bottom section the following two options:
Do not bill TAX
Do not bill TAX only if provided valid TAX ID
These are radial buttons and it does not provide for an alternative to bill Tax for a single country or state.

My countries back end remains broken. The bottom section no longer loads.
My front end now will not load the cart from the “Just Arrived” front page, only from the details page. I will undo everything I did to try to get them to work again.

I do not know what else to do. Discouraged again :frowning:

Ray

Oh c’mon!
Wasn’t be able to check that yesterday and the day before. Hope will find some time during the week now…

Regarding modus operandi:

In the US it is much simpler. No Federal Sales Tax (no GST). Only a sales tax for residents of the selling state (PST?). As I would sell in the state of Missouri, my resident state, any customers living in Missouri would be required to pay sales tax. Customers I sell to outside of the State of Missouri are not required to pay any sales tax at all. So, I just must be able to link Missouri residents to a fixed sales tax. Others will not have this sales tax linked. I hope that makes it clearer. If not, we can continue discussion.

Seems to me that the US tax situation is much simpler. But how to accomplish it still eludes me.

Cheers,

Ray

Hi Ray,

I see. Maybe in this case it would be possible to rewrite the module I was talking about in manner that it refers to oxstates instead of oxcountry?

Cheers!

I normally am not one to bail out but I must cut my losses here in terms of trying to Americanize OXID at the expense of not getting my shop up & running. Perhaps in a year or so, oxid will be properly Americanized and I can return to it. Thank all of you for your help.

~~Ray :frowning: