Magento Forum

   
Change content if user is logged in (via static blocks)
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 

I am pretty sure this is possible (well i hope).

I have a static block that I have created from the admin. Within that static block is some very basic text content that I want to change based if the customer is logged in or not...ie: in a similar way i guess to how the Log in / Log out text works.

I have done a few searches, but it does not appear to be an area that’s been covered, it at all, in any great detail.

I am presuming some form of if statement will be needed, but not knowing the code fully yet, I’m not sure how this could be achieved.

All answered warmly received.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

It will be easier to create .phtml template with this functionality:

<?php if (Mage::getSingleton('customer/session')->isLoggedIn()): ?>
Logged in
<?php 
else: ?>
Logged out
<?php 
endif ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 

Hiya Moshe,

Does that rule out static blocks as being a way forward in doing this?
*just got my concept brain on atm*

 
Magento Community Magento Community
Magento Community
Magento Community
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 

Hiya Moshe,

Well i take it all back. I deployed as you said at the .phtml level, which took all of 3 minutes work.

Spot on!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top