While working in Magento, you might have seen that there are various model defined like sales,catalog etc.
I am writing here a script for working with catalog product model.
<?php $model = Mage::getModel('catalog/product') //get product model //get product collection $collection = $model->getCollection() ->addStoreFilter() //store filter ->addAttributeToSelect('*') //for getting all attributes, you can specify the attributes also (comma seperated) ->addAttributeToFilter('sku',array('like' => '%ABC%')) //for restricting data ->addAttributeToSort('sku', 'asc'); // for sorting the result set //now you can fetch products data if(!empty($collection)): foreach($collection as $_product) { echo $_product->getShortDescription(); //product's short description echo $_product->getDescription(); // product's long description echo $_product->getName(); //product name echo $_product->getPrice(); //product's regular Price echo $_product->getSpecialPrice(); //product's special Price echo $_product->getProductUrl(); //product url echo $_product->getId(); //product's id echo $_product->getSku(); //product's sku } endif; ?>
I hope it is useful to you.