Hi I have a question is it possible to make a one static block to get different content for every customer that is logged in. And with this to get different home page for the customers.

  • I might say that this is a nice idea for a community extension. It could really improve the customer experience, but it may create issues if you have a full page cache system.
    – Marius
    Aug 6, 2014 at 7:55

3 Answers 3


Interesting idea.
If I would implement something like this, I would do it like this.
Let's start with the different homepage.
The action that renders the homepage is Mage_Cms_IndexController::indexAction.
By default it looks like this:

public function indexAction($coreRoute = null)
    $pageId = Mage::getStoreConfig(Mage_Cms_Helper_Page::XML_PATH_HOME_PAGE);
    if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {

This means that magento gets the page you set as homepage in system->configuration, and renders is.
If there is no such page it fallbacks to a default page.

I would rewrite this action and put my logic for it. Of course there is the problem of managing these homepages. But that's up to you.

As for blocks it should be simpler.
Just create one static block with this content:

{{block type="core/template" template="path/to/template.phtml"}}  

and you can put your logic in path/to/template.phtml where you can access the current customer like this :

$customer = Mage::getSingleton('customer/session')->getCustomer();

Sure it is possible.

put an phtml on the page content using this sintax

{{block type="core/template" template="page/home_content.phtml"}}

inside this home_content.phtml put this code

if(Mage::getSingleton('customer/session')->isLoggedIn()) {
$customer = Mage::getSingleton('customer/session')->getCustomer();
if($customer->isMyFriend()) //Check some data into customer 
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('cms_block_id_friend')->toHtml();
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('cms_block_id_foe')->toHtml();
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('cms_block_not_logged_in')->toHtml();

of course this is just a skeleton but should be sufficient to put you in the right direction


You can do this with customer groups and show a different block according to the group the customer is in. You will have to code this by yourself since i did not see any extensions to achieve this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.