Contents
- 1 How to get customer ID from session in Magento?
- 2 Why is Magento 2 not getting customer data from block?
- 3 Why is my customersession null when the cache is disabled?
- 4 How often do I get alerts for concurrent sessions?
- 5 How to check session expire for ASP.NET MVC?
- 6 How to get data from session storage in JavaScript?
How to get customer ID from session in Magento?
When You define block which use session You have to disable cache for it. You need to inject \\Magento\\Customer\\Model\\Session $customerSession, class to get customer ID from customer session. protected $_customerSession; public function __construct (
Why is Magento 2 not getting customer data from block?
While we are injecting customer session in block to retrive logged in customer data and we are not getting customer data from block because Magento 2 reset all the customer sessions when FPC is enabled. In this case, Magento 2 ignore this page from caching.
Why is my customersession null when the cache is disabled?
Using the following code it works fine for blocks where cache is disabled. But when there’s a cached block on the page, it’s null. Even if the customer is logged in. It is intended behavior for the customersession to be cleared when caching is active on a page but I need the customer id to show customer specific prices (B2B).
How to get the customer ID of a logged in user?
I need to get the customer id of the user that is logged in. Using the following code it works fine for blocks where cache is disabled. But when there’s a cached block on the page, it’s null. Even if the customer is logged in.
How to configure a session border controller ( SBC )?
This article describes how to configure a Session Border Controller (SBC) and connect it to Phone System Direct Routing. This is step 1 of the following steps to configure Direct Routing: Step 1. Connect your SBC with Phone System and validate the connection (This article) Step 2. Enable users for Direct Routing Step 3. Configure call routing
How often do I get alerts for concurrent sessions?
When you set a value, the alerting system will notify you when the number of concurrent sessions is 90 percent or higher than this value. If you don’t set a value, alerts aren’t generated. However, the monitoring system will report the number of concurrent sessions every 24 hours.
How to check session expire for ASP.NET MVC?
One could actually grant authorization for a period longer than the session, and if the session is missing, rebuild it, as long as they are already authorized. If you find there is something on the session that you’d be loosing that can’t be rebuilt, then perhaps you should move it somewhere else, or additionally persist it somewhere else.
How to get data from session storage in JavaScript?
NOTE2:always check what data are you going to parse, if the record doesnt exist on the storage, it will return null.
How to get customer ID from block class?
If you need only the customer_id then without loading whole object (see method getCustomer method) you can get it by simply using getCustomerId method. As getId method also calls getCustomerId method.