steptravel Posted November 22, 2011 Share Posted November 22, 2011 Hello, I have this problem, that the module "European VAT number" is not working correctly. It does not check/validate any VAT number. I've tried to fix something in php code but it didn't help. So, maybe knows how to manage this problem? Thank you:) Link to comment Share on other sites More sharing options...
Mike Kranzler Posted November 22, 2011 Share Posted November 22, 2011 Hi steptravel, Can you please try resetting the module and let me know if that resolves it for you? -Mike Link to comment Share on other sites More sharing options...
steptravel Posted November 23, 2011 Author Share Posted November 23, 2011 Resetting doesn't help, still occurs erorr: VAT number validation service unavailable. Link to comment Share on other sites More sharing options...
Mike Kranzler Posted November 23, 2011 Share Posted November 23, 2011 Resetting doesn't help, still occurs erorr: VAT number validation service unavailable. Hi steptravel, In line 119 of your /modules/vatnumber/vatnumber.php file, please increase the value here: @ini_set('default_socket_timeout', 2); And let me know if that resolves your issue. -Mike Link to comment Share on other sites More sharing options...
steptravel Posted November 24, 2011 Author Share Posted November 24, 2011 Hi steptravel, In line 119 of your /modules/vatnumber/vatnumber.php file, please increase the value here: @ini_set('default_socket_timeout', 2); Thank you Mike, but can you write me the code more accurately, cause in line 119 I have different things. Maybe you can write what's above this line as well? Link to comment Share on other sites More sharing options...
Mike Kranzler Posted November 29, 2011 Share Posted November 29, 2011 Hi steptravel, Have you tried running a quick search in that file for "default_socket_timeout"? Depending on the version you're running, it may be in a slightly different place but if you search for that specific term you should be able to find it pretty easily. -Mike Link to comment Share on other sites More sharing options...
steptravel Posted December 2, 2011 Author Share Posted December 2, 2011 Hi Mike, The thing is that I have about four of these lines in the code. And what do you mean by "please increase the value here:"? what value should I increase? Thank you:) Link to comment Share on other sites More sharing options...
Mike Kranzler Posted December 2, 2011 Share Posted December 2, 2011 Hi steptravel, What version of PrestaShop are you using? -Mike Link to comment Share on other sites More sharing options...
steptravel Posted December 5, 2011 Author Share Posted December 5, 2011 Prestashop 1.4.4.1 Link to comment Share on other sites More sharing options...
Mike Kranzler Posted December 5, 2011 Share Posted December 5, 2011 Hi steptravel, That full string, @ini_set('default_socket_timeout', 2), should only be found once in your vatnumber.php file in v1.4.4.1. And all you need to do to increase the value is change "2" to a larger number, such as 5, and then be sure to save it via FTP. I hope this helps. -Mike Link to comment Share on other sites More sharing options...
steptravel Posted December 6, 2011 Author Share Posted December 6, 2011 Hi, It helped!!! but on 1.4.6.2 version. Thank You, Mike:) Link to comment Share on other sites More sharing options...
Mike Kranzler Posted December 6, 2011 Share Posted December 6, 2011 I'm glad I could help! I'll go ahead and mark this as solved for you. -Mike Link to comment Share on other sites More sharing options...
clegeard Posted December 18, 2012 Share Posted December 18, 2012 I have the same problem with version 1.5.2.0, and VAT European Module Version 1.2. Each time I try to add a customer with a VAT number, I get this message "VAT number validation service unavailable" Does somebody know what is the problem ? Thanks. Link to comment Share on other sites More sharing options...
clegeard Posted February 14, 2013 Share Posted February 14, 2013 I have realized that the problem only occurs online and not on my local server. On my local server, I have php 5.3.8, and online 5.3.4, do we have to use php 5.3.8 for that module to work? I have compared the php.ini, and I can't see any major differences. Does somebody have an idea? Link to comment Share on other sites More sharing options...
zaxone Posted May 25, 2013 Share Posted May 25, 2013 Hi, is there any solution for this problem on 1.5.4.1? I tried to increase the default_socket_timeout with lo luck. Thanks. Link to comment Share on other sites More sharing options...
YanK1973 Posted May 28, 2013 Share Posted May 28, 2013 Hi, is there any solution for this problem on 1.5.4.1? I tried to increase the default_socket_timeout with lo luck. Thanks. +1 Same here. Link to comment Share on other sites More sharing options...
Atteso Posted August 12, 2013 Share Posted August 12, 2013 (edited) Hi, is there any solution for this problem on 1.5.4.1? I tried to increase the default_socket_timeout with lo luck. Thanks. +1 Same here... :-( Edited August 12, 2013 by Atteso (see edit history) Link to comment Share on other sites More sharing options...
logan1ro Posted August 19, 2013 Share Posted August 19, 2013 Hello, For PS 1.5.4.1: Change line 123 to: $url = 'http://ec.europa.eu/taxation_customs/vies/vatResponse.html?locale=EN&memberStateCode='.urlencode($prefix).'&number='.$vat.'&traderName='; The problem was an invalid link from ec.europa.eu Hope this will help. Link to comment Share on other sites More sharing options...
Atteso Posted August 19, 2013 Share Posted August 19, 2013 Hello, For PS 1.5.4.1: Change line 123 to: $url = 'http://ec.europa.eu/taxation_customs/vies/vatResponse.html?locale=EN&memberStateCode='.urlencode($prefix).'&number='.$vat.'&traderName='; The problem was an invalid link from ec.europa.eu Hope this will help. Hi, I've changed the link in the vatnumber.php but the result is the same :-( 1 Link to comment Share on other sites More sharing options...
Etienne Doek Posted December 10, 2013 Share Posted December 10, 2013 (edited) Creating a stream context with a User-Agent did the trick for me: public static function WebServiceCheck($vatNumber) { if (empty($vatNumber)) return array(); $vatNumber = str_replace(' ', '', $vatNumber); $prefix = substr($vatNumber, 0, 2); if (array_search($prefix, self::getPrefixIntracomVAT()) === false) return array(Tools::displayError('Invalid VAT number')); // EDK addition. Seems the site requires a user agent $options = array( 'http'=>array( 'method'=>"GET", 'header'=>"User-Agent: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36\r\n" // i.e. An iPad ) ); $context = stream_context_create($options); // EDK end $vat = substr($vatNumber, 2); $url = 'http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms='.urlencode($prefix).'&iso='.urlencode($prefix).'&vat='.urlencode($vat); @ini_set('default_socket_timeout', 2); for ($i = 0; $i < 3; $i++) { // if ($pageRes = file_get_contents($url)) if ($pageRes = file_get_contents($url, false, $context)) // EDK { if (preg_match('/invalid VAT number/i', $pageRes)) { @ini_restore('default_socket_timeout'); return array(Tools::displayError('VAT number not found')); } else if (preg_match('/valid VAT number/i', $pageRes)) { @ini_restore('default_socket_timeout'); return array(); } else ++$i; } else sleep(1); } @ini_restore('default_socket_timeout'); return array(Tools::displayError('VAT number validation service unavailable')); } Changing the socket time out had no effect. Prestashop 1.5.6.1, VAT module European VAT number 1.2 <edit> Update was not such a big success so now I'm back on 1.5.6.0. Problem and solution are the same. </edit> Edited December 12, 2013 by Etienne Doek (see edit history) 1 Link to comment Share on other sites More sharing options...
waldok Posted January 25, 2014 Share Posted January 25, 2014 Creating a stream context with a User-Agent did the trick for me: public static function WebServiceCheck($vatNumber) { if (empty($vatNumber)) return array(); $vatNumber = str_replace(' ', '', $vatNumber); $prefix = substr($vatNumber, 0, 2); if (array_search($prefix, self::getPrefixIntracomVAT()) === false) return array(Tools::displayError('Invalid VAT number')); // EDK addition. Seems the site requires a user agent $options = array( 'http'=>array( 'method'=>"GET", 'header'=>"User-Agent: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36\r\n" // i.e. An iPad ) ); $context = stream_context_create($options); // EDK end $vat = substr($vatNumber, 2); $url = 'http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms='.urlencode($prefix).'&iso='.urlencode($prefix).'&vat='.urlencode($vat); @ini_set('default_socket_timeout', 2); for ($i = 0; $i < 3; $i++) { // if ($pageRes = file_get_contents($url)) if ($pageRes = file_get_contents($url, false, $context)) // EDK { if (preg_match('/invalid VAT number/i', $pageRes)) { @ini_restore('default_socket_timeout'); return array(Tools::displayError('VAT number not found')); } else if (preg_match('/valid VAT number/i', $pageRes)) { @ini_restore('default_socket_timeout'); return array(); } else ++$i; } else sleep(1); } @ini_restore('default_socket_timeout'); return array(Tools::displayError('VAT number validation service unavailable')); } Changing the socket time out had no effect. Prestashop 1.5.6.1, VAT module European VAT number 1.2 <edit> Update was not such a big success so now I'm back on 1.5.6.0. Problem and solution are the same. </edit> I had the same issue. The solution above works on PrestaShop 1.5.6.2 and European VAT number 1.2. But why they do not issue European VAT number update? Link to comment Share on other sites More sharing options...
w3bsolutions Posted October 28, 2014 Share Posted October 28, 2014 I am having the same issue on PS 1.6 with vat module version 1.7.2. The thing is I only get the error when I introduce a vat number from my own country (when tax should still be applied). Other valid EU vat numbers are validated fine but not the Vat numbers from my ouwn country (Spain). I already have Spain selected as "my country" on the vat configuration page. Anyone else having the same issue? Link to comment Share on other sites More sharing options...
w3bsolutions Posted November 2, 2014 Share Posted November 2, 2014 I opened a bug report for the module issue, if you have this issue please vote and comment there too: http://forge.prestashop.com/browse/PNM-2939 Thanks! Link to comment Share on other sites More sharing options...
YanK1973 Posted May 31, 2017 Share Posted May 31, 2017 Hello, 1.5.4.1 and module v.1.7. EU service was down few days ago for some minutes and now module is giving error "service not available" I have: - reset module - increase timeout value from 2 to 10 - url link seems ok http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms='.urlencode($prefix).'&iso='.urlencode($prefix).'&vat='.urlencode($vat); Anything else to check? Link to comment Share on other sites More sharing options...
Recommended Posts