Magento Display Product SKU

Share
Posted on March 26th, 2013 | Posted by admin

If you happen to use Magento to develop your e-commerce site, and want to display SKU number on your product page, here is how you can use the magic method getSku to do it. On your app/design/frontend/default/default/template/catalog/product/view.phtml page, add in the line below:

getSku()) ?>

In Magento, Display Static Block in Home page using CMS Page

Share
Posted on March 23rd, 2013 | Posted by admin

In Magento, one off easiest way to show different static blocks in Home page using CMS page. For this first login into admin side and create the necessary static blocks to be display in frontend. To create static block goto CMS->Static Blocks.

Click Add New Block button and fill the required fields and finally save it. Just note down the static block Identifier that need to be use in below code to display block in Home pages.

Then goto CMS-> Pages, check the column URL key as “home” and click on it. In left hand side, click the content tab and place the below code in editor and do the alignment as per your design needs.

{{block type="cms/block" block_id="your_cms_block_identifier"}}

Magento – Using custom attributes to display dynamic content.

Share
Posted on February 22nd, 2013 | Posted by admin

With Magento’s use of custom attributes, there is a lot of flexibility. Not only in displaying attributes on the layered navigation or merely outputting them to the additional area of the product page. There is another level of customization possible. That is, the possibility to display different content based on the vallue of an attribute.

In today’s case, I am using the manufacturer attribute. While this is not a custom attribute, the same process can be used for any attribute. What we are going to do is display a message depending on the manufacture’s name.

My first step is to make a static block and put in the content I want to display. This can be anything you want-text or images. My static block is called brand_notify. Here is the contents of that static block: ‘Dietitian appointment must be indicated as completed in Magento prior to shipment of product.’.

Magento Dialog/Notification Types And Display

Share
Posted on December 14th, 2012 | Posted by admin

There are few dialog types in Magento:

1
2
3
4
5
6
7
8
// error dialog:
Mage::getSingleton('core/session')->addError('your error dialog here');
// warning:
Mage::getSingleton('core/session')->addWarning('your warning dialog here');
// notice:
Mage::getSingleton('core/session')->addNotice('your noticealog d here');
// success:
Mage::getSingleton('core/session')->addSuccess('your success dialog here');

HOW TO DISPLAY SUBCATEGORIES ANYWHERE IN MAGENTO

Share
Posted on December 12th, 2012 | Posted by admin

HOW TO DISPLAY SUBCATEGORIES ANYWHERE IN MAGENTO

If you’re planning to display the subcategories of a specific root/parent categoryanywhere you can simply use the following code and paste it in your the phtml files that you want it to show. Just please take note that you need to replace the id in the code.

<?php
$root = Mage::getModel('catalog/category')->load(2); // Put your category ID here.

//get the children of your loaded category and exploded in array
$subCat = explode(',',$root->getChildren()); 

//get the collection add filter using the exploded categories
$collection  = $root->getCollection()->addAttributeToSelect("*")->addFieldToFilter("entity_id", array("in", $subCat) );

//loop for each subscategory in a collection
foreach($collection as $subcategory) {
 echo '<a href="'.$subcategory->getURL() .'" />'.$subcategory->getName().'</a><br/>';
}

?>
Page 1 of 3123»