Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Commit

Permalink
fix customer extended attribute for boolean attribute type
Browse files Browse the repository at this point in the history
  • Loading branch information
ildelux committed Mar 27, 2019
1 parent 0899be1 commit 7b4e5cf
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public function getCustomerExtraProperties($customer, $type = 'extended')
if($type == $map['hub_type'])
{
$value = $this->_getCustomerAttributeValue($map['magento_attribute'], $customer);
if(strlen($value) > 0)
if(!is_null($value))
{
$extraProperties[$map['hub_attribute']] = $value;
}
Expand All @@ -419,7 +419,6 @@ protected function _getCustomerAttributeValue($attributeCode, $customer)
$value = null;
if($attributeCode && $customer)
{
$value = '';
if($attributeCode == 'entity_id')
{
$value = $customer->getEntityId();
Expand All @@ -437,15 +436,15 @@ protected function _getCustomerAttributeValue($attributeCode, $customer)
if ($customerAttribute->getFrontendInput() == 'select' ||
$customerAttribute->getFrontendInput() == 'multiselect')
{
$value.= ''.$customerAttribute->getSource()->getOptionText($customer->getData($attributeCode));
$value = $customerAttribute->getSource()->getOptionText($customer->getData($attributeCode));
}
elseif($customerAttribute->getBackendType() == 'datetime')
{
$value .= date('Y-m-d', strtotime($customer->getData($attributeCode)));
$value = date('Y-m-d', strtotime($customer->getData($attributeCode)));
}
else
{
$value.= $customer->getData($attributeCode);
$value = $customer->getData($attributeCode);
}
}
catch(\Magento\Framework\Exception\NoSuchEntityException $e)
Expand All @@ -464,15 +463,15 @@ protected function _getCustomerAttributeValue($attributeCode, $customer)
if ($addressAttribute->getFrontendInput() == 'select' ||
$addressAttribute->getFrontendInput() == 'multiselect')
{
$value.= '' . $addressAttribute->getSource()->getOptionText($address->getData($attributeCode));
$value = $addressAttribute->getSource()->getOptionText($address->getData($attributeCode));
}
elseif($addressAttribute->getBackendType() == 'datetime')
{
$value .= date('Y-m-d', strtotime($addressAttribute->getData($attributeCode)));
$value = date('Y-m-d', strtotime($addressAttribute->getData($attributeCode)));
}
else
{
$value.= $address->getData($attributeCode);
$value = $address->getData($attributeCode);
}
}
}
Expand Down

0 comments on commit 7b4e5cf

Please sign in to comment.