Skip to main content

I'm trying to get the attributes valuesattributes values of the simple productssimple products in a grouped product to display on the detailpage (of the grouped product), but it is not working.

At the moment i have the following code in Magento_GroupedProduct/templates/product/view/type/grouped.phtml.

<?php foreach ($_associatedProducts as $_item): ?>          
  <?php $item = $objectManager->get('Magento\Catalog\Model\Product')->load($_item->getId()); 
    $item->getResource()->getAttribute('attribute_code')->getFrontend()->getValue($item) .' <br />';

I'm getting the value of the attribute now, but it looks like it's not "resetting" the value. I have 3 simple products where only 2 of them have a value for the attribute set in the admin backend. Nevertheless does the third product has the attribute value of the second one.

I hope anyone could help me to fix this problem (and maybe with better code then the objectManager). Thanks in advance

I'm trying to get the attributes values of the simple products in a grouped product to display on the detailpage (of the grouped product), but it is not working.

At the moment i have the following code in Magento_GroupedProduct/templates/product/view/type/grouped.phtml.

<?php foreach ($_associatedProducts as $_item): ?>          
  <?php $item = $objectManager->get('Magento\Catalog\Model\Product')->load($_item->getId()); 
    $item->getResource()->getAttribute('attribute_code')->getFrontend()->getValue($item) .' <br />';

I'm getting the value of the attribute now, but it looks like it's not "resetting" the value. I have 3 simple products where only 2 of them have a value for the attribute set in the admin backend. Nevertheless does the third product has the attribute value of the second one.

I hope anyone could help me to fix this problem (and maybe with better code then the objectManager). Thanks in advance

I'm trying to get the attributes values of the simple products in a grouped product to display on the detailpage (of the grouped product), but it is not working.

At the moment i have the following code in Magento_GroupedProduct/templates/product/view/type/grouped.phtml.

<?php foreach ($_associatedProducts as $_item): ?>          
  <?php $item = $objectManager->get('Magento\Catalog\Model\Product')->load($_item->getId()); 
    $item->getResource()->getAttribute('attribute_code')->getFrontend()->getValue($item) .' <br />';

I'm getting the value of the attribute now, but it looks like it's not "resetting" the value. I have 3 simple products where only 2 of them have a value for the attribute set in the admin backend. Nevertheless does the third product has the attribute value of the second one.

I hope anyone could help me to fix this problem (and maybe with better code then the objectManager). Thanks in advance

Source Link

Magento 2 - Get simple product attributes on Grouped product detailpage

I'm trying to get the attributes values of the simple products in a grouped product to display on the detailpage (of the grouped product), but it is not working.

At the moment i have the following code in Magento_GroupedProduct/templates/product/view/type/grouped.phtml.

<?php foreach ($_associatedProducts as $_item): ?>          
  <?php $item = $objectManager->get('Magento\Catalog\Model\Product')->load($_item->getId()); 
    $item->getResource()->getAttribute('attribute_code')->getFrontend()->getValue($item) .' <br />';

I'm getting the value of the attribute now, but it looks like it's not "resetting" the value. I have 3 simple products where only 2 of them have a value for the attribute set in the admin backend. Nevertheless does the third product has the attribute value of the second one.

I hope anyone could help me to fix this problem (and maybe with better code then the objectManager). Thanks in advance