-
VAT4EU Support Thread
This is the support thread for the forthcoming VAT4EU (VAT for EU Countries) plugin, a re-design of the VAT mod for European Companies that supports Zen Cart 1.5.5 and later.
VAT4EU reduces (but does not remove) the core-file/template-file changes required for its operation, injecting Zen Cart "notifiers" to allow its processing to integrate into your installation without carving those files up! It also makes use of the VIES service for automatic VAT number validation.
A beta version is available on the plugin's GitHub repository for anyone who wants to give it a try before I submit the plugin to the Zen Cart Plugins over the next few days.
-
Re: VAT4EU Support Thread
Just to clarify, this mod allows customers (ie. usually companies) that have a VAT number registered with the EU as valid for inter-community commercial purchases, to purchase ex-VAT?
Next step for making ZC B2B-friendly would be customer discount pricing per customer/product/manufacturer...
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
torvista
Just to clarify, this mod allows customers (ie. usually companies) that have a VAT number registered with the EU as valid for inter-community commercial purchases, to purchase ex-VAT?
Next step for making ZC B2B-friendly would be customer discount pricing per customer/product/manufacturer...
@torvista, what you said as clarification is what the plugin does.
-
Re: VAT4EU Support Thread
I've just submitted v1.0.0 of VAT4EU to the Zen Cart plugins for review; once approved, it can be downloaded from https://www.zen-cart.com/downloads.php?do=file&id=2164.
This plugin, a rewrite of the VAT for European Companies mod supports Zen Cart 1.5.5a and later. The plugin has been designed to use the Zen Cart "notification" system where possible, to reduce the number of core and/or template-override file changes required!
Once installed, configured and enabled the plugin gathers a "VAT number" from your store's business customers and displays that value on any associated orders' confirmation emails, invoices and packingslips. When the customer's VAT number has been validated, VAT4EU provides "VAT Refund" processing for orders shipped to another country.
The plugin can be configured to automatically validate a customers VAT entry, using the VIES (VAT Information Exchange System) interface or a store admin can override a customer's VAT in case their registration is new or the VIES servers are down.
See the plugin's readme for additional information.
-
Re: VAT4EU Support Thread
I think this mod will go a long way to addressing the lack of a tax id field in the core code, something mentioned previously:
https://www.zen-cart.com/showthread....ustomer-Tax-ID
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
I've just submitted v1.0.0 of
VAT4EU to the Zen Cart plugins for review; once approved, it can be downloaded from
https://www.zen-cart.com/downloads.php?do=file&id=2164.
This plugin, a rewrite of the
VAT for European Companies mod supports Zen Cart 1.5.5a and later. The plugin has been designed to use the Zen Cart "notification" system where possible, to reduce the number of core and/or template-override file changes required!
Once installed, configured and enabled the plugin gathers a "VAT number" from your store's business customers and displays that value on any associated orders' confirmation emails, invoices and packingslips. When the customer's VAT number has been validated,
VAT4EU provides "VAT Refund" processing for orders shipped to another country.
The plugin can be configured to automatically validate a customers VAT entry, using the VIES (VAT Information Exchange System) interface or a store admin can override a customer's VAT in case their registration is new or the VIES servers are down.
See the plugin's
readme for additional information.
Now available for download from the Zen Cart plugins ...
-
Re: VAT4EU Support Thread
I've just submitted v1.0.1 to the Zen Cart plugins; once it's approved, I'll post back here.
This release contains changes associated with the following GitHub issues (https://github.com/lat9/vat4eu):
#1: PHP error generated when web-service returns error
#2: Shipping/billing address additions don't "stick".
-
Re: VAT4EU Support Thread
v1.0.1 is now available for download from the Zen Cart plugins.
-
Re: VAT4EU Support Thread
Any changes needed for 1.5.6?
Wayne
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
micromouse
Any changes needed for 1.5.6?
Wayne
You'll need to review the core- and template-file changes as I'm sure they've changed for v1.5.6, but the changes required by the plugin are few and well-marked.
-
Re: VAT4EU Support Thread
unfortunately the changes between the plugin and and 1.5.6 are extensive, and my understanding of zencart does not cover a lot of the new functions such as the use of notifiers etc. In addition a number of the functions (includes/functions/functions_customers) seems to be based on 1.5.1 core and the changes to the new 1.5.6 are extensive.
your_admin/customers.php for instance seems to be fully incorporated, with other files functionality moving completely - Your_Admin/includes/functions/functions_customers.php has now been moved to the catalogue side (according to the file)
I think I'll wait for someone more experienced to fix the changes for 1.5.6, although I'm quite willing to donate to the coffee/beer fund to help implement this
Wayne
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
micromouse
unfortunately the changes between the plugin and and 1.5.6 are extensive, and my understanding of zencart does not cover a lot of the new functions such as the use of notifiers etc. In addition a number of the functions (includes/functions/functions_customers) seems to be based on 1.5.1 core and the changes to the new 1.5.6 are extensive.
your_admin/customers.php for instance seems to be fully incorporated, with other files functionality moving completely - Your_Admin/includes/functions/functions_customers.php has now been moved to the catalogue side (according to the file)
I think I'll wait for someone more experienced to fix the changes for 1.5.6, although I'm quite willing to donate to the coffee/beer fund to help implement this
Wayne
Wayne, I've opened an issue on the plugin's GitHub repository to track a zc1.5.6 update.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
Wayne, I've opened an
issue on the plugin's GitHub repository to track a zc1.5.6 update.
There's good news and not-so-good news; the majority of the notifications used by VAT4EU have been included in zc156, but there are some still missing.:(
I've submitted a change request to get them incorporated in zc156b and later and should have an updated version for zc156 and later only available later in a couple of days.
-
Re: VAT4EU Support Thread
I've just submitted v2.0.0 of VAT4EU to the Zen Cart plugins for review. This version drops support for Zen Cart versions prior to 1.5.6.
If your store uses Zen Cart 1.5.5a-f, please continue to use v1.0.1 of VAT4EU.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
I've just submitted v2.0.0 of VAT4EU to the Zen Cart plugins for review. This version drops support for Zen Cart versions prior to 1.5.6.
If your store uses Zen Cart 1.5.5a-f, please continue to use v1.0.1 of VAT4EU.
VAT4EU, v2.0.0, is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
-
Re: VAT4EU Support Thread
Excellent, I will try an install tomorrow....many many thanks in advance
Wayne
-
Re: VAT4EU Support Thread
Hi
I'm not sure if this is an issue with either this plugin or my general tax settings, so apologies if this is the wrong forum.
I have an issue with my web setup. basically our shop is based in the UK but ships to the EU. We use VAT 4 EU to remove the VAT surcharge with a valid tax number. But someone purchased a product a couple of days ago and VAT wasn't charged at all.
My basis of product Tax is Shipping
I have tax set up at 20% for both UK and the countries we serve ( Netherlands, Belgium and France) . This has worked in the past.
Please I appreciate any help/advice given.
-
Re: VAT4EU Support Thread
Debbie, is this a new setup? You indicated that your tax setup has "worked in the past", so what's changed?
Any debug-logs written to the /logs directory on/around the time of the order?
-
Re: VAT4EU Support Thread
Hi lat9
The website is a couple of years old but only recently has it been set up for the Netherlands, etc.
Before it was just a UK based website.
I didn't have debug on as it was working before. But now its not.
I hope this gives some insight
-
Re: VAT4EU Support Thread
From which country did you receive the purchase that didn't charge VAT?
-
Re: VAT4EU Support Thread
Hi lat9
The Netherlands. I ahve since set an account up with a netherlands address and the VAT isn't showing for me either
-
Re: VAT4EU Support Thread
Hi
We have an issue on our website https://sitstandforbusiness.com/inde...create_account where on the login/checkout Belgian customers cannot add thier VAT number.
I have trid with and with out the prefix and followed the instructions and I get the following message:
We were unable to validate the VAT Number that you entered. Please re-enter the value or contact us for assistance.
I am able to add it and give validation override in the back end but that not ideal. Please advise what's going wrong
-
Re: VAT4EU Support Thread
Deb, if you PM me the VAT number and address you tried to use and I'll check it out.
-
Re: VAT4EU Support Thread
I just went to http://ec.europa.eu/taxation_customs/vies/, where the following message is displayed:
Important Disclaimer:
Belgium’s (BE) National VIES Component is facing temporary technical issues related to the validation of Belgian VAT numbers.
As a result, the validation of Belgian VAT numbers can be unavailable.
The Belgian Tax Administration is working towards a resolution.
Sincere apologies for any inconvenience.
That's, apparently, the source of the issue.
-
Re: VAT4EU Support Thread
Awesome. Thanks Cindy. And I thought our government was a mess :lookaroun
-
1 Attachment(s)
Re: VAT4EU Support Thread
Bonjour Lat. I installed the VAT plugin but I have two problems one and an error in the Mydebug LOG
[09-Jan-2020 11:27:11 Europe/Brussels] Request URI: /index.php?main_page=checkout_shipping, IP address: ::1
#1 zcObserverVatForEuCountries->formatAddress() called at [/Applications/MAMP/htdocs/zcatemplates/includes/classes/observers/auto.vat_for_eu_countries.php:273]
#2 zcObserverVatForEuCountries->update() called at [/Applications/MAMP/htdocs/zcatemplates/includes/classes/class.base.php:103]
#3 base->notify() called at [/Applications/MAMP/htdocs/zcatemplates/includes/functions/functions_customers.php:96]
#4 zen_address_format() called at [/Applications/MAMP/htdocs/zcatemplates/includes/functions/functions_customers.php:139]
#5 zen_address_label() called at [/Applications/MAMP/htdocs/zcatemplates/includes/templates/bootstrap/templates/tpl_checkout_shipping_default.php:39]
#6 require(/Applications/MAMP/htdocs/zcatemplates/includes/templates/bootstrap/templates/tpl_checkout_shipping_default.php) called at [/Applications/MAMP/htdocs/zcatemplates/includes/templates/bootstrap/common/tpl_main_page.php:188]
#7 require(/Applications/MAMP/htdocs/zcatemplates/includes/templates/bootstrap/common/tpl_main_page.php) called at [/Applications/MAMP/htdocs/zcatemplates/index.php:97]
--> PHP Warning: Use of undefined constant FILENAME_CHECKOUT_ONE_CONFIRMATION - assumed 'FILENAME_CHECKOUT_ONE_CONFIRMATION' (this will throw an Error in a future version of PHP) in /Applications/MAMP/htdocs/zcatemplates/includes/classes/observers/auto.vat_for_eu_countries.php on line 549.
the other is that in the order I have three times written VAT + see image
Attachment 18789
Thank you.
-
Re: VAT4EU Support Thread
Giovanni, I see (and will correct shortly) the cause of the first issue (the warning log).
For the second, I believe that that might be the base Zen Cart "multiple tax zones" display. How do you have the store's taxes set up? Is there a single VAT entry or are there multiple VAT taxes that could apply to an order?
GitHub issue created to track the change: https://github.com/lat9/vat4eu/issues/4
-
Re: VAT4EU Support Thread
I've just submitted v2.0.1 of VAT4EU to the Zen Cart moderators for review; I'll post back here when it's available for download (https://www.zen-cart.com/downloads.php?do=file&id=2164).
This release contains changes associated with the following GitHub issue (as reported by @diamond1, above):
#4: PHP Warning issued when One-Page Checkout is not also installed.
-
Re: VAT4EU Support Thread
Thank you for your good care, the correction that you proposed works and I have more php error. Yes I have only one tax class and several areas but despite everything I have 3 times VAT display, on the other hand I have the store with the prices excluding VAT and I noticed that at the registration of the customer who is in the same country that the store receives a popup warning that it can recover the vat when it has to pay it, for info the store is in an CEE euro zone. but I check again if it is the case.
-
Re: VAT4EU Support Thread
Good evening Lat, in fact the 3 times VAT which are printed, it is 3 times the desacription that there is on Tax Rates as I put VAT it prints 3 times.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
I've just submitted v2.0.1 of VAT4EU to the Zen Cart moderators for review; I'll post back here when it's available for download (
https://www.zen-cart.com/downloads.php?do=file&id=2164).
This release contains changes associated with the following GitHub issue (as reported by @diamond1, above):
#4: PHP Warning issued when
One-Page Checkout is not also installed.
Now available for download.
-
Re: VAT4EU Support Thread
hello, I have two warnings on admin / Order Total Modules.
--> PHP Warning: Use of undefined constant MODULE_ORDER_TOTAL_VAT_REFUND_SORT_ORDER - assumed 'MODULE_ORDER_TOTAL_VAT_REFUND_SORT_ORDER' (this will throw an Error in a future version of PHP) in //web/includes/modules/order_total/ot_vat_refund.php on line 22.
--> PHP Warning: Use of undefined constant MODULE_ORDER_TOTAL_VAT_REVERSE_CHARGES_SORT_ORDER - assumed 'MODULE_ORDER_TOTAL_VAT_REVERSE_CHARGES_SORT_ORDER' (this will throw an Error in a future version of PHP) in /web/includes/modules/order_total/ot_vat_reverse_charges.php on line 23.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
diamond1
hello, I have two warnings on admin / Order Total Modules.
--> PHP Warning: Use of undefined constant MODULE_ORDER_TOTAL_VAT_REFUND_SORT_ORDER - assumed 'MODULE_ORDER_TOTAL_VAT_REFUND_SORT_ORDER' (this will throw an Error in a future version of PHP) in //web/includes/modules/order_total/ot_vat_refund.php on line 22.
--> PHP Warning: Use of undefined constant MODULE_ORDER_TOTAL_VAT_REVERSE_CHARGES_SORT_ORDER - assumed 'MODULE_ORDER_TOTAL_VAT_REVERSE_CHARGES_SORT_ORDER' (this will throw an Error in a future version of PHP) in /web/includes/modules/order_total/ot_vat_reverse_charges.php on line 23.
Thanks for the report. Those warnings are issued when the order-totals are present in the file-system but not enabled. I should have a correction in a couple of days.
-
Re: VAT4EU Support Thread
I've just submitted v2.0.2 of VAT4EU to the Zen Cart moderators for review; I'll post back here when it's available for download.
This release contains changes associated with the following GitHub issue:
#5: Correct PHP warnings when the order-total files are present, but not installed.
-
Re: VAT4EU Support Thread
Good evening Lat9, as usual fast as the wind, the modifications have worked well thank you very much.:hug:
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
I've just submitted v2.0.2 of
VAT4EU to the Zen Cart moderators for review; I'll post back here when it's available for download.
This release contains changes associated with the following GitHub issue:
#5: Correct PHP warnings when the order-total files are present, but not installed.
Now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
diamond1
Good evening Lat9, as usual fast as the wind, the modifications have worked well thank you very much.:hug:
Tank you so much :hug:
-
Re: VAT4EU Support Thread
Hi
I am currently upgrading our site from 1.5.5e to 1.5.6c. I also have Edit orders installed (which are ocmpatible) However I am getting a broken screen on when I select Order > Edit
The log files displays the following error(s):
Quote:
[29-Feb-2020 17:02:26 Europe/Berlin] PHP Fatal error: Uncaught Error: Call to undefined function zen_html_quotes() in MyDrive\MyAdmin\includes\classes\observers\Vat4EuAdminObserver.php:305
Stack trace:
#0 MyDrive\\includes\classes\class.base.php(103): Vat4EuAdminObserver->update(Object(notifier), 'EDIT_ORDERS_ADD...', Object(order), '', NULL, NULL, NULL, NULL, NULL, NULL, NULL)
#1 MyDrive\MyAdmin\edit_orders.php(968): base->notify('EDIT_ORDERS_ADD...', Object(order), '')
#2 {main}
thrown in MyDrive\MyAdmin\includes\classes\observers\Vat4EuAdminObserver.php on line 305
[29-Feb-2020 17:02:26 Europe/Berlin] Request URI: MyDrive\MyAdmin\edit_orders.php?page=1&oID=4&action=edit, IP address: 127.0.0.1
--> PHP Fatal error: Uncaught Error: Call to undefined function zen_html_quotes() in MyDrive\MyAdmin\includes\classes\observers\Vat4EuAdminObserver.php:305
Stack trace:
#0 MyDrive\includes\classes\class.base.php(103): Vat4EuAdminObserver->update(Object(notifier), 'EDIT_ORDERS_ADD...', Object(order), '', NULL, NULL, NULL, NULL, NULL, NULL, NULL)
#1 MyDrive\MyAdmin\edit_orders.php(968): base->notify('EDIT_ORDERS_ADD...', Object(order), '')
#2 {main}
thrown in MyDrive\MyAdmin\includes\classes\observers\Vat4EuAdminObserver.php on line 305.
MyAdmin\includes\classes\observers\Vat4EuAdminObserver.php on line 305 reads (in red and bold)
Code:
$vat_info =
'<tr>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td><strong>' . VAT4EU_ENTRY_VAT_NUMBER . '</strong></td>' . PHP_EOL .
' <td>' . zen_draw_input_field('vat_number', zen_html_quotes($vat_number), 'size="45"') . $valid_indicator . $hidden_fields . '</td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
'</tr>' . PHP_EOL .
'<tr>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td><strong>' . VAT4EU_ENTRY_OVERRIDE_VALIDATION . '</strong></td>' . PHP_EOL .
' <td>' . zen_draw_checkbox_field('vat_number_override', '', ($vat_validated == VatValidation::VAT_ADMIN_OVERRIDE)) . '</td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
'</tr>' . PHP_EOL;
$p2 .= $vat_info;
break;
// -----
MyDrive\MyAdmin\edit_orders.php(968) Reads
Code:
$module_name = (EO_ADDRESSES_DISPLAY_ORDER == 'CBS') ? 'eo_addresses_cbs.php' : 'eo_addresses_csb.php';
require DIR_WS_MODULES . 'edit_orders/' . $module_name;
// -----
// Give a watching observer the chance to inject some additional, per-address-type, information.
//
$additional_rows = '';
$zco_notifier->notify('EDIT_ORDERS_ADDITIONAL_ADDRESS_ROWS', $order, $additional_rows);
echo $additional_rows;
?>
It loads ok when I turn off the vat 4 eu. Please could anyone shed any light?
Many thanks in advance.
-
Re: VAT4EU Support Thread
Hmm, I can't find any instance of that zen_html_quotes function. I'll review the VAT4EU processing and should have an update tomorrow.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
Hmm, I can't find any instance of that zen_html_quotes function. I'll review the VAT4EU processing and should have an update tomorrow.
No ideas ... possibly (?) from an older version of EO?
In any case, you can replace that function call with one to zen_db_output; I'll get the VAT4EU GitHub updated.
-
Re: VAT4EU Support Thread
Hi Cindy
This is a fresh install that I am using.
-
Re: VAT4EU Support Thread
Deb, I'm getting an update for VAT4EU going. In the interim, you can edit that naughty line in the Vat4EuAdminObserver, changing the highlighted function:
Code:
$vat_info =
'<tr>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td><strong>' . VAT4EU_ENTRY_VAT_NUMBER . '</strong></td>' . PHP_EOL .
' <td>' . zen_draw_input_field('vat_number', zen_html_quotes($vat_number), 'size="45"') . $valid_indicator . $hidden_fields . '</td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
'</tr>' . PHP_EOL .
'<tr>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td><strong>' . VAT4EU_ENTRY_OVERRIDE_VALIDATION . '</strong></td>' . PHP_EOL .
' <td>' . zen_draw_checkbox_field('vat_number_override', '', ($vat_validated == VatValidation::VAT_ADMIN_OVERRIDE)) . '</td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
'</tr>' . PHP_EOL;
$p2 .= $vat_info;
break;
to
Code:
$vat_info =
'<tr>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td><strong>' . VAT4EU_ENTRY_VAT_NUMBER . '</strong></td>' . PHP_EOL .
' <td>' . zen_draw_input_field('vat_number', zen_db_output($vat_number), 'size="45"') . $valid_indicator . $hidden_fields . '</td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
'</tr>' . PHP_EOL .
'<tr>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td><strong>' . VAT4EU_ENTRY_OVERRIDE_VALIDATION . '</strong></td>' . PHP_EOL .
' <td>' . zen_draw_checkbox_field('vat_number_override', '', ($vat_validated == VatValidation::VAT_ADMIN_OVERRIDE)) . '</td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
'</tr>' . PHP_EOL;
$p2 .= $vat_info;
break;
-
Re: VAT4EU Support Thread
I've just submitted v2.0.3 of VAT4EU to the Zen Cart moderators for their review; I'll post back here once it's available for download.
This release contains changes associated with the following GitHub issue:
#6: Correct call to unknown zen_html_quotes function.
-
Re: VAT4EU Support Thread
That works! :cool: Thanks Cindy.
And yes please, do let us know when the update is okayed.
:hug:
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
I've just submitted v2.0.3 of VAT4EU to the Zen Cart moderators for their review; I'll post back here once it's available for download.
This release contains changes associated with the following GitHub issue:
#6: Correct call to unknown zen_html_quotes function.
Now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
-
Re: VAT4EU Support Thread
Hello,
This add-on is unfortunately not working for VAT-Numbers from Greece.
(It seems a little bit strange to me, I'm the first, who noticed this, but I haven't found any information about this 'bug' in this thread - please excuse me, if I've missed something)
The problem is: Greek VAT-Numbers are an exception, they're starting with 'EL', but not with 'GR' (short Country cobe by ISO)
The problem can be fixed, by adding the following code:
Code:
$country_iso_code_2 = $country_iso_code_2 == 'GR' ? 'EL' : $country_iso_code_2;
after
Code:
$country_iso_code_2 = $this->getCountryIsoCode2($countries_id);
in validateVatNumber method (file Vat4EuAdminObserver.php)
...Or you can simply replace ISO-2 code for Greece (from "GR" to "EL") :-)
-
Re: VAT4EU Support Thread
Thanks for that! I've opened an issue on the VAT4EU GitHub to track the associated change.
-
Re: VAT4EU Support Thread
@yesaul, I chose to make a slightly different change so that the corrected validation would apply to both the admin and the storefront, changing /includes/classes/VatValidation.php:
Code:
// -----
// The class constructor gathers the to-be-verified country-code (2-character ISO) and
// the associated VAT Number. The "VAT Number" value must include any country code
// prefix.
//
// Since we'll need the SOAP service to automatically validate the VAT Number, check now
// to see that the PHP installation includes that service, logging a warning if not.
//
public function __construct($countryCode, $vatNumber)
{
if (defined('VAT4EU_ENABLED') && VAT4EU_ENABLED == 'true') {
$this->debug = (defined('VAT4EU_DEBUG') && VAT4EU_DEBUG == 'true');
// -----
// Greek VAT numbers start with 'EL' instead of their country-code ('GR').
//
$this->countryCode = ($countryCode == 'GR') ? 'EL' : $countryCode;
$this->vatNumber = strtoupper($vatNumber);
if (!class_exists('SoapClient')) {
trigger_error('VAT Number validation not possible, "SoapClient" class is not available.', E_USER_WARNING);;
} else {
$this->soapInstalled = true;
try {
$this->_client = new SoapClient(self::WSDL, array('trace' => true) );
} catch(Exception $e) {
$this->soapInstalled = false;
trigger_error("VAT Number validation not possible, VAT Translation Error: " . $e->getMessage(), E_USER_WARNING);
}
}
$this->trace("__construct($countryCode, $vatNumber)");
}
}
-
Re: VAT4EU Support Thread
@lat9, Sure, your solution is better :-)
But note: it is necessary also to replace 'EL' to 'GR' (or simply add 'GR') in VAT4EU_EU_COUNTRIES configuration key
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
yesaul
@lat9, Sure, your solution is better :-)
But note: it is necessary also to replace 'EL' to 'GR' (or simply add 'GR') in VAT4EU_EU_COUNTRIES configuration key
Most excellent point, @yesaul. Thanks for the update. I'll get that updated 'shortly'.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
yesaul
@lat9, Sure, your solution is better :-)
But note: it is necessary also to replace 'EL' to 'GR' (or simply add 'GR') in VAT4EU_EU_COUNTRIES configuration key
Where exactly do I add 'GR'? In what file?
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
DML73
Where exactly do I add 'GR'? In what file?
That's one of the VAT4EU configuration settings (European Union Countries List).
-
Re: VAT4EU Support Thread
I've just submitted v2.0.4 of VAT4EU to the Zen Cart moderators for their review; I'll post back here when it's available for download.
This release contains changes associated with the following GitHub issues:
#7: Correct check (and configuration) for Greek VAT numbers.
#8: Admin, correct PHP notice when VAT number shouldn't be added to an address.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
I've just submitted v2.0.4 of VAT4EU to the Zen Cart moderators for their review; I'll post back here when it's available for download.
This release contains changes associated with the following GitHub issues:
#7: Correct check (and configuration) for Greek VAT numbers.
#8: Admin, correct PHP notice when VAT number shouldn't be added to an address.
Now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
-
Re: VAT4EU Support Thread
I've just submitted v3.0.0 of VAT4EU to the Zen Cart moderators for review and will post back here when it's available for download.
This release contains changes associated with the following GitHub issues:
#9: Correct PHP notice during account-creation.
#10: Initial installation, use numeric values for integer fields in added database elements.
#11: No more core-file overwrites! Minimum Zen Cart version for initial installation is now zc156b.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
I've just submitted v3.0.0 of
VAT4EU to the Zen Cart moderators for review and will post back here when it's available for download.
This release contains changes associated with the following GitHub issues:
#9: Correct PHP notice during account-creation.
#10: Initial installation, use numeric values for integer fields in added database elements.
#11: No more core-file overwrites!
Minimum Zen Cart version for initial installation is now zc156b.
Now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
-
Re: VAT4EU Support Thread
Sorry for the churn, but I came across some logs indicating that the VIES service now requires https-protocol access so I've just submitted v3.0.1 of VAT4EU to the Zen Cart moderators for review. I'll post back here when it's available for download.
This release contains the change associated with GitHub issue #12 (Access the VIES WSDL using https protocol).
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
Sorry for the churn, but I came across some logs indicating that the VIES service now requires https-protocol access so I've just submitted v3.0.1 of VAT4EU to the Zen Cart moderators for review. I'll post back here when it's available for download.
This release contains the change associated with GitHub issue
#12 (Access the VIES WSDL using https protocol).
Now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
-
Re: VAT4EU Support Thread
I've just submitted v3.1.0 of VAT4EU for the plugin moderators' review; I'll post back here when it's available for download.
This release contains changes associated with the following GitHub issues:
#13: Various re-factorings; the minimum PHP version is now PHP 5.6.0.
#14: Use zen_is_logged_in() and zen_in_guest_checkout() to determine customer's logged-in status; VAT processing now only for non-guest customers.
#15: Since Brexit, GB is no longer part of the EU; the VIES service no longer recognizes GB-based VAT numbers.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
I've just submitted v3.1.0 of VAT4EU for the plugin moderators' review; I'll post back here when it's available for download.
This release contains changes associated with the following GitHub issues:
#13: Various re-factorings; the minimum PHP version is now PHP 5.6.0.
#14: Use zen_is_logged_in() and zen_in_guest_checkout() to determine customer's logged-in status; VAT processing now only for non-guest customers.
#15: Since Brexit, GB is no longer part of the EU; the VIES service no longer recognizes GB-based VAT numbers.
Now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
-
Re: VAT4EU Support Thread
I've just submitted v3.1.1 of VAT4EU for the Zen Cart moderators' review; I'll post back here when it's available for download.
This release contains changes associated with the following GitHub issues:
#16: Correcting integration with Edit Orders, v4.6.0+.
#17: Use zen_cfg_read_only to ensure that the version number is read-only.
#18: Correct strict comparison that resulted in incorrect message to customer.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
I've just submitted v3.1.1 of VAT4EU for the Zen Cart moderators' review; I'll post back here when it's available for download.
This release contains changes associated with the following GitHub issues:
#16: Correcting integration with Edit Orders, v4.6.0+.
#17: Use zen_cfg_read_only to ensure that the version number is read-only.
#18: Correct strict comparison that resulted in incorrect message to customer.
Now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
-
Re: VAT4EU Support Thread
Good day,
Sorry (if I do understand sometyhng wrong or issue has been already described), but the following code in auto.vat_for_eu_countries.php module can cause "Undefined variable" warning:
Code:
// -----
// Issued during the create-account, address-book or checkout-new-address processing, indicates that an address record
// has been created/updated and gives us a chance to record the customer's VAT Number.
//
// Entry:
// $p1 ... An associative array that contains the address-book entry's default data.
//
case 'NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_ADDRESS_BOOK_RECORD': //- Fall through ...
case 'NOTIFY_MODULE_CHECKOUT_ADDED_ADDRESS_BOOK_RECORD': //- Fall through ...
case 'NOTIFY_MODULE_ADDRESS_BOOK_UPDATED_ADDRESS_BOOK_RECORD': //- Fall through ...
case 'NOTIFY_MODULE_ADDRESS_BOOK_ADDED_ADDRESS_BOOK_RECORD':
$address_book_id = ($eventID === 'NOTIFY_MODULE_ADDRESS_BOOK_UPDATED_ADDRESS_BOOK_RECORD') ? $p1['address_book_id'] : $p1['address_id'];
$vat_number = zen_db_prepare_input($_POST['vat_number']);
$db->Execute(
"UPDATE " . TABLE_ADDRESS_BOOK . "
SET entry_vat_number = '$vat_number',
entry_vat_validated = " . $this->vatNumberStatus . "
WHERE address_book_id = $address_book_id
AND customers_id = " . (int)$_SESSION['customer_id'] . "
LIMIT 1"
);
break;
$_SESSION['customer_id'] is not yet defined in case of "NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_ADDRESS_BOOK_RECORD"
My humble suggestion is to use something like this instead:
(int)($eventID === 'NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_ADDRESS_BOOK_RECORD' ? $p1[0]['value'] : $_SESSION['customer_id'])
-
Re: VAT4EU Support Thread
Late come-back, but I'm preparing VAT4EU v3.2.0 for release and have this covered! That version will support Zen Cart versions 1.5.8a and 2.0.0, Edit Orders v4.7.0+, One-Page Checkout v2.4.6+ and the Bootstrap template v3.6.3+.
-
Re: VAT4EU Support Thread
v3.2.0 of the VAT for EU Countries is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
This release represents a massive restructuring, with support for
- Zen Cart versions 1.5.8a and 2.0.0
- PHP versions 8.0 through 8.3.
- Edit Orders, v4.7.0 and later
- One-Page Checkout, v2.4.6 and later
- Bootstrap template, v3.6.3 and later
A full list of the issues addressed in this release can be found here: https://github.com/lat9/vat4eu/issue...stone%3Av3.2.0
-
Re: VAT4EU Support Thread
I have just installed v3.2.0, but do not see the VAT for EU Countries under Admin Configuration.
No error logs have been created ...
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
siilike1232
I have just installed v3.2.0, but do not see the VAT for EU Countries under Admin Configuration.
No error logs have been created ...
Hmm, what version of Zen Cart and PHP is being used?
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
Hmm, what version of Zen Cart and PHP is being used?
ZC v2.0.1 and PHP 8.2
-
Re: VAT4EU Support Thread
OK, let's try to figure out where the installation failed. You'll need to use phpMyAdmin to check the following database tables.
1. configuration_group. Should have a record with a configuration_group_title of VAT4EU Plugin.
2. configuration. There should be 9 records with a configuration_key LIKE VAT4EU%.
3. admin_pages. Should have a record with a page_key of configVat4Eu.
4. address_book. Should have two new fields named entry_vat_number and entry_vat_validated.
5. orders. Should have two new fields named billing_vat_number and billing_vat_validated.
If you could perform the above database checks to see where the installation stopped, I can suggest what step to take next.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
OK, let's try to figure out where the installation failed. You'll need to use phpMyAdmin to check the following database tables.
1. configuration_group. Should have a record with a configuration_group_title of VAT4EU Plugin.
2. configuration. There should be 9 records with a configuration_key LIKE VAT4EU%.
3. admin_pages. Should have a record with a page_key of configVat4Eu.
4. address_book. Should have two new fields named entry_vat_number and entry_vat_validated.
5. orders. Should have two new fields named billing_vat_number and billing_vat_validated.
If you could perform the above database checks to see where the installation stopped, I can suggest what step to take next.
1. True
2. I can find 7 records
3. Not present
4. True
5. True
-
Re: VAT4EU Support Thread
Weird. You can create that missing page key by navigating to the admin's Admins :: Admin Page Registration tool. From there, enter
Page Key ............ configVat4Eu
Page Name ........... BOX_CONFIG_VAT4EU
Page File Name ...... FILENAME_CONFIGURATION
Page Parameters .... gID=xx (where xx is the configuration_group_id you see for item 1, above)
Menu ................... Choose "Configuration"
Display on Menu? ... Tick the box
Then click the "Insert" button.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
Weird. You can create that missing page key by navigating to the admin's Admins :: Admin Page Registration tool. From there, enter
Page Key ............ configVat4Eu
Page Name ........... BOX_CONFIG_VAT4EU
Page File Name ...... FILENAME_CONFIGURATION
Page Parameters .... gID=xx (where xx is the configuration_group_id you see for item 1, above)
Menu ................... Choose "Configuration"
Display on Menu? ... Tick the box
Then click the "Insert" button.
The Admin page is not working, but on the store page no VAT no field is displayd :( Company field is present.
As I enable the Vat debug, I now have the first log file:
2024-06-16 16:02:36: checkVatIsRefundable(, )
Returning ()
2024-06-16 16:05:13: checkVatIsRefundable(, )
Returning ()
2024-06-16 16:05:29: checkVatIsRefundable(, )
Returning ()
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
siilike1232
The Admin page is not working, but on the store page no VAT no field is displayd :( Company field is present.
As I enable the Vat debug, I now have the first log file:
2024-06-16 16:02:36: checkVatIsRefundable(, )
Returning ()
2024-06-16 16:05:13: checkVatIsRefundable(, )
Returning ()
2024-06-16 16:05:29: checkVatIsRefundable(, )
Returning ()
Sorry, Admin page is now working
-
Re: VAT4EU Support Thread
I gave it a new try with a fresh install and now I have everything working at the Admin side, but the VAT field is not displayed on the Store side, Company field is set to TRUE and is shown.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
siilike1232
I gave it a new try with a fresh install and now I have everything working at the Admin side, but the VAT field is not displayed on the Store side, Company field is set to TRUE and is shown.
Not displayed for entry on addresses or not displayed after being entered?
-
Re: VAT4EU Support Thread
v3.2.1 of VAT for EU Countries is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
This version corrects the vat_number sorting in the admin's Customers :: Customers tool.
-
Re: VAT4EU Support Thread
In order to avoid 'Undefined array key' warnings in includes/classes/observers/auto.vat_for_eu_countries.php
- on line 403
Code:
$vat_number = strtoupper(zen_db_prepare_input(!empty($_POST['vat_number']) ? $_POST['vat_number'] : ''));
- on line 290
Code:
$vat_number = zen_db_prepare_input(!empty($_POST['vat_number']) ? $_POST['vat_number'] : '');
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
yesaul
In order to avoid 'Undefined array key' warnings in
includes/classes/observers/auto.vat_for_eu_countries.php
- on line 403
Code:
$vat_number = strtoupper(zen_db_prepare_input(!empty($_POST['vat_number']) ? $_POST['vat_number'] : ''));
- on line 290
Code:
$vat_number = zen_db_prepare_input(!empty($_POST['vat_number']) ? $_POST['vat_number'] : '');
Could you post the full PHP Warning logged? That way, I can see the backtrace to understand where this issue is sourced.
-
Re: VAT4EU Support Thread
v4.0.0 of VAT4EU is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
This version of VAT4EU is released as a Zen Cart encapsulated plugin for zc210+, supporting Edit Orders5.
-
Re: VAT4EU Support Thread
Quote:
In order to avoid 'Undefined array key' warnings in includes/classes/observers/auto.vat_for_eu_countries.php
- on line 403
...
- on line 290
...
in validateVatNumber method this issue is now solved (line #516 in current version ):
Code:
$vat_number = strtoupper(zen_db_prepare_input($_POST['vat_number'] ?? ''));
but in update the unnecessary warnings are still being generated (line # 325 in current version)
Code:
$vat_number = zen_db_prepare_input($_POST['vat_number']);
Quote:
[19-Mar-2025 10:31:02 Europe/Helsinki] Request URI: /index.php?main_page=create_account, IP address: ..., Language id 1
#0 .../public_html/zc_plugins/VAT4EU/v4.0.0/catalog/includes/classes/observers/auto.vat_for_eu_countries.php(325): zen_debug_error_handler()
#1 ..../public_html/includes/classes/traits/NotifierManager.php(106): zcObserverVatForEuCountries->update()
#2 ....public_html/includes/classes/Customer.php(919): base->notify()
#3 ....public_html/includes/modules/.../create_account.php(294): Customer->create()
#4 ....public_html/includes/modules/pages/create_account/header_php.php(16): include('/home/...')
#5 .../public_html/index.php(35): require('/home/...')
--> PHP Warning: Undefined array key "vat_number" in ...../public_html/zc_plugins/VAT4EU/v4.0.0/catalog/includes/classes/observers/auto.vat_for_eu_countries.php on line 325.
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
yesaul
in
validateVatNumber method this issue is now solved (line #516 in current version ):
Code:
$vat_number = strtoupper(zen_db_prepare_input($_POST['vat_number'] ?? ''));
but in
update the unnecessary warnings are still being generated (line # 325 in current version)
Code:
$vat_number = zen_db_prepare_input($_POST['vat_number']);
Thanks for the report; I've created a GitHub issue to track the required change: https://github.com/lat9/vat4eu/issues/50
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
lat9
Actually, if that field's missing that implies a possible misconfiguration, since VAT4EU's observer should have inserted some jQuery that will add the vat_number entry field to those forms.
What template is in use and is the configuration setting Customer Details :: Company set to true?
-
Re: VAT4EU Support Thread
Quote:
What template is in use and is the configuration setting Customer Details :: Company set to true?
Customer Details :: Company ('ACCOUNT_COMPANY' key) is set to false
(I do put corporate customers having EU-VAT-# manually from Admin )
I use my own template (but this does no matter here, I think)
-
Re: VAT4EU Support Thread
Quote:
Originally Posted by
yesaul
Customer Details :: Company ('ACCOUNT_COMPANY' key) is set to false
(I do put corporate customers having EU-VAT-# manually from Admin )
I use my own template (but this does no matter here, I think)
OK, that would be why the vat_number isn't getting posted, since the customer's Company field needs to be displayed on the storefront for the VAT number to be included.