The "Country dependent VAT" approach supposes that each of your users can be assigned a country. The next subsections reveal how this can be achieved. Please note that the list of available countries is specified under the "[CountrySettings]" section of the "settings/content.ini" configuration file.
It is necessary to add an attribute of the country datatype to your user class otherwise it will be impossible to assign a country to a user. The following text reveals how this can be done.
Class attribute edit interface for the "Country" datatype.
If your user class contains an attribute of the country datatype then a country can be assigned to a user in one of the following ways:
It is recommended that you add a possibility for a user to choose his/her country "on-the-fly" using the "User country" toolbar. To do this, add the following line into the "[Toolbar_right]" section of the "settings/siteaccess/example/toolbar.ini.append.php" file where "example" is your siteaccess name:
Tool[]=user_country
This setting instructs the system to display the country selection toolbar on the right. When a user selects a country, the system will immediately update product prices according to the VAT rules specified for the selected country.
In order to avoid problems with content caching, you will have to specify "user_preferred_country" in the "CachedViewPreferences[full]" setting for all siteaccesses. To do this, open the "site.ini.append.php" configuration file located in the "settings/siteaccess/example" directory (replace "example" with the actual name of the siteaccess) and edit it. If the "[ContentSettings]" section of the configuration file already contains something like
CachedViewPreferences[full]=<list_of_user_preferences>
then you will have to append a semicolon and "user_preferred_country" at the end of the line, for example:
CachedViewPreferences[full]=admin_navigation_content=0; admin_navigation_details=0;<...>;admin_bookmarkmenu=1; admin_left_menu_width=13;user_preferred_country=''
Note that this configuration line tends to be very long. It is simplified in the example above (a lot of settings were replaced with <...> in order to keep things short).
If the "[ContentSettings]" section does not contain a line that starts from "CachedViewPreferences[full]", create it:
CachedViewPreferences[full]=user_preferred_country=''
If this setting is not specified, your customers will have problems when changing the country (the interface will not be updated because of the cache problem).
There is an additional possibility to use an alternative country datatype instead of the built-in country datatype. This means that you can integrate an alternative datatype to the system so that the user's country will be stored in the same way by the datatype, by the VAT rules management interface and by the shop user registration module (shop/userregister). The following list reveals how this can be achieved.