XML Syntax/Code for Magento

Note: You may replace double quote(“”) in the syntax width default quote(“”) if it is not working.

Remove Checkout Link

<reference name=”top.links”>
<remove name=”checkout_cart_links”/>

Remove Wishlist Link

<reference name=”top.links”>
<remove name=”wishlist_links”/>

Remove My Account Link

<action method=”removeLinkByUrl”><url helper=”customer/getAccountUrl”/></action>


<reference name=”head”&gt
<action method=”addCss”&gt

JS links

<reference name=”head”>
<action method=”addItem”>

Add class to body

<reference name=”root”>
<action method=”addBodyClass”><classname>whatever</classname></action>

Set Home Page One Column Layout

<reference name=”root”>
<action method=”setTemplate”><template>page/1column.phtml</template></action>

Add “Home / My Account / Dashboard” crumb on Account Dasboard page.

<customer_account_index translate=”label”>
<reference name=”breadcrumbs”>
<action method=”addCrumb”><crumbName>Dashboard</crumbName><crumbInfo><label>Dashboard</label><title>Dashboard</title></crumbInfo></action>

Call products on CMS page

<reference name="content">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<action method="setCategoryId"><category_id>4</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"/>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>

Remove unwanted blocks entirely

<remove name="right.poll"/>
<remove name="right.permanent.callout"/>
<remove name="left.permanent.callout"/>
<remove name="paypal.partner.right.logo"/>
<remove name="tags_popular"/>
<remove name=""/>
<remove name="checkout.cart.shipping" />
<remove name="cart_sidebar"/>
<remove name="footer_links"/>
<remove name="" />
<remove name="right.permanent.callout" />
<remove name="left.permanent.callout" />
<remove name="left.newsletter" />
<remove name="right.reports.product.viewed" />
<remove name="paypal.partner.right.logo" />
<remove name="right.poll" />
<remove name="cart_sidebar" />
<remove name="checkout_cart_link" />
<remove name="" />
<remove name="footer_links"/>
<remove name="footer_links2"/>

Edit name or modify links Register and Login links on the top of the Home page

– First remove the register link from default
– Just add this code in local xml file
<reference name="account.links">
<action method="removeLinkByUrl"><url helper="customer/getRegisterUrl"/></action>

Add following code to add modified name of link

<reference name="account.links">
<action method="addLink" translate="label title before_text" module="customer"><label>register</label><url helper="customer/getRegisterUrl" /><title>register</title><prepare/><urlParams/><position>100</position><li/><a/></action>

Add Newsletter subscribe in the Header

Step1: Copy this code and paste it in local.xml file
<reference name="header">
<block type="newsletter/subscribe" name="header.newsletter" template="newsletter/subscribe.phtml"/>
Step2: Add following code into header phtml file
<?php echo $this->getChildHtml(‘header.newsletter’); ?>

Adding Social Plugins

Step 1: Find the Code You Want to Use
On the Admin menu, select System > Configuration. In the configuration panel on the left side under General tab, select Design.
· Expand the Head Html section,
· Search for Miscellaneous Scripts and paste the third party code in that section
· If you want add this code in above the tag past it in upper one Miscellaneous Scripts section or you can paste in footer Miscellaneous Scripts section to show the Facebook like link below the Footer.
· When complete, click on Save Config button
· Or You can create a block and call it in footer.phtml file

<script type="text/javascript">
var likeIt = ‘<iframe src="’+document.URL+’" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px;"></iframe>’;

Add Newsletter through PHTML file

<?php echo $this->getLayout()->createBlock(‘newsletter/subscribe’)->setTemplate(‘newsletter/subscribe.phtml’)->toHtml(); ?>

Add JS or CSS on customer login page

If you want to add javascript or css to a specific page, say you want to add it to customer login page, then this would be the way to do it.

<reference name=’head’>
<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
<action method="addJs"><script>varien/js.js</script></action>

Set Login Page 3 Column Layout

<reference name="root">
<action method="setTemplate">

Call Static block in left sidebar

<reference name="left">
<block type="cms/block" name="home_contact_us" before="-">
<action method="setBlockId"><block_id>home_contact_us</block_id></action>

Change the category Page layout

