removed multiple address option
This commit is contained in:
committed by
Shreesh Arora
parent
b57126874c
commit
776d72a0a2
@@ -178,6 +178,12 @@ class AddressCore extends ObjectModel
|
||||
*/
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
// for customer address we need to check of customer address already exists.
|
||||
if ($this->id_customer) {
|
||||
if ($id_address = Customer::getCustomerIdAddress($this->id_customer)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!parent::add($autodate, $null_values)) {
|
||||
return false;
|
||||
}
|
||||
@@ -243,6 +249,15 @@ class AddressCore extends ObjectModel
|
||||
public function validateController($htmlentities = true)
|
||||
{
|
||||
$errors = parent::validateController($htmlentities);
|
||||
|
||||
// for customer address we need to check of customer address already exists.
|
||||
if ($idCustomer = Tools::getValue('id_customer')) {
|
||||
if ($id_address = Customer::getCustomerIdAddress($idCustomer)) {
|
||||
|
||||
$errors[] = sprintf(Tools::displayError('Customer address already exists. Id address: #%d'), $id_address);
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user