Skip to content

Commit

Permalink
MAGETWO-69848: Fix #9924, prefill prefix and suffix in checkout shipp…
Browse files Browse the repository at this point in the history
…ing address #9925
  • Loading branch information
Oleksii Korshenko authored Jun 15, 2017
2 parents 4c3a3bd + 5186c90 commit 26a7c33
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,26 +315,35 @@ protected function getMultilineFieldConfig($attributeCode, array $attributeConfi
*/
protected function getDefaultValue($attributeCode)
{
if ($attributeCode === 'country_id') {
return $this->directoryHelper->getDefaultCountry();
}

$customer = $this->getCustomer();
if ($customer === null) {
return null;
}

$attributeValue = null;
switch ($attributeCode) {
case 'prefix':
$attributeValue = $customer->getPrefix();
break;
case 'firstname':
if ($this->getCustomer()) {
return $this->getCustomer()->getFirstname();
}
$attributeValue = $customer->getFirstname();
break;
case 'middlename':
if ($this->getCustomer()) {
return $this->getCustomer()->getMiddlename();
}
$attributeValue = $customer->getMiddlename();
break;
case 'lastname':
if ($this->getCustomer()) {
return $this->getCustomer()->getLastname();
}
$attributeValue = $customer->getLastname();
break;
case 'suffix':
$attributeValue = $customer->getSuffix();
break;
case 'country_id':
return $this->directoryHelper->getDefaultCountry();
}
return null;

return $attributeValue;
}

/**
Expand Down

0 comments on commit 26a7c33

Please sign in to comment.