- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2020
09:26 AM
06-13-2020
09:26 AM
How to store value in session in magento 2
Example: I have 2 observer classes.
1- category.php
2- product.php
I want to store the category.php data in a session variable, like $_SESSION['category']= $data; and call that session in product.php class.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2020
10:49 PM
06-14-2020
10:49 PM
Re: How to store value in session in magento 2
Hello @rababfzepcc1fc
Please refer the below URL for the solution:
https://stackoverflow.com/questions/34170544/magento-2-0-set-session-variable
Thank you.
Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.
200+ Magento 2 Extensions for Enhanced Shopping Experience.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2020
06:07 AM
06-15-2020
06:07 AM
Re: How to store value in session in magento 2
when I try to unset the session variable by using
$block->getCatalogSession()->unsProductId();
that unset method unset the overall session and my site stop working.
What I want is: I need to get the session value and insert it into the database after that unset that session value.