wifilogo Posted November 12, 2017 Share Posted November 12, 2017 (edited) Afer many hours fighting with my Prestashop i solved this problem. I installed this free vatnumber module: https://github.com/PrestaShop/vatnumber But you need change three files in Prestashop too if you want it to work (front, back and order pages). It's not a perfect solution, but it works I attach this fixed files and module vatnumber.zip (v.2.0.0). Verified for PS 1.7.0.0. 1.7.1.2 and 1.7.2.4. If you like it, give me thanks // AddressController.php - Add this after line 68 include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php'); $isAVatNumber = VatNumber::WebServiceCheck(Tools::getValue('vat_number')); if (is_array($isAVatNumber) && count($isAVatNumber) > 0) { $this->errors[] = $this->trans('Please fix the error below.', array(), 'Shop.Notifications.Error'); $this->should_redirect = false; $this->success = null; } // AdminAddressesController.php - Add this after line 378 include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php'); $isAVatNumber = VatNumber::WebServiceCheck(Tools::getValue('vat_number')); if (is_array($isAVatNumber) && count($isAVatNumber) > 0) { $this->errors[] = $this->trans('VAT number not found', array(), 'Admin.Notifications.Error'); } // CheckoutAddressesStep.php - Add this after line 112 include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php'); $isAVatNumber = VatNumber::WebServiceCheck(Tools::getValue('vat_number')); if (is_array($isAVatNumber) && count($isAVatNumber) > 0) { $saved = false; } // vatnumber.php - I changed this url for fix too spanish vat numbers validation in line 159 // $url = 'http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms='.urlencode($prefix).'&iso='.urlencode($prefix).'&vat='.urlencode($vat); // Spanish VAT numbers fixed. Fix error message: 'VAT number validation service unavailable' $url = 'http://ec.europa.eu/taxation_customs/vies/vatResponse.html?locale=EN&memberStateCode='.urlencode($prefix).'&number='.$vat.'&traderName='; VATNumber_fix_PS_1.7.0.0_-_1.7.2.4.zip vatnumber.zip Edited November 12, 2017 by wifilogo SOLVED (see edit history) 4 1 Link to comment Share on other sites More sharing options...
daxit_x Posted December 12, 2017 Share Posted December 12, 2017 Hello Wifilogo I am negatively Amazed, just as many others, about PS 1.7 missing this very important feature, it was very nice of you to propose this free solution, finally someone did it, thank you for the effort. In your installation, does your mod work exactly as the it was working in prestashop 1.6? In mine, PS 1.7.2.4, it does not. I am not a coder and have no great skills into this matter, by the way I reviewed the changes proposed and seemed not wrong or dangerous to start with, so I tried i out. Unfortunately does not work as expected, at least on the presta 1.7.2.4 I am deploying the mechanism for which the VAT ID field should appear only if the field Company is used does not work, the VAT field is always visible and does not become mandatory only if company field is used. So if one does set it as mandatory in the addresses tab of the BO everyone have to write the VAT ID and that does not help as the form is used by privates as well as companies. Logically if the VAT ID always appears and is set to be mandatory and does verify the VAT ID on the VIES website then is also not possible to have the field as hybrid, e.g. to ask to input the VAT ID or the Fiscal code or Identification number or other code used by privates in different countries, further more in some countries that is not expected and won't be understood by private potential clients. So the old module for presta 1.6 was doing the work just as needed covering the cases of local private, local company, Eu private, EU company, extra EU private and company, the modification of this same module for prestashop 1.7 should do exactly the same thing at least. Hope a fix is possible, it is really a big pity to see this platform mutilated of such basic fundamental features. Thank you Best regards Link to comment Share on other sites More sharing options...
wifilogo Posted December 14, 2017 Author Share Posted December 14, 2017 En 12/12/2017 a las 4:08 PM, daxit_x dijo: I am negatively Amazed, just as many others, about PS 1.7 missing this very important feature Yes. The 'problem' is because PS 1.7 isn't ready for VAT Number feature like PS 1.5 or PS 1.6. VAT number module works fine! In my old PS 1.5.6.2 i have this javascript code in address.tpl $(document).ready(function() { $('#company').on('input',function(){ vat_number(); }); vat_number(); function vat_number() { if ($('#company').val() != '') $('#vat_number').show(); else $('#vat_number').hide(); } }); And this smarty code {if $field_name eq 'company'} <div class="text form-group"> <label class="control-label col-sm-4" for="company">{l s='Company'}</label> <div class="col-sm-6"> <input class="form-control" type="text" id="company" name="company" value="{if isset($smarty.post.company)}{$smarty.post.company}{else}{if isset($address->company)}{$address->company|escape:'html'}{/if}{/if}" /> </div> </div> {/if} {if $field_name eq 'vat_number'} <div id="vat_area"> <div id="vat_number"> <div class="text form-group"> <label class="control-label col-sm-4" for="vat_number">{l s='VAT number'}</label> <div class="col-sm-6"> <input type="text" class="form-control text" name="vat_number" value="{if isset($smarty.post.vat_number)}{$smarty.post.vat_number}{else}{if isset($address->vat_number)}{$address->vat_number|escape:'html'}{/if}{/if}" /> </div> </div> </div> </div> {/if} But in PS 1.7 only {block name="address_form_fields"} <section class="form-fields"> {block name='form_fields'} {foreach from=$formFields item="field"} {block name='form_field'} {form_field field=$field} {/block} {/foreach} {/block} </section> {/block} You need a lot of code in PS 1.7 (javascript and smarty) in different files to add this show/hide feature Link to comment Share on other sites More sharing options...
daxit_x Posted December 17, 2017 Share Posted December 17, 2017 Hello Thank you for the reply, appreciated. I saw that works fine in the sense that does not causes errors, but also does not much of what was doing in presta 1.6 or 1.5 So far I see that the module in 1.7 does not validate the VAT ID with he VIES service, do not remove the taxes from the cart if the purchase is done with an EU country VAT ID different from the shop owner's country. Does this module accomplish to this tasks in your installation? I am using prestashop 1.7.2.4, clean and fresh just out of the box, those are the results I got. Bye Link to comment Share on other sites More sharing options...
wifilogo Posted December 26, 2017 Author Share Posted December 26, 2017 En 17/12/2017 a las 3:51 AM, daxit_x dijo: Hello Thank you for the reply, appreciated. I saw that works fine in the sense that does not causes errors, but also does not much of what was doing in presta 1.6 or 1.5 So far I see that the module in 1.7 does not validate the VAT ID with he VIES service, do not remove the taxes from the cart if the purchase is done with an EU country VAT ID different from the shop owner's country. Does this module accomplish to this tasks in your installation? I am using prestashop 1.7.2.4, clean and fresh just out of the box, those are the results I got. Bye No. This module and this changes over PS 1.7.x.x works fine! Validate VAT ID with VIES online service and remove taxes. If VAT ID isn't valid, you can't save thid ID in address. And if VAT Number field is empty in Address, don't remove taxes. It's simple. Regards! Link to comment Share on other sites More sharing options...
centoasa Posted June 5, 2018 Share Posted June 5, 2018 Thank you so much for your hard works. Sorry one question: for classes/ceckout there is a file named "CheckoutAddressStep.php": maybe it named "CheckoutAddressesStep.php"? Thank you Link to comment Share on other sites More sharing options...
krasny Posted August 2, 2018 Share Posted August 2, 2018 Hello, seems this solution no longer works in 1.7.4.2. Any help? Thank you. J Link to comment Share on other sites More sharing options...
Antakarana Posted September 1, 2018 Share Posted September 1, 2018 En 2/8/2018 a las 3:33 PM, krasny dijo: Hello, seems this solution no longer works in 1.7.4.2. Any help? Thank you. J Hi, Same problem here... this solution is not working on 1.7.4.2 Link to comment Share on other sites More sharing options...
thehurricane Posted October 30, 2018 Share Posted October 30, 2018 On 1.09.2018 at 11:31 AM, Antakarana said: Hi, Same problem here... this solution is not working on 1.7.4.2 and the same... Link to comment Share on other sites More sharing options...
RedeShop Posted January 21, 2019 Share Posted January 21, 2019 Hi, This issue is resolved when the nif field becomes mandatory in the addresses in the Customers> Addresses> Required Fields option. You may need to change the format and options for your country first. Link to comment Share on other sites More sharing options...
Giordx Posted February 6, 2019 Share Posted February 6, 2019 Everyone solve on PS 1.7.4.2 ? Link to comment Share on other sites More sharing options...
DJFearRoss Posted October 3, 2019 Share Posted October 3, 2019 On 1/21/2019 at 4:18 PM, Sandromultimedia said: Hi, This issue is resolved when the nif field becomes mandatory in the addresses in the Customers> Addresses> Required Fields option. You may need to change the format and options for your country first. The problem with this, is I don't want it to be mandatory. DNI, i think is only for Spain. Not charging VAT to VAT registered customers, is how trade within the EU works. I'm shocked that prestashop has addressed this issue. https://europa.eu/youreurope/business/taxation/vat/cross-border-vat/index_en.htm#withintheeusellgoodsanotherbusiness Link to comment Share on other sites More sharing options...
Inform-All Posted September 9, 2020 Share Posted September 9, 2020 (edited) For future reference, i also created a (free) module for PS 1.7.x. Check it out here. Edited October 14, 2022 by Inform-All (see edit history) Link to comment Share on other sites More sharing options...
AromEssence Posted October 13, 2022 Share Posted October 13, 2022 Hi everyone. Try my chance here. I'm on Prestashop 1.7.8.7, using free module VAT and have the same error: "VAT number validation service unavailable" try a lot of things, nothing works. and when my customers from Italy, Deutschland, Belgium ... have a VAT number, they don't paid taxes. It's works since years and suddenly last week, this doesn't work anymore. I thinks it's linked. Can someone find a solution? (Prestashop can help me... in exchange of 89€...). Thx Link to comment Share on other sites More sharing options...
Inform-All Posted October 14, 2022 Share Posted October 14, 2022 (edited) 21 hours ago, AromEssence said: Hi everyone. Try my chance here. I'm on Prestashop 1.7.8.7, using free module VAT and have the same error: "VAT number validation service unavailable" try a lot of things, nothing works. and when my customers from Italy, Deutschland, Belgium ... have a VAT number, they don't paid taxes. It's works since years and suddenly last week, this doesn't work anymore. I thinks it's linked. Can someone find a solution? (Prestashop can help me... in exchange of 89€...). Thx Hi, What module are you using? I have made a module for the this feature (here). But in all honesty the official Vies database has quite some offline time every now and then. Edited October 14, 2022 by Inform-All (see edit history) 1 Link to comment Share on other sites More sharing options...
AromEssence Posted October 14, 2022 Share Posted October 14, 2022 Hi Inform-All, after a lot of try, I used "VATCHECKER" instead "VATNUMBER" from Prestashop, and it's works... Thanks for your respond! Link to comment Share on other sites More sharing options...
LieBM Posted January 11, 2023 Share Posted January 11, 2023 Hi, We have developed a module to check VAT and advanced options. It is working properly with last changes in VIES API. Advanced VAT Manager Best regards! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now