is it possible to show custom attributes of associated products under a grouped product in front end? (Magento)

后端 未结 2 1273
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-16 22:54

I have a typical condition in my magento Grouped product. Is it possible to show Custom attribute (color dropdown) of associated product under Grouped products in the front

2条回答
  •  无人及你
    2021-01-16 23:18

    It's not clear your question but I would give you a small example to get text field, multiple select or drop-down listbox value.

    First, we should load the product collection :

    load($this->getProduct()->getId(125));
       echo $product->getCustomAttribute();
    
       // lets say your custom attributes name is "size" and type is text field
       echo $product->getSize();
    
       // lets assume your custom attributes name is "product_size then
       echo $product->getProductSize();
    
       // lets assume your attribute type is drop-down, this will get array of attribute options instead of value that you selected
       echo $product->getAttributeText(product_size);
    
       // to get drop-down value that you selected
       $attribute = $product->getAttributes();
       $productSize = $attribute['product_size']->getFrontend()->getValue($product);
    

    let me know if it's not meet your request.

提交回复
热议问题