Sunday, 15 September 2013

magento call static block in phtml

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_message')->toHtml(); ?>














Monday, 9 September 2013

magento layered navigation extension

I will provide you multiple select functionality  layered navigation extensionThis extension makes store navigation more flexible and more user-friendly by enabling store customer to apply multiple values of the same filter.



Please contact me for the above module. It will be suitable price for you.

magento layered navigation on homepage



<reference name="left">
<block type="catalog/navigation" name="catalog.cat.leftnav" before="cart_sidebar" template="catalog/navigation/left.phtml"/>
<block type="catalog/layer_view" name="catalog.leftnav" after="catalog.cat.leftnav" template="catalog/layer/view.phtml"/>
<action method="unsetChild"><alias>right.reports.product.viewed</alias></action>
<action method="unsetChild"><alias>right.reports.product.compared</alias></action>
</reference>
<reference name="content">
<block type="catalog/navigation" name="catalog.categories" template="catalog/navigation/category_listing.phtml"></block>
   <block type="catalog/product_list" name="product_home" template="catalog/product/list.phtml">
      <action method="setCategoryId"><category_id>52</category_id></action>
      <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
         <block type="page/html_pager" name="product_list_toolbar_pager" />
      </block>
      <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
   </block>
</reference>







Sunday, 25 August 2013

Magento Parse error: syntax error, unexpected 'endforeach' (T_ENDFOREACH), Short Open Tag Error

This error you can solved by your end. Please find the following solutions.

Go to C:\xampp\php\php.ini

Then set
short_open_tag = on

And restart your Apache Server.













Wednesday, 21 August 2013

magento get all products with child products


$collection = Mage::getModel('catalog/product')->getCollection();
foreach($collection as $assProducts)
{
$product = Mage::getModel('catalog/product')->load($assProducts->getId());
echo $product->getName().'<br>';
if($assProducts->getTypeId() == "configurable") {
       $product = Mage::getModel('catalog/product')->load($assProducts->getId());
$childProducts = Mage::getModel('catalog/product_type_configurable')
                    ->getUsedProducts(null,$product);  
foreach($childProducts as $child) {
    echo '---------'.$child->getName().$child->getId().'<br>';
}
}

}






php first element of array


$array = array( 2 => 'orange', 4 => 'banana', 9 => 'apple' )
echo reset($array); //Output : "orange"














Magento get store list from all websites


$allWebsites = Mage::app()->getWebsites();
<select id="store" name="stire" onChange="">
<?php
foreach ($allWebsites as $website) {
foreach ($website->getGroups() as $group) {
$stores = $group->getStores();
foreach($stores as $_eachStoreId => $val)
{
$_storeCode = Mage::app()->getStore($_eachStoreId)->getCode();
$_storeName = Mage::app()->getStore($_eachStoreId)->getName();
$_storeId = Mage::app()->getStore($_eachStoreId)->getId();
$webid = $website->getId();
?>
<option value="<?php echo $webid; ?>"><?php echo $_storeName;?></option>
<?php
}
}
}
?>
</select>