0

With the code below I can load all the attributes from a specific group, in this case attribute group with id: 37

<?php 
    $av_attribute_group = $_product->getAttributes(37);

    foreach ($av_attribute_group as $av_attribute_groups):

        $av_attr_name = $av_attribute_groups->getName();
        $av_attr_label = $_product->getResource()->getAttribute($av_attr_name)->getFrontend()->getLabel($_product);
        $av_attr_value = $_product->getResource()->getAttribute($av_attr_name)->getFrontend()->getValue($_product);

        if( $av_attr_value != "" ) :

        ?>

            <div class="av-product-specs-table-row">
                <div class="av-product-specs-table-row-left"><?php echo $av_attr_label; ?></div>
                <div class="av-product-specs-table-row-right">
                    <?php 
                        if( $av_attr_value == "Yes" || $av_attr_value == "Ja" ) : ?>
                            <div class="av-spec-yes"></div>
                        <?php elseif( $av_attr_value == "No" || $av_attr_value == "Nee" ) : ?>
                            <div class="av-spec-no"></div>
                        <?php else : 
                            echo $av_attr_value;
                        endif; 
                    ?>
                </div>
            </div>

        <?php endif; ?>             
<?php endforeach ?>

But I also want to load the name of attribute group with id 37, how can I do that?

Regards,

  • do you need to get the attribute name by attribute id? – aravind Jul 19 at 11:50
  • Hi @aravind, Yes please – n00bly Jul 23 at 7:30
  • Is it custom module? – aravind Jul 23 at 8:39
  • I'm only using the code above, no extra module or something. – n00bly Jul 23 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.