Social Icons

twitterfacebookgoogle pluslinkedinemail

Wednesday, 10 April 2013

Get Only Column , First item , Last item , or convert to xml from Collection

if you want to get only one column from product collection. you can write look like.

$product_collection = Mage::getModel('catalog/product')


get product with name anant


get first or last item/row from the collection

echo $product_collection->getFirstItem()->getName();

echo $product_collection->getLastItem()->getName();

get Collection data as XML or convert collection in xml

var_dump($product_collection->getFirstItem()->toXml() );

No comments :

Post a Comment


Free Advertisement

Free Advertisement

Free Advertisement

Free Advertisement