Skip to content

Commit

Permalink
use correct attribute values
Browse files Browse the repository at this point in the history
  • Loading branch information
latenzio committed Jan 6, 2017
1 parent 464f2ce commit 247e360
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ public function aroundGetCustomOptions(

$attributes = $this->getVisibleCheckoutAttributesService->execute();
if (count($attributes) > 0) {
foreach ($attributes as $attributeCode => $attributeLabel) {
$value = $item->getProduct()->getData($attributeCode);
foreach ($attributes as $attributeCode => $attribute) {
$value = $attribute->getFrontend()->getValue($item->getProduct());
if (!$value) {
continue;
}

$options[] = [
'label' => $attributeLabel,
'label' => $attribute->getStoreLabel(),
'value' => $value,
'print_value' => $value
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function aroundGetAttributeNames(\Magento\Catalog\Model\Attribute\Config

if ($groupName == 'quote_item') {
$attributes = $this->getVisibleCheckoutAttributesService->execute();
foreach ($attributes as $attributeCode => $attributeLabel) {
foreach ($attributes as $attributeCode => $attribute) {
$attributeNames[] = $attributeCode;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Service/GetVisibleCheckoutAttributesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public function execute()
$options = [];
if (count($attributes->getItems()) > 0) {
foreach ($attributes->getItems() as $attribute) {
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $handle */
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */

$options[$attribute->getAttributeCode()] = $attribute->getDefaultFrontendLabel();
$options[$attribute->getAttributeCode()] = $attribute;
}
}

Expand Down

0 comments on commit 247e360

Please sign in to comment.