Jump to content

VAT number required ONLY if company name is set


Recommended Posts

Hi all, i would like to have the VAT number field to be required but ONLY in the user's company is set.

I need this in the address section of prestashop.

 

I think i need something like this

if(isset($_POST['company']) && $_POST['company']!='')
{
if((isset($_POST['vat_number']) && $_POST['vat_number']=='') || !isset($_POST['vat_number']))
$this->errors[] = Tools::displayError('ALERT VAT IS REQUIRED');
}

but i really don't know how to do it.

 

Many thanks to all and have a nice day.

Link to comment
Share on other sites

  • 3 months later...

add in AddressController after // Check country DNI in line 158

 

/// CHECK piva EMANUELE HACK

if ( isset($address->company)&& $address->company !="")

{

if((isset($_POST['vat_number']) && $_POST['vat_number']=='') || !isset($_POST['vat_number']))

$this->errors[] = Tools::displayError('Partita iva Richiesta');

 

}

 

 

WORK FOR ME!

TNKS!!!!

Edited by glamnoise (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 2 years later...

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...