Pages

Magento get product price

Assuming that you have known product object, $_product

1. Get product price snippet

<?php echo $this->getPriceHtml($_product, true);?>

2. Get $_product price

echo $_product->getPrice();
echo number_format($_product->getPrice(), '2', '.', ',');

3. Get $_product special price

echo $_product->getSpecialPrice();
echo number_format($_product->getSpecialPrice(), '2', '.', ',');

4. Get $_product final price

echo $_prodcut->getFinalPrice();
echo number_format($_product->getFinalPrice(), '2', '.', ',');

5.Get $_product Msrp

echo $_product->getMsrp();
echo number_format($_product->getMsrp(), '2', '.', ',');

Connect to the database in Magento

$w = Mage::getSingleton('core/resource')->getConnection('core_write');

$result = $w->query('select entity_id from catalog_product_entity');

if (!$result) { return false; }

$row = $result->fetch(PDO::FETCH_ASSOC);

if (!$row) { return false; }

All model you can use below code

$products = Mage::getModel('catalog/product')->getCollection();

$products->addAttributeToFilter('entity_id', array("in"=> array(1,2) ) );

$products->addAttributeToSelect('*');

$products->load();

foreach($products as $_prod) { var_dump($_prod->getData()); }