现在的位置: 首页 > 综合 > 正文

Magento – get custom attributes

2014年01月07日 ⁄ 综合 ⁄ 共 504字 ⁄ 字号 评论关闭
Code:
  1. <?php   
  2.   
  3. // this will fix the "add to cart" bug.   
  4. // we need to refetch the products to get our custom attribs   
  5. $products= Mage::getModel('catalog/product')->getCollection()   
  6.     ->addAttributeToSelect('rbanh_type')   
  7.     ->addAttributeToSelect('rbanh_price')   
  8.     ->addAttributeToSelect('rbanh_color')   
  9.     ;   
  10. $product2 = $products->getItemById($product_id);   
  11.   
  12. $rbanhtype = $product2->getRbanh_type();   
  13. $rbanhprice = $product2->getRbanh_price();   
  14. $rbanhcolor = $product2->getRbanh_color();   
  15.   
  16. ?>  

 

抱歉!评论已关闭.