Retrieve product attributes outside product page


/ Published in: PHP
Save to your folder(s)

How to retrieve product attributes outisde the product page in Magento


Copy this code and paste it in your HTML
  1. /*
  2. <!-- in your modules config.xml -->
  3. <config>
  4.   <global>
  5.   <sales>
  6.   <quote>
  7.   <item>
  8.   <product_attributes>
  9.   <your_attribute/>
  10.   </product_attributes>
  11.   </item>
  12.   </quote>
  13.   </sales>
  14.   </global>
  15. </config>
  16. */
  17.  
  18. /* to read it inside the code (as far as $item = the item in question */
  19. echo $item->getData('your_attribute');
  20.  
  21. /* If you are reading it from an observer or from the quote / cart object */
  22. echo $item->getProduct()->getData('your_attribute');

URL: http://www.magentocommerce.com/boards/viewthread/43580/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.