Magento Tutorial

  1. Display magento cart in Menu

    If you want to change your shopping cart display like number of item and price ,

    i give sample image show ,

    Cart in menu bar

    <div class="mybag">

    <a href="<?php echo $this->getUrl('checkout/cart')?>">

    <span class="mybag-text">Shopping Cart:</span>

    <?php $cartcnt= Mage::helper('checkout/cart')->getItemsCount();?>

    <?php if($cartcnt==0):?>

    <span class="empty-bag"><?php echo '0 items,';?>

    <?php echo $this->helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal()); ?>


    <?php else:?>

    <span class="bag-item">

    <?php echo $cartcnt.' '.'items,';?><?php echo $this->helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal()); ?></span>

    <?php endif; ?>




    Read more »
  2. Display Related products on magento

    As a magento developer display related product on product view page.It’s easy to show related product by following few easy steps. First we will have to add products to a particular product as related product. Screen shows product added as related product

    Related Product

    After selecting products it will show on your product view page if you can`t view related product on it .Do following steps it`s very easy to follow all the best friends.

    1)Open catalog.xml

    catalog.xml file available in .

    {magento root}/app/design/frontend/default/{your theme}/layout/catalog.xml .

    If you not have the file just copy file from

    {magento toot}/app/design/frontend/base/default/layout/catalog.xml

    to your theme i already mention the path.

    2) Remove & Add some xml in catalog.xml

    Search catalog_product_view in

    {magento root}/app/design/frontend/default/{your theme}/layout/catalog.xml

    . Command or remove the following line from there .Search in catalog.xml "catalog.product.related" in appropriately line 258 under <reference name="right"> .

    <block type=“catalog/product_list_related” name=“catalog.product.related”before=“-” template=“catalog/product/list/related.phtml”/>

    add following line in catalog.xml . Search in catalog.xml "<reference name="content">" in appropriately line 189 . Below "<block type="catalog/product_view"..........>" this linl add following line.

    <block type=“catalog/product_list_related” name=“catalog.product.related”before=“-” as="catalog_product_relate" template=“catalog/product/list/related.phtml”/>

    3) Adding related product in product view page.

    Adding some code in view.phtml available in

    {magento root}/app/design/frontend/default/{your theme}/template/catalog/product/view.phtml

    If you not have the file just copy file from

    {magento toot}/app/design/frontend/base/default/template/catalog/product/view.phtml .

    Add following line in where you want to view.

    <?php echo $this->getChildHtml('catalog_product_relate');?>

    4) Related Product view


    Related Product View

    Read more »
  3. How to add Login/Logout code on magento

    Login/Logout Code in Header

    <?php if (! Mage::getSingleton('customer/session')->isLoggedIn()): ?>

    <a href="<?php echo Mage::helper('customer')->getLoginUrl(); ?>"><?php echo $this->__('Login') ?></a>

    <?php else: ?>

    <a href="<?php echo Mage::helper('customer')->getLogoutUrl(); ?>"><?php echo $this->__('Logout') ?></a>

    <?php endif; ?>

    Read more »
  4. Add wysiwyg editor in magento custom module.

    Add wysiwyg editor in magento custom module. is very easy to make it in your magento custom modue use this following method to add wysiwyg editor .

    go to the file

    {your magento root folder}/Block/Adminhtml/{module name}/Edit/Tab/Form.php

    add following code in top of the file

    $fieldset->addField('followupemail_text', 'editor', array( 


    'label' => Mage::helper('followupemail')->__('Content'),

    'title' => Mage::helper('followupemail')->__('Content'),

    'required' => true,

    'style' => 'height:24em;',

    'config' => $wysiwygConfig, ));


    go to the file

    {your magento root folder}/Block/Adminhtml/{module name}/Edit.php

    add the following line in this file


    protected function _prepareLayout()


    // Load Wysiwyg on demand and Prepare layout

    if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled() && ($block = $this->getLayout()->getBlock('head')))






    Read more »
  5. Magento

    From time to time everyone finds them selves in a position where they are faced with a development they have never confronted before. Today I was achieve to get all orders for a customer based on the customer email address.. While there are almost certainly several ways to do this, I found a nice query that is quick, and capable.

    $orderCollection = Mage::getModel(‘sales/order’)->getCollection(); $orderCollection->addFieldToFilter(‘customer_email’,'’);

    Happy coding, hope this helps next time you’re working on Magento

    Read more »
  6. Vtiger outgoing mail server setting

    Vtiger outgoing mail server setting for gmail user

    Mail Server Settings (SMTP)
    * Server Name
    User Name
    Password your email password
    From Email
    Requires Authentication?  

      if not working let`s try with this setting

    Mail Server Settings (SMTP)
    * Server Name
    User Name
    From Email
    Requires Authentication?

    no need to use user name also password , and finaly don`t enable authentication

    Read more »
  7. Magento multi site

    Do you want the multi store magento from Single installation of magento . If you want create multi store magento proceed my following way.

    Process: 1

    If your store have different type of Category and product then follow the steps. Catalog *then* Manage Categories *then* Add Root Category

    Process: 2

    Create the new Website System *then* Manage Stores *then* Create Website

    fill up all asking.

    Name: Name for the domain (“samdoit”)

    Code : Identifier for the domain (“samdoit")


    Create the new store System *then* Manage Stores *then* Create Store

    Fill all fields

    Website:) Select “” on dropdown .

    Name: ) Use samdoit_com identify of store.

    Root Category:) Select Categories from category list by default "Default Category"

    Create store view:

    System *then* Manage Stores *then* Create Store

    View Store: Select “samdoit_com” show in dropdown menu.

    Name and Code “samdoit_com”

    Make sure all leters in smaller case Status: 'Enabled'

    Process: 3

    Create Magento another domains. You need to update this following files:

    Find this two sample file installed

    magento root directory

    • index.php.sample
    • .htaccess.sample .

    Copy the two files and Rename both sample files by below names in your other domain.

    • .htaccess
    • index.php

    Open “index.php”

    and change line which start with“$mageFilename”

    $mageFilename = ‘{Your magento root}/app/Mage.php’;

    Also Change Line start with

    $mageRunCode" $mageRunCode = isset ($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ”;

    change ' ' into Your store code

    $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ‘samdoit_com’;

    Theme Changes: You must to change skin, media and javascript link . Now set Magento admin Panel by click follow way click " Configuration in System on admin panal " In Configuration tab select {YOUR website/store } from the dropdown Under Configuration tab Click "Web" under Web tab select and change the link for Secure also Unsecured : Skin Link (eg: Media Link (eg: JavaScript Link (eg: Now you done . Now your multiple stores magento is ready to use. We can create you a Magento Theme for your site by just copy the folder and paste the folder into {your magento}/skin/frontend/default/{your theme} " and paste it as your store name and then just go the "system *then* configuration *then* Web *then* Design" and change the select your store name and paste the theme name whatever you have created in magento skin folder.  

    Read more »
  8. How to change magento mobile template

    If you want to change your magento theme with mobile platform . It`s very simple just do it what i tell you in following. In Magento Admin : System > Configuration > Design is where you want to be. You also want to make sure you have the mobile designed theme . Configuration the following way Depending on how you want to serve up your store depends on what configuration you want.

    Option #1 :

    Show mobile version on Any Mobile Based OS (phone ,tablet, kindle fire)

    iPhone|iPod|BlackBerry|Pre|Palm|Googlebot-Mobile|mobi|Safari Mobile|Windows Mobile|Android|Opera Mini|mobile|Silk|Kindle

    Option #2:

    Show mobile version to just phone based browser and Display normal desktop version on tablet based devices

    (iPhone|iPod|BlackBerry|Pre|Palm|Googlebot-Mobile|mobi|Safari Mobile|Windows Mobile|Android|Opera Mini|mobile)|(!iPad|Silk|Kindle|Xoom|SCH-I800|Tablet)  


    You have chosen one of the configurations above .Go under the Design “Themes” section & add it to the following sections (Template, Skin, Layout, Default) in the “Matched Expression” field.  Then in the values section you should put in “iphone” in the value field. If you have a different mobile theme then your value field should be the theme name. Then click save config. reefer this following screenshot. mobile theme for magento.  

    Read more »
Copyright © 2016 Samdoit Infotech. All rights reserved.