Adding variants causes 500 internal server error
13 years 8 months ago #84828
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Replied by Jerome on topic Adding variants causes 500 internal server error
Hi,
From the documentation of ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
You could use this code for the helper vat
But you got an error because the Member State service is unavailable, so that's not an bug in HikaShop.
Regards,
From the documentation of ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
The thing which is strange is that the SoapClient is called into a try catch so, it should be catch by HikaShop and not trigger the PHP error message.MS_UNAVAILABLE: The Member State service is unavailable, try again later or with another Member State;
You could use this code for the helper vat
Code:
function onlineCheck($vat){
//no online check for php4
if (extension_loaded('soap')) {
try{
$client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
$vat = strtoupper(str_replace(array(' ','.'),array('',''),$vat));
$result = $client->checkVat(array('countryCode' => substr($vat, 0, 2), 'vatNumber' => substr($vat, 2)));
if(empty($result) || !$result->valid) {
$this->message = JText::_('VAT_NUMBER_NOT_VALID');
}
}catch(SoapFault $e) {
$this->message = $e->__toString();
$result = false;
}catch (Exception $e) {
$this->message = $e->__toString();
$result = false;
}
if ($result === false || empty($result) || !$result->valid ) {
$app =& JFactory::getApplication();
if($_REQUEST['tmpl']=='component'){
hikashop_display($this->message,'error');
}else{
$app->enqueueMessage($this->message);
}
return false;
}
}else{
$app =& JFactory::getApplication();
$this->message = JText::_('SOAP_EXTENSION_NOT_FOUND');
if($_REQUEST['tmpl']=='component'){
hikashop_display($this->message,'error');
}else{
$app->enqueueMessage($this->message);
}
return false;
}
return true;
}
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: jen168
Please Log in or Create an account to join the conversation.
Time to create page: 0.147 seconds