In header.phtml file using
Mage::getSingleton('customer/session')->isLoggedIn()
we can check user is logged in or not.
If SSL is active on frontend then above function works fine if accessing page using https request but for all non secure pages using http request it fails.
How we can check user is logged in or not on all pages ie with http and https request in header.phtml?
3 Answers 3
This should work for all page types - my guess is a cached block. Try the following:
- Append
?no_cache=trueto the end of your HTTP-only url - Disable all caches and retry
- Relocate your check to another region - e.g. place it in
page/3columns.phtmlto verify that it is working as expected.
-
I tried all above your suggestions even welcome block suggested by Marius but still not working...Sandesh– Sandesh2013年07月09日 07:28:39 +00:00Commented Jul 9, 2013 at 7:28
-
I am not using any other domain for https. My current settings for secure and unsecure URL are as follows unsecure: domain.com and secure: domain.com will this www secure URL will make any difference?Sandesh– Sandesh2013年07月09日 10:19:09 +00:00Commented Jul 9, 2013 at 10:19
Make sure your session cookies are accessible via both http and https.
You will need to enter in .domain.com in Magentos admin->system->configuration->web->cookie domain. You will need to make the cookie available to your other domains in order for it to be read. This is the same with all web applications.
Reference:
-
I am not using any other domain for https. My current settings for secure and unsecure URL are as follows unsecure:
http://domain.com/and secure:https://www.domain.com/will thiswwwsecure URL will make any difference?Sandesh– Sandesh2013年07月09日 09:35:50 +00:00Commented Jul 9, 2013 at 9:35 -
1Yes, the missing www from http could be the root cause.B00MER– B00MER2013年07月09日 23:45:51 +00:00Commented Jul 9, 2013 at 23:45
I am unsure if you are still in need for the question to be answered, but may be any new visitor may find it answering to concerning issues.
Such issues usually come up with cookie settings sometimes. You can change the settings from
System> Settings> Web> Session Cookie Management
And set the value for 'Use HTTP Only' to No and save, afterward clear cache and test. Hope this helps.
Mage_Page_Block_Html_Header::getWelcome()for confirmation.