Jump to content

Get address field list for a country inside a controller


brennino

Recommended Posts

Hi,

 

When one of my customer is a company and is inside European Union they must insert a vat number inside the address form.

If the customer is a company and is outside European Union, vat number is not mandatory.

 

To achieve this situation, searching on this forum, I put this code inside /controllers/front/AddressController.php :

if ( isset($address->company)&& $address->company !="" )
{
		if((isset($_POST['vat_number']) && $_POST['vat_number']=='') || !isset($_POST['vat_number']))
			$this->errors[] = Tools::displayError('VAT number required for companies');
}

This allows me to make vat_number mandatory for all companies and not for privates.

 

Now I have to know if the country selected by the user is inside the EU.

 

I think to remove the vat_number field for non UE countries (using the prestashop's admin panel) and check inside the controller if the country has or not vat_number field inside its field list.

 

How to get address field list for the country selected by the user?

 

Thanks

 

Brennino

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...