<?php echo $_product->getShortDescription(); // for printing short description echo $_product->getDescription(); // for printing description //For displaying description, Go to the admin pannel //Catalod->Attributes-> Manage Attributes and edit the description attribute. //Set "Used in product listing" to "Yes". ?>
All posts by Pramod T P
Include a block in sidebar – Magento
<reference name="left"> <block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/left_nav.phtml" /> </reference> Please create file with the given name "left_nav.phtml " and put it in the corresponding location eg : /app/design/frontend/your_package/yourtheme/template/catalog/navigation/left_nav.phtml
List Products under a given category
{{block type=”catalog/product_list” category_id=”12″ template=”catalog/product/list.phtml”}}
It will list all the products under the category id “12” .
Site URL in CMS static block / Pages – Magento
{{store url=’mypage.html’}} will return the full sitr ur l . ie http://sitename.com/mypage.html/
and
{{store direct_url=’mypage.html’}} will return the full sitr ur l . ie http://sitename.com/mypage.html
The number of elements in a Javascript array
eg :
var str = new Array(“First element”, “Second”, “Last”);
alert(str.length) //will return the number of elements in an array
compare two strings – javascript
You can compare two strings using “==” operator
eg :
var str1=”Test1″;
var str2=”Test2″;
if(str1=str2)
alert(“Message”);
declare an array – javascript
You can declare an array using the constructor “Array”
var arlene1 = new Array();
var arlene2 = new Array(“First element”, “Second”, “Last”)
How to change class name of an HTML element – javascript
You can change the class name using the below given code.
document.getElementById(“idElement”).setAttribute(“class”,”className”);
Include a phtml page in CMS block – Magento
The below given code will display the the content added in “newPage.phtml”
{{block type=”core/template” name=”list-categories” template=”catalog/category/newPage.phtml”}}
Include a CMS Block in phtml file – Block
<?php //The following code will load the block with the given "identifier" // on the phtml page echo $this->getLayout()->createBlock('cms/block')-> setBlockId('identifier')->toHtml() ?>