Jump to content

New adress in my account has same name


Recommended Posts

Hi,

 

I am trying to solve this problem. My customer create account with address and default address name. When they want to add new address they have same default name as has their first default name. Some of them do not understand that they should change address name for example to My Address 2 and write my email that this is bug. 

 

It is possible to edit address page in my account and edit default address name when I am adding new address to My Address 2 or My Address 3 depending on how many address customer has created?

 

I hope that I explain my trouble right.

 

Thanks for advice.

 

Michal

Link to comment
Share on other sites

it will be just better to ... allow the same name.

thing you want need custom coding.

 

just remove lines:
 

			if (Address::aliasExist(Tools::getValue('alias'), (int)$id_address, (int)$this->context->customer->id))
				$this->errors[] = sprintf(Tools::displayError('The alias "%s" has already been used. Please select another one.'), Tools::safeOutput(Tools::getValue('alias')));

from AddressController.php file

  • Like 1
Link to comment
Share on other sites

I thought that address name is unique but thank you for your solution. But I have to do a little correction of your code because in my AddressController is no line with 

if (Address::aliasExist(Tools::getValue('alias'), (int)$id_address, (int)$this->context->customer->id))

but I have to delete this:

			if (Db::getInstance()->getValue('
				SELECT count(*)
				FROM '._DB_PREFIX_.'address
				WHERE `alias` = \''.pSql($_POST['alias']).'\'
				AND id_address != '.(int)$id_address.'
				AND id_customer = '.(int)$this->context->customer->id.'
				AND deleted = 0') > 0)
				$this->errors[] = sprintf(Tools::displayError('The alias "%s" has already been used. Please select another one.'), Tools::safeOutput($_POST['alias']));

But thanks for your help:)

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...