<catalog_category_default translate="label">
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>

Add static blocks through PHTML

<?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘footer_social_links)->toHtml(); ?>

Call Static block through CMS page

{{block type =”cms/block” block_id =”your_block_id”}}

How to add static block in email template

{{block block_id =”your_block_id”}}

Call custom Static block in Right sidebar

<reference name ="right">
<block type ="cms/block" name ="your_block_id" before/after ="_">
<action method = "setBlockId"><block_id>your_block_id</block_id></action>

Call custom Static block before Footer

<reference name="footer.before">
<block type="cms/block" name="test-block">
<action method="setBlockId">

Set column count on Category Page

<reference name="product_list">
<action method="setColumnCount"><columns>4</columns></action>

<reference name="product_list">
<action method="setColumnCount"><columns>4</columns></action>

<reference name="product_list">
<action method="setColumnCount"><columns>4</columns></action>

Remove Estimation Tax on Shipping cart page

<reference name="content">
<block name="checkout.cart">
<remove name="checkout.cart.shipping"/>

Save Favicon Image of any site

Press ctrl+u for source code then copy path of favicon image ( Copy image location)
Paste it in new tab to download the image.
Magento Admin Setting

Adjust the session time out of admin panel

System > configuration > general > web > Session Cookies Management tab then set the time limit

Call Skin Image from Admin

<img src=”{{skin url=’images/banner4.jpg’}}” alt=”” />

How to Disable the Demo Store Notice

From the Admin Panel, select System > Configuration.
Select the Design tab from the left side panel in the General section.
Click the HTML Head panel to expand its options.
In the Display Demo Store Notice field, set the value to No to remove the notice.
Click [ Save Config ] to save these changes.

Set Related Product column count

system >> configuration >> catalog >> catalog >> rule-based product relation

Search link on CMS page

{{block type="core/template" name="" as="homeSearch" template="catalogsearch/"}}

CMS page syntax for phone

{{config path="general/store_information/address"}}

CMS page syntax for address

{{config path="general/store_information/phone"}}

Change Print logo format

Configuration -> Sales -> Invoice and Packing Slip Design

PHML File Changes

Call image through PHML file

<img src=”getSkinUrl(‘images/gsa-logo.png’);?>”/>

Redirect on CMS page from PHML file

<a href=”getUrl(‘cms page identifer’); ?>”>yourlinkRedirect on CMS page from CMS page/block

<a href={{store url="cms page identifer"}}>your link</a>
<a href="{{store url=’customer/account’}}">My Account</a>
<a title="Track Order" href="{{store url=""}}sales/order/history/">Track Order</a>

Call SKU through PHTML file

<?php echo $this->htmlEscape($_product->getSku()) ?>

Add Print Link through PHTML

<a title="Print" onclick="window.print();return false" class="link-print right"><?php echo "Print"?></a>

Add checkout link

<a href="<?php echo Mage::helper(‘checkout/url’)->getCheckoutUrl(); ?>">Checkout</a>

Call Store address through PHML file

<?php echo Mage::getStoreConfig(‘general/store_information/address’); ?>

Call Store phone through PHML file

<?php echo Mage::getStoreConfig(‘general/store_information/phone’); ?>

Call image from PHML

<img src="<?php echo $this->getSkinUrl(‘images/ViewProdButton.gif’); ?>" alt="">

SQL Query for Magento Database

To select path in sql query

SELECT * FROM core_config_data WHERE path LIKE ‘%base_url%’;

Update Admin password

UPDATE admin_user SET PASSWORD=MD5(‘admin@123′) WHERE username=’testuser’;

Update Admin Username

UPDATE admin_user SET username=”admin” WHERE user_id=1;

Grant permission for definer set value

grant all on *.* to ‘root’@’%’ identified by ” with grant option;

Template path hint enable

UPDATE core_config_data
WHERE path LIKE “%dev/debug%”

core_fig value change

UPDATE core_config_data
SET VALUE = REPLACE(VALUE, ‘’, ‘http://zid102/projects/teststage/’)

Vertical Scroll bar enable in iPhone Popup
#ID-Name{-webkit-overflow-scrolling: touch;overflow-y: scroll;}