I wish to add a dynamic attribute to products. I am looking to add an attribute "Calorie" associated with food products and wish to add them in bundled products much in the same way as their price add up.For eg, if I have a platter of fruits and fruit A is 40 calories and food B is 30 calories. When I keep both of them in my platter the total calorie of the platter should be 70, i.e. the sum of both individual products. Is there a way to add a dynamic attribute or is there any other way to approach this ?

  • Via setup script or on the fly? – Khoa TruongDinh Sep 11 '16 at 6:03
  • I would like to add on the fly. – Farid Haq Sep 11 '16 at 15:14
  • This should work: You create a regular custom attribute. Then create simple products for each item in the product packs and add the individual calorie value into your custom attribute on these products. Then create a group or bundle product and add the simple products to it. Now in the product page template you could get the attribute value for each simple product in the bundle/group, add them together and output them. – oscarpas Sep 11 '16 at 20:50
  • I am new to magento,can you tell me exact file and location and code I need to add. Thanks – Farid Haq Sep 17 '16 at 17:32

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.