How To Get Special Price in magento Product
<?php
Mage::app();
Mage::getSingleton(‘core/session’, array(
‘name’ => ‘frontend’
));
$_productCollection = Mage::getResourceModel(‘catalogsearch/advanced_collection’)-> addAttributeToSelect(Mage::getSingleton(‘catalog/config’)-> getProductAttributes())->addMinimalPrice()->setPageSize(1)->addStoreFilter();
Mage::getSingleton(‘catalog/product_status’)->addVisibleFilterToCollection ($_productCollection);
Mage::getSingleton(‘catalog/product_visibility’)->addVisibleInSearchFilterToCollection ($_productCollection);
$todayDate = date(‘m/d/y’);
$tomorrow = mktime(0, 0, 0, date(‘m’), date(‘d’) + 1, date(‘y’));
$tomorrowDate = date(‘m/d/y’, $tomorrow);
$_productCollection->addAttributeToFilter(‘special_from_date’, array(
‘date’ => true,
‘to’ => $todayDate
))->addAttributeToFilter(‘special_to_date’, array(
‘or’ => array(
0 => array(
‘date’ => true,
‘from’ => $tomorrowDate
),
1 => array(
‘is’ => new Zend_Db_Expr(‘null’)
)
)
), ‘left’)->addAttributeToSort(‘special_from_date’, ‘desc’);
?>
<?php
$i = 0;
if ($i++ % 3 == 0)
?>
<ul>
<?php
$x = 2;
?>
<?php
foreach ($_productCollection as $_product) {
if ($_product->getData(‘special_price’) != null) {
?>
<li>
<h2><?php
if ($locale == en_US) {
echo $this->__(‘Special Offers’);
} else if ($locale == el_GR) {
echo $this->__(‘Προσφορές’);
} else {
echo $this->__(‘Special Offers’);
}
?></h2>
<img src=”<?php
echo $this->helper(‘catalog/image’)->init($_product, ‘thumbnail’)->resize(135);
?>” alt=”<?php
echo $_product->getName();
?>” width=”135″ height=”135″ />
<?php
$specialPrice = $_product->getData(‘special_price’);
$orignalPrice = $_product->getData(‘price’);
?>
<?php
}
}
?>
0