Today we will create a simple plugin to display different home page for logged-In user and guest user without hacking magento core code.

If you don’t have knowledge about plugin structure and want to know then you can go to the following link:

If you feel little lazy then download code directly from my git repo 😉 :

Download From Git

Lets Start the fun stuff now:

Step1:- Create a Module file under the app/etc/modules/Mss_Homepage.xml

<?xml version="1.0"?>

As you know the codePool define the place where you can place our module.

There are three different codepools in magento

1. Code- It contains all magneto default modules provided by core magento team.

2. CommunityIt contains the plugin provided by community.

3. Local- we always work on the local directory.

If Magento have no local directory then create a local directory. So you can setup your module under the local folder.


Step2 : Now Create the basic folders that are required for our plugin


Step3. Now lets make files that will register the model, helper and system file with the plugin

  • app/code/local/Mss/Homepage/etc/config.xml
  • app/code/local/Mss/Homepage/etc/system.xml
  • app/code/local/Mss/Homepage/etc/adminhtml.xml

config.xml- This file inform’s magento about which block, model, helper and event you are going to use in this plugin.

See Below In this code, the class node for model “Mss_Homepage_Model” . Magento read this and auto load all model classes starting with this “Mss_Homepage_Model”.

<?xml version="1.0" encoding="UTF-8"?>

System.xml: This file allow you to add your configuration element in magento’s Admin Configuration section with simplest way.

So lets add two configuration element with our module like following image:


adminhtml.xmlThis files allow other admin users to access above shown configuration settings.

Step4. Create a helper file under helper folder app/code/local/Mss/Homepage/Helper/Data.php

Basic purpose of adding helper is to save config info because helper provides the common functionality to save the system inputs in magneto. So you don’t have to write any code to save values, You just need to add the fields through the xml file .

So lets add the below class and extends the Core helper class :

class Mss_Homepage_Helper_Data extends Mage_Core_Helper_Abstract



Step5. Now lets create Observer file that will be responsible to change the homepage for the login user.

Magento uses the Event/Observer pattern so you can easily plug in your functionality with these events.

To see magento default events click here


class Mss_Homepage_Model_Observer
    const XML_PATH_FOR_CONFIG_TO_HOMEPAGE = 'mss/mss/page';
    const XML_PATH_FOR_CONFIG_TO_MSSENABLED = 'mss/mss/enable';

       #home page
    public function homepage()

         $HomePageForLoggedIn = Mage::getStoreConfig(self::XML_PATH_FOR_CONFIG_TO_HOMEPAGE);
         $enabled = Mage::getStoreConfig(self::XML_PATH_FOR_CONFIG_TO_MSSENABLED);
        if (Mage::helper('customer')->isLoggedIn() && $HomePageForLoggedIn && $enabled) {
            // Substitute only if page is defined
            Mage::app()->getStore()->setConfig( Mage_Cms_Helper_Page::XML_PATH_HOME_PAGE,



Now you can set the different cms page from the admin config section.

Thats is it my friend!! Now logged-in user should see the different home page 🙂

Where we can use?

Some good projects need to show the different home page for their logged In/ registered user and guest user. So you can use it their and save you time.!!!!!

Download :