Friday, June 13, 2014

Magento - Get Product Attribute Text (Dropdown)

if($_product->getData('product_color'))
{
    echo "Product Color = ".$_product->getAttributeText('product_color');
    //echo $_product->getResource()->getAttribute('product_color')->getFrontend()->getLabel($_product);
}

Magento - Get the "Vesion" of an installed Magento module

echo "version = ".Mage::getConfig()->getModuleConfig("Unirgy_StoreLocator")->version;

Magento - Display date in particular format

echo Mage::app()->getLocale()->date(strtotime($_order->getRegDate()), null, null, false)->toString('MM/dd/YYYY');

working formats : d/M/y

Friday, November 23, 2012

Magento - Disable html block cache for a specific Block

Answer: Use getchildhtml with second arg as false.

For Example:

phtml file change:

echo $this->getChildHtml('topCategoriesList',false);

 

xml file change:

<block type="catalog/navigation" name="topCategoriesList" as="topCategoriesList" template="catalog/navigation/categorylist.phtml"

   <action method="unsetData"><key>cache_lifetime</key></action>

       <action method="unsetData"><key>cache_tags</key></action>

</block>