[Skip to main content](#vessel-content)

#   Invalid VAT number for individuals, what can I do?

##

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

11 years 8 months ago [\#192813](#192813) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#192813 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")* was created by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")*

-- HikaShop version -- : Business: 2.3.5
-- Joomla version -- : 3.2.3
-- PHP version -- : 5.3.3

Hello, I have select "online Vat number check" in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a "Company" Address with a Valid Company vat number works correctly, but when I edit a "Individual" address with a valid document number, I obtain an "Invalid VAT number" error.

I need this information for booth, individuals and Companies

Should I configure VAT number field in a special manner?

Regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86540
- Thank you received: 14299
-
-

11 years 8 months ago [\#192857](#192857) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#192857 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hi,

The VAT number field is only to be used for VAT numbers, not any other number.
If you need to collect a document number for individuals, them you should create a new custom field of the table "address" via the menu Display&gt;Custom fields so that individuals could use that field instead of the VAT number field.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

11 years 8 months ago -  11 years 8 months ago [\#192900](#192900) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#192900 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Ok, then, can I use vat number format check function with a custom field for individuals?

If answer is yes, where is it located? and how I can use it?

Or maybe:
Can I do this field required only for a group of users? because if I can do that, my problem wil be solved. Because I can change my users policy in order to assign a user type at the registration phase.

Regards

Last edit: 11 years 8 months ago by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

11 years 8 months ago [\#192915](#192915) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#192915 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hi,

To check the VAT format on another custom field, you can create a plugin based on the function "onBeforeAddressCreate()" and "onBeforeAddressUpdate()". Then use the same functions as in the VAT helper in order to do the checks.

Something like: Code:

function onBeforeAddressCreate($addressData, $do){ if(!$this-&gt;isValid($addressData)){ $do = false; return false; } return true; } function onBeforeAddressUpdate($addressData, $do){ if(!$this-&gt;isValid($addressData)){ $do = false; return false; } return true; } function isValid(&amp;$vat){ $class = hikashop_get('class.zone'); $zone = $class-&gt;get(@$vat-&gt;address_country); if(empty($zone-&gt;zone_code_2) &#124;&#124; !in_array($zone-&gt;zone_code_2,array('AT','BE','BG','CY','CZ','DK','EE','EL','DE','PT','GR','ES','FI','HR','HU','LU','MT','SI', 'FR','GB','IE','IT','LV','LT','NL','PL','SK','RO','SE'))){ //skip check for countries outside europe return true; } //skip VAT number check for las palmas as las palmas is not in the european VAT zone if($zone-&gt;zone_code_2=='ES' &amp;&amp; !empty($vat-&gt;address_state)){ $statezone = $class-&gt;get(@$vat-&gt;address_state); if($statezone-&gt;zone_code_3=='GC'){ return true; } } static $vat_check = null; if(!isset($vat_check)){ $config = hikashop_config(); $vat_check = (int)$config-&gt;get('vat_check',2); } //Country code GR is in fact VAT EL! if($zone-&gt;zone_code_2 == 'GR') $zone-&gt;zone_code_2 = 'EL'; switch($vat_check){ case 1: case 2: if(is_object($vat)){ $vat_number =&amp; $vat-&gt;address_vat; }else{ $vat_number =&amp; $vat; } $regex = $this-&gt;getRegex($vat_number); if($regex===false){ if(is_object($vat) &amp;&amp; !empty($vat-&gt;address_country)){ //try to get the VAT country prefix from the country in the address if(!empty($zone-&gt;zone_code_2)){ $vat_number = $zone-&gt;zone_code_2.$vat_number; $regex = $this-&gt;getRegex($vat_number); } } if($regex===false){ $app = JFactory::getApplication(); $this-&gt;message = JText::_('VAT_NOT_FOR_YOUR_COUNTRY'); if(@$_REQUEST['tmpl']=='component'){ hikashop_display($this-&gt;message,'error'); }else{ $app-&gt;enqueueMessage($this-&gt;message); } return false; } } if(!$this-&gt;regexCheck($vat_number,$regex)){ return false; } $vat_number = strtoupper(str_replace(array(' ','.','-'),array('','',''),$vat_number)); $code = substr($vat_number,0, 2); if($code == 'GR'){ $code = 'EL'; $vat_number = $code.substr($vat_number,2); } if($zone-&gt;zone_code_2 != $code){ //Error, the VAT does not match with the specified country... $app = JFactory::getApplication(); $this-&gt;message = 'Your VAT number can not be used with the country you selected. Please select the right country ( CODE: '.$code.') or make sure your VAT starts with '.$zone-&gt;zone_code_2; if(@$_REQUEST['tmpl']=='component'){ hikashop_display($this-&gt;message,'error'); }else{ $app-&gt;enqueueMessage($this-&gt;message); } return false; } if($vat_check==2){ return $this-&gt;onlineCheck($vat_number); } case 0: default: } return true; } function getRegex($vat){ $regex = false; switch(strtoupper(substr(str_replace(array(' ','.','-'),array('','',''),$vat),0, 2))) { case 'AT': $regex = '/^(AT){0,1}U[0-9]{8}$/i'; break; case 'BE': $regex = '/^(BE){0,1}[0]{0,1}[0-9]{9}[0-9]{0,2}$/i'; break; case 'BG': $regex = '/^(BG){0,1}[0-9]{9,10}$/i'; break; case 'CY': $regex = '/^(CY){0,1}[0-9]{8}[A-Z]$/i'; break; case 'CZ': $regex = '/^(CZ){0,1}[0-9]{8,10}$/i'; break; case 'DK': $regex = '/^(DK){0,1}([0-9]{2}[\ ]{0,1}){3}[0-9]{2}$/i'; break; case 'EE': case 'DE': case 'PT': case 'EL': case 'GR': $regex = '/^(EE&#124;EL&#124;DE&#124;GR&#124;PT){0,1}[0-9]{9}$/i'; break; case 'ES': $regex = '/^(ES){0,1}([0-9A-Z][0-9]{7}[A-Z])&#124;([A-Z][0-9]{7}[0-9A-Z])$/i'; break; case 'FI': case 'HU': case 'LU': case 'MT': case 'SI': $regex = '/^(FI&#124;HU&#124;LU&#124;MT&#124;SI){0,1}[0-9]{8}$/i'; break; case 'FR': $regex = '/^(FR){0,1}[0-9A-Z]{2}[\ ]{0,1}[0-9]{9}$/i'; break; case 'GB': $regex = '/^(GB){0,1}([1-9][0-9]{2}[\ ]{0,1}[0-9]{4}[\ ]{0,1}[0-9]{2})&#124;([1-9][0-9]{2}[\ ]{0,1}[0-9]{4}[\ ]{0,1}[0-9]{2}[\ ]{0,1}[0-9]{3})&#124;((GD&#124;HA)[0-9]{3})$/i'; break; case 'HR': $regex = '/^(HR){0,1}[0-9]{11}$/i'; break; case 'IE': $regex = '/^(IE){0,1}[0-9][0-9A-Z\+\*][0-9]{5}[A-Z]$/i'; break; case 'IT': case 'LV': $regex = '/^(IT&#124;LV){0,1}[0-9]{11}$/i'; break; case 'LT': $regex = '/^(LT){0,1}([0-9]{9}&#124;[0-9]{12})$/i'; break; case 'NL': $regex = '/^(NL){0,1}[0-9]{9}B[0-9]{2}$/i'; break; case 'PL': case 'SK': $regex = '/^(PL&#124;SK){0,1}[0-9]{10}$/i'; break; case 'RO': $regex = '/^(RO){0,1}[1-9][0-9]{1,9}$/i'; break; case 'SE': $regex = '/^(SE){0,1}[0-9]{12}$/i'; break; default: break; } return $regex; } function regexCheck( $vat , $regex) { if(!preg_match($regex, str_replace(array(' ','.','-'),array('','',''),$vat))){ $app = JFactory::getApplication(); $this-&gt;message = JText::_('VAT_NUMBER_NOT_VALID'); if(@$_REQUEST['tmpl']=='component'){ hikashop_display($this-&gt;message,'error'); }else{ $app-&gt;enqueueMessage($this-&gt;message); } return false; } return true; } function onlineCheck($vat){ JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $processed = false; $rc = $dispatcher-&gt;trigger( 'onBeforeVATOnlineCheck', array( &amp;$this, &amp;$processed, &amp;$vat) ); if( $processed) { return $rc; } //no online check for php4 if (extension_loaded('soap')) { try{ $client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"); $countryCode = substr($vat, 0, 2); $result = $client-&gt;checkVat(array('countryCode' =&gt; $countryCode, 'vatNumber' =&gt; substr($vat, 2))); if(empty($result) &#124;&#124; !$result-&gt;valid) { $this-&gt;message = JText::_('VAT_NUMBER_NOT_VALID'); } }catch(SoapFault $e) { $this-&gt;message = $e-&gt;__toString(); return true; //$result = false; }catch (Exception $e) { $this-&gt;message = $e-&gt;__toString(); return true; //$result = false; } if ($result === false &#124;&#124; empty($result) &#124;&#124; !$result-&gt;valid ) { $app = JFactory::getApplication(); if($_REQUEST['tmpl']=='component'){ hikashop_display($this-&gt;message,'error'); }else{ $app-&gt;enqueueMessage($this-&gt;message); } return false; } }else{ $app = JFactory::getApplication(); $this-&gt;message = JText::_('SOAP_EXTENSION_NOT_FOUND'); if($_REQUEST['tmpl']=='component'){ hikashop_display($this-&gt;message,'error'); }else{ $app-&gt;enqueueMessage($this-&gt;message); } return false; } return true; }

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

11 years 8 months ago [\#193235](#193235) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#193235 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Thanks for your information. I was looking for a reason to use some time to program a plugin and this is the perfect occasion.

Any way, I'm spanish, and while I am revising your code, I FOUND A BUG. I saw a VAT exception for Las Palmas (you use comment line *"//skip VAT number check for las palmas as las palmas is not in the european VAT zone"* before the code I saw). If you do this exception, **you must also do it for Santa Cruz de Tenerife** because the VAT exception is for all the autonomous community of the Canary Islands consists of two provinces Las Palmas and Santa Cruz de Tenerife (zone_code_3=='TF')

Regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

11 years 8 months ago -  11 years 8 months ago [\#193294](#193294) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#193294 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hello again.

I have created and instaled my plugin named verifica_vat. (No installation errors). I think next step is use it.
I located address class at /administrator/components/com_hikashop/classes folder and I found save function on it that call _checkVat function and this one use vat helper.

I have 2 questions:
1.- May I change this class code in order to force it to use my plugin instead of helper? How can I do it?
2.- If first awnser is No, What should I do to use my plugin in order to verify VAT number?.

Thanks in advance.

Regards

Last edit: 11 years 8 months ago by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

11 years 8 months ago [\#193484](#193484) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#193484 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hi,

Thanks for your report about the Santa Cruz de Tenerife exception.

Regarding the question about how to use the functions in the plugin instead of the one in the Helper, you have to use $this.
For example: Code:

$this-&gt;regexCheck($vat_number,$regex)

This will call the function in your plugin, $this allow to make local calls.
So if in the code you see something like: Code:

$theClass = hikashop_get('class.the'); $theVar = $theClass-&gt;theFunction();

This call a class, so to use the function of your plugin replace that by: Code:

$theVar = $this-&gt;theFunction();

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

11 years 8 months ago [\#193520](#193520) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#193520 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Thanks for your reply. Note it´s my first plugin. One more question.
should I do these changes at /administrator/components/com_hikashop/classes/address.php?

Regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86540
- Thank you received: 14299
-
-

11 years 8 months ago [\#193576](#193576) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#193576 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hi,

No, Xavier was talking about creating a new joomla plugin implementing specific code to handle that.
It's definitely not an easy task. You might need to hire a Joomla developer to help you with that if you're not familiar with such development. We have partners you can contact for such project here: [ www.hikashop.com/home/our-partners.html](https://www.hikashop.com/home/our-partners.html)
But if you're a skilled PHP developer it shouldn't be a problem.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

11 years 8 months ago -  11 years 8 months ago [\#193828](#193828) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#193828 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hi Nicholas.
I had create my own plugin, I instaled it without errors, and I published it.
When I select HikaShop -&gt; System -&gt;Plugins-&gt;New. I can see it in the list (plugin-list.jpg). When I click on it, Joomla opens it in Joomla Plugin Manager (plugin_Manager.jpg). I saved it, and it appears enabled at Joomla Plugin Manager list (plugin_Man_list.jpg) but not at HickaShop System-&gt;plugin list.

The only thing I need to know is how can I invoke it? (I also attached php code and plugin xml.), because, I understood, when you install and publish a pluging, this plugin overrides every helper function you use into plugin.

Please, correct me if I'm wrong.

Regards

- [ ![plugin&#95;Man&#95;list.jpg](/forum/attachment/22920) ](/forum/attachment/22920 "...n&#95;Man&#95;list.jpg") [ ](/forum/attachment/22920?download=1 "...n&#95;Man&#95;list.jpg")
- [ ![plugin&#95;Manager.jpg](/forum/attachment/22921) ](/forum/attachment/22921 "...in&#95;Manager.jpg") [ ](/forum/attachment/22921?download=1 "...in&#95;Manager.jpg")
- [ ![plugin-list.jpg](/forum/attachment/22922) ](/forum/attachment/22922 "plugin-list.jpg") [ ](/forum/attachment/22922?download=1 "plugin-list.jpg")

Last edit: 11 years 8 months ago by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86540
- Thank you received: 14299
-
-

11 years 8 months ago [\#193984](#193984) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#193984 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hi,

You need to deactivate the option "VAT number check" of the HikaShop configuration so that the VAT check is not done anymore by HikaShop.
Then, your plugin will be called automatically just before the address is saved and you'll be able to do the checks you want etc in your plugin.

I checked its code and it looks good. You should definitely get it called in the onBeforeAddressCreate function if you activated the plugin via the Joomla plugins manager.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

11 years 8 months ago -  11 years 8 months ago [\#194052](#194052) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#194052 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Thank you very much for your reply Nicolas. Yesterday I spent all day looking for information about Joomla plugins, but I don't found anything that suits with my problem.

I did some minors changes in my plugin php code replacing this code lines because hikashop vat_chek config is set to 0 : Code:

if(!isset($vat_check)){ $config = hikashop_config(); $vat_check = (int)$config-&gt;get('vat_check',2); }

by this other: Code:

$usuario = JFactory::getUser(); foreach ($usuario-&gt;groups as $grupo){ $grupo = (int)$grupo; if ($grupo == 21){ //My User group 21 = Company with VAT number =&gt; Online check $vat_check = 2; } if ($grupo == 23){ //My User group 23 = Company without VAT number =&gt; No check $vat_check = 0; } if ($grupo == 24){ //My User group 24 = Individuals =&gt; Format check $vat_check = 1; } }

I have tried some scenarios putting some flags in the code, AND IT WORKS!!!

Regards

Last edit: 11 years 8 months ago by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

10 years 8 months ago [\#231281](#231281) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#231281 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hello, I have One question:

¿Have you modified vat_check behaviour?

Because, my plugin STOP WORK SUDENLY!!!. Some weeks ago it works but today I'm doing VAT tests and when I edit one of my Billing addresses at checkout it don't work.
No error messages, symply don't check VAT number anymore if i type "123456a" and clic "Ok button" Hikashop store this value without checking it

I insert in my plugin code one flag in order to see one value and don't work.
This is the flag;: Code:

$app = JFactory::getApplication(); $this-&gt;message = 'valor de Vat_check: '.$vat_check; hikashop_display($this-&gt;message,'error');

I look for my plugin in Joomla plugin manager and it is active, but in Hikashop Configuration-&gt;Plugins there are no plugins include if I create a new one, edit it and save it like Hikashop message said.

What can I do?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86540
- Thank you received: 14299
-
-

10 years 8 months ago [\#231311](#231311) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#231311 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hi,

The onBeforeAddressCreate($addressData, $do) and onBeforeAddressUpdate($addressData, $do) triggers still work like before.
We didn't touch them in a long time.
So it must be something else.
Try on the backend of the website. The saving of the address in the backend should also trigger your plugin. If it doesn't, it means that the plugin is either not enabled, its files have been removed, or its access is restricted in some way.
If it works in the backend and not the frontend, then is a problem with the way your checkout is configured I suppose.
For example, maybe you changed the way the addresses are edited on the checkout with the settings of the Checkout tab of the HikaShop configuration.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

10 years 8 months ago -  10 years 8 months ago [\#232030](#232030) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#232030 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hi Nicholas. Sorry for delay, I'm out of office for some days.

My plugin does not work either in the backend. Maybe this can be influenced by the selections in System-&gt; Configuration-&gt; ACL? (I attach my "Plugins" ACL configuration)

Anyway, my plugin should be displayed in System-&gt;Plugins list?. Because there is no plugins also if I add new one via "New" button.

Thanks

- [ ![Plugin&#95;ACL.jpg](/forum/attachment/29877) ](/forum/attachment/29877 "Plugin&#95;ACL.jpg") [ ](/forum/attachment/29877?download=1 "Plugin&#95;ACL.jpg")

Last edit: 10 years 8 months ago by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86540
- Thank you received: 14299
-
-

10 years 8 months ago [\#232035](#232035) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#232035 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hi,

No, you don't need to see it in System&gt;Plugins.
But you need to enable it in the Joomla plugins manager.
Could you provide a copy of the plugin ? It would be easier to tell you what's wrong with it.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

10 years 8 months ago -  10 years 8 months ago [\#232101](#232101) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#232101 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

The plugin is enable, as you can see in attached file "hika_plug.jpg" and "joomla_plug.jpg", when I click in "New" button at System-&gt;Plugins it appear enabled. In addition I have reinstalled and enabled it in joomla plugin manager and refresh joomla cache in joomla extension manager and still don't work in fronten, neither the backend.

Attached are plugin files, which are the same as I attached a few posts above.
[ www.hikashop.com/forum/checkout/875355-i...can-i-do.html#193828](http://www.hikashop.com/forum/checkout/875355-invalid-vat-number-for-individuals-what-can-i-do.html#193828)
Files "verifica_vat.php" and "verifica_vat_xml.txt"

Anyway what's about ACL? , does ACL can affect?

Regards

- [ ![Hika&#95;plug.jpg](/forum/attachment/29885) ](/forum/attachment/29885 "Hika&#95;plug.jpg") [ ](/forum/attachment/29885?download=1 "Hika&#95;plug.jpg")
- [ ![joomla&#95;plug.jpg](/forum/attachment/29886) ](/forum/attachment/29886 "joomla&#95;plug.jpg") [ ](/forum/attachment/29886?download=1 "joomla&#95;plug.jpg")

Last edit: 10 years 8 months ago by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile"). Reason: Original xml file filtered and don't attached, resaved as txt file

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86540
- Thank you received: 14299
-
-

10 years 8 months ago [\#232260](#232260) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#232260 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hi,

The problem is indeed in your plugin.
The goal of the plugin is to change the $do variable passed to the onBeforeAddressCreate and onBeforeAddressUpdate functions to false when the vat number is invalid.
But to do that, you need to have the $do variable passed as a reference. And for that, you need to prefix the $do variable with the &amp; symbol, like in our developer documentation:
[ www.hikashop.com/support/documentation/6...ntation.html#address](http://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#address)
But you didn't put the &amp; symbol in your plugin and thus, instead of having a reference to the $do variable, you get a copy of it. And thus, even if you change your copy to false, the original variable is still true and thus, even though your plugin is executed properly, it just doesn't do anything.

Add the &amp; symbols and you'll see that it will work.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")**
- [![pljuarez's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34788-pljuarez "View pljuarez's Profile") Topic Author
- [ Offline](/forum/user/34788-pljuarez)

Less More

- Posts: 79
- Thank you received: 3
-
-

10 years 7 months ago -  10 years 7 months ago [\#234604](#234604) by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")  Replied by *[pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#234604 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hello Nicholas, sorry for delay, but I was out of office last 3 weeks.

Like you said, the problem is in the plugin, because I have inserted a sleep(10) function behind a var_dump function in order to see the values of the user object, I tried with both objects in var_dump function ($usr_joomla and $usr_hika) and process waits 10 seconds (this means that the plugin is running) but I didn't obtain any output.

To obtain hikashop user id I used this code: Code:

$usr_joomla = JFactory::getUser(); //obtain joomla user $class = hikashop_get('class.user'); $usr_hika = $class-&gt;get($usr_joomla-&gt;id,'cms'); //obtain hikashop user var_dump(get_object_vars($usr_joomla)); sleep (10); switch ($usr_hika-&gt;user_tipo){ case...

"user_tipo" is a custom field I created in user table.

Like you can see, I use JFactory::getUser() function in order to obtain a Joomla userid to obtain a valid hikashop userid and then I access to hikashop user custom fields values. Before last update this code ran correctly.

Did you modified hikashop user behaviour?
What can I do to access hikashop user custom fields values?

Thanks in advance

Last edit: 10 years 7 months ago by [pljuarez](/forum/user/34788-pljuarez "View pljuarez's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86540
- Thank you received: 14299
-
-

10 years 7 months ago [\#234608](#234608) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Invalid VAT number for individuals, what can I do?](/forum/27-checkout/875355-invalid-vat-number-for-individuals-what-can-i-do#234608 "-- HikaShop version -- : Business: 2.3.5 -- Joomla version -- : 3.2.3 -- PHP version -- : 5.3.3  Hello, I have select &quot;online Vat number check&quot; in Configuration-&gt;Taxes-&gt;VAT number check, and when I edit a &quot;Company&quot; Address with a Valid Company vat number works correctly, but when I edit a &quot;Individual&quot; address with a valid document number, I obtain an &quot;Invalid VAT number&quot; error.  I need this information for booth, individuals and Companies  Should I configure VAT number field in a special manner?  Regards")*

Hi,

We didn't change anything. The custom user fields values are still in $usr_hika.
Please note however that this code won't work if you're not logged in.
For example, if you do a guest checkout: you still have a user address, but Joomla doesn't have a user account and thus $usr_joomla-&gt;id will be empty.

Also, doing a sleep won't help you debug your code.
A sleep will stop the processing of the request before resuming it. But what you echo in your code won't be sent to the browser until you do a flush or the process exit.
The simplest is to do it like that:
var_dump($usr_joomla);
exit;
That way, the process immediately stops and you get the var_dump data displayed.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTM1NS1pbnZhbGlkLXZhdC1udW1iZXItZm9yLWluZGl2aWR1YWxzLXdoYXQtY2FuLWktZG8/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.120 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
