开发者

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 th开发者_Go百科en I have to show other buttons.

How do I go about this?


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