Daric
Daric

Reputation: 16769

How to add dynamic content block in right side bar of magento

I want to add a block of content in right side bar which will be dynamic based on customer's login status.

For example if the customer is not logged in I have to show create account and login button there in the right side bar.

if the customer is logged in then I have to show other buttons.

How do I go about this?

Upvotes: 0

Views: 1093

Answers (3)

clockworkgeek
clockworkgeek

Reputation: 37700

In your layout XML (which you know how to use) use the layout handles customer_logged_in and customer_logged_out. Inspect the existing customer.xml layout file to see examples.

Upvotes: 3

OSdave
OSdave

Reputation: 8587

The Magento way of knowing if a customer is logged in is: Mage::getSingleton('customer/session')->isLoggedIn().
If you need help on something else, please be more specific.
HTH

Upvotes: 1

flykobe
flykobe

Reputation: 135

First, in php code, you should know the customer's login status, get values from cookie or session, depending on your login method.

Then, you can show different html blocks by the customer's login status, like this:

if($has_login){
   include("login_page.html");
} else {
   include("not_login_page.html");
}

Also, if you want to load these content dynamic, you can use ajax to get these html codes, and adopt to show at right place.

Upvotes: -1

Related Questions