Edit the file templatepagehtmlbreadcrumbs.phtml
Category Archives: Magento
Set default qty value into 1 magento
Product review page does not show up short description magento
<?php echo Mage::getModel(‘catalog/product’)->load($_product->getId())->getShortDescription() ?>
Fetch the categories associated with the products on listing page magento
<?php
$_productCollection=$this->getLoadedProductCollection();
foreach ($_productCollection as $product):
foreach($product->getCategoryIds() as $category):
$categoryIds[] = $category;
endforeach;
endforeach;
print_r( $categoryIds );
?>
Fetch the shipping address of a logged in user magento
<?php
$customer = Mage::getModel(‘customer/session’)->getCustomer();
foreach($customer->getAddressesCollection() as $address) $shiipingAddress[] = $address->getData();
foreach($shiipingAddress as $value) $region[]=$value[‘region_id’];
print_r($region);
?>
How to add a block to .phtml file Magento
<?php echo $this->getLayout()->createBlock(‘mymodule/myblock’)->setTemplate(‘mymodule/myblock.phtml’)->toHtml(); ?>
List all products under a given category on homepage magento
{{block type=”catalog/product_list” name=”home.catalog.product.list” alias=”products_homepage” category_id=”4″ template=”catalog/product/list.phtml”}}
List all products on home page magento
{{block type=”catalog/product_list” name=”home.catalog.product.list” alias=”products_homepage” template=”catalog/product/list.phtml”}}
List new products on home page Magento
{{block type=”catalog/product_new” name=”home.catalog.product.new” alias=”product_homepage” template=”catalog/product/new.phtml”}}
Include a static block on sidebar
<reference name=”left”>
<block type=”cms/block” name=”blockName” before=”-” >
<action method=”setBlockId”><block_id>block_identifier</block_id></action>
</block>
</reference>