Tuesday, July 19, 2011

How to get custom attributes values?

// Get array of items in cart
        $items = Mage::getModel('checkout/session')->getQuote()->getAllItems();

        foreach($items as $item)
        {
            $productId = $item->getProduct()->getId();
            $productList = Mage::getModel('catalog/product')->getCollection()
                ->addAttributeToSelect('my_attribute')
                ->addIdFilter($productId);
            
            foreach($productList as $product)
            {
                continue;
            }
        }
you can call attribute functions as follows:

$product->getMyAttribute();

1 comment:

  1. Hello, here you can find useful information http://www.atwix.com/magento/accessing-custom-attribute-at-checkout-or-cart/
    It can be useful information

    ReplyDelete