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

后端 未结 2 1272
佛祖请我去吃肉
佛祖请我去吃肉 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 22:59

    I have found a solution for this, 3 edited files. But these files are edited for a previous version of Magento, I don't know which version. I have uploaded this 3 files on my Magento 1.7 and it works but when add the product to the cart it give's a error with app/code/core/Mage/Sales/Model/Quote.php

    This file: Quote.php is one of the edited files, when i upload the original Quote.php it works.

    Look at this pic: http://s8.postimage.org/g8bvbth0z/Naamloos.png

    But maybe i get more errors in the future, i don't have any ideas..

    I am a noob with this, if someone can look at the edited files and chek how they have do this and compare this with the newest files for Magento 1.7 maybe we can help to many peoples with this problem.

    0 讨论(0)
  • 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 :

    <?php
       // load the product that id 125, then show attributes of the product
       $product = Mage::getModel('catalog/product')->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.

    0 讨论(0)
提交回复
热议问题