removed multiple address option

This commit is contained in:
shreesh arora
2022-01-14 00:40:41 +05:30
committed by Shreesh Arora
parent b57126874c
commit 776d72a0a2
7 changed files with 53 additions and 10 deletions

View File

@@ -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;
}
/**