All Questions
205 questions
3
votes
1
answer
634
views
How can I hide the errors session messages of my module?
In Magento 2, it shows an error which is really annoying for customers. How can we hide or remove showing those errors in the page?
Currently, the application is in the production mode. But still, ...
2
votes
2
answers
1k
views
How to get customer session on category pages in Magento 2
Customer details are available only on customer page and checkout page. It must be a duplicate task but can someone tell how can we retrieve customer session on category pages.
$context = $om->...
1
vote
1
answer
2k
views
Uncaught Exception: Warning: SessionHandler::open(): Cannot call session save handler in a recursive manner
I move my magento project from localhost to shared server. Now since mod_version was not installed and the hosting provider said that enabling the module was not covered of the plan. So I followed the ...
1
vote
0
answers
494
views
Delete Session Files and Prevent Returning
I've already attempted to delete session files, but they come back one at a time and slowly... Huh? Can someone explain why please and help me permanently delete them please?
I can not locate them in ...
2
votes
0
answers
360
views
Strange behavior with the redirects in Store views, Cms pages, Cookies
Config :
Front : I have Two store views 1:simple, 2:pro.
Admin : 1Website->1StoreGroup->2Storeviews: simple and pro
Cms Pages : I created different Cms pages, let's taking for example : 2 (A,B) ...
1
vote
1
answer
4k
views
mage-cache-storage clean after reload page magento 2.1 checkout
I input some information at the checkout. It write in mage-cache-storage. When I reload checkout page mage-cache-storage are clearing. Why is this happening? How I can fix it?
Thanks in advance.
I ...
1
vote
0
answers
122
views
Global Page Success / Warning / Error Messages not showing in Admin
None of the global page messages are appearing on any page in the admin panel. This includes and is not limited to my own custom messages, saving a product, canceling an order and clearing the cache.
...
0
votes
2
answers
5k
views
Magento2 Check if Customer is logged in - Not working
I have taken the reference from this link
Created the variable protected $_customerSession;
Done the injection \Magento\Customer\Model\Session $customerSession,
But in my Function in my block class ...
1
vote
1
answer
4k
views
how to set no-cache HTTP headers in controller in magento 2
I have read in Magento 2 Dev Docs for Public content we can set no-cache HTTP headers for Controllers that don’t use layouts(last line in page).
Controllers that don’t use layouts should set no-...
0
votes
1
answer
716
views
How to get adminhtml session data from the storefront?
I have been trying to get adminhtml session by DI Magento\Backend\Model\Session but I get nothing.
Is it possible to get adminhtml session information from the storefront and vice versa?
0
votes
1
answer
810
views
How to override cookie lifetime for a controller in Magento 2
I have searched this on google but did not find any thing helpful.
When a user does login using my custom login page then the SID should be generated such that its lifetime is say 20 years no matter ...
4
votes
1
answer
1k
views
Magento 2 : Lifetime, scope and general usage for all types of sessions
There are a lot of session types in magento 2 . The ones I know of are listed below ;
1) \Magento\Catalog\Model\Session //vendor/magento/module-catalog/Model/Session.php
2) \Magento\Newsletter\...
3
votes
1
answer
2k
views
Cannot get customer session in Controller
I am just trying to get the customer session in my custom controller class and it always returns NULL.
What is wrong with Magento? It doesn't work as expected, I am spending days not minutes for a ...
0
votes
1
answer
165
views
Magento 2 Admin Menu Fatal Error-session time out
magento 2 admin grid session time out after getting error
Fatal error: Uncaught Error: Call to a member function getId() on null in D:\Projects\xampp\htdocs\m2\vendor\magento\module-backend\Block\...
2
votes
1
answer
2k
views
How to restart session once destroyed in Magento 2?
In one of my controller file I have destroyed customer session (Instance of Magento\Customer\Model\Session)and started it again due to some specific requirement.
public function execute()
{
$...
1
vote
1
answer
2k
views
How to destroy custom session value after X minutes in Magento 2?
As I know there isn't a core/session in Magento 2 [source], I've created a custom session using customer/session as given below:
public function __construct(
\Magento\Customer\Model\Session $...
2
votes
2
answers
7k
views
How to get customer session id in magento 2?
I want to get the session-trail in a custom module. Without the session-related code, it is working fine, but it breaks the module when I add it
namespace Scaledesk\Trails\Block;
use \Magento\...
1
vote
1
answer
2k
views
How to resolve login fail 'Your currnt session has been expired.' into admin pape in Magento 2?
Using Magento CE 2.2.0 with sample data. this error happen when i change time zone in 'bootstrap.php', i try to change it back in it still error.
0
votes
2
answers
3k
views
Add a link to the header links only if a customer is signed in
When a customer is logged in, I'd like to add a custom link to Magento's header links, like below:
So far, I've been able to add the link by adding the below to the default.xml file from my theme, ...
1
vote
1
answer
3k
views
Magento 2.2.2 Unable to clear session lock record in /var/www/magento/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
Environment:
Magento 2.2.2
Memcached:1.4.35
Overnight I find myself unable to access the admin area of my Magento installation. No changes were made to the environment. No changes to env.php.
...
1
vote
1
answer
1k
views
How to use session and pass some value to phtml file to phtml file?
I want to pass some value in phtml file to another phtml file somewhere else
as an example 1.phtml file like below
<?php
$inputMessage = 'Hello World';
Mage::getSingleton('core/session')->...
0
votes
1
answer
213
views
How to create a url to start session in magento 2 (customer)
The URL should be something like this:
http://mymagento.store/customer/1dsd24343sd34
Pasting this url in any browser the customer should log in automatically
0
votes
0
answers
339
views
\Magento\Backend\Model\Session already exists in context object magento 2 [duplicate]
WARNING :Session object MUST NOT be requested in constructor.It can only be passed as a method argument how to use please advance help
\Magento\Backend\Model\Session magento 2
<?php
namespace ...
7
votes
3
answers
5k
views
Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php script
I have custom php script that is called with ajax. It must be stand-alone script to save spent resources because it is called 1-3 times per each page load. Init Magento for each ajax call would cause ...
6
votes
2
answers
6k
views
Magento 2 + Customer logged out automatically in checkout process
I have a strange issue on one of the site. When I log in or register as a new customer and adding few items in shopping cart. Then go to the checkout page it is automatically logged out the customer ...
0
votes
1
answer
72
views
Log out whenever styles are changed
Whenever I change less files in my current theme I get logged out from the backend.
I'm using server-side compilation
I'm using grunt with livereload.
I'm in developer mode.
Both of them seem to ...
0
votes
1
answer
3k
views
Magento 2 language changes not working properly, Only works for first time when i switch
Languages not switching properly. Only works when language parameter www.website.com/?___store=german exits into the url but when i click on the other pages then usually parameter will be removed from ...
6
votes
0
answers
806
views
Magento 2 The session id is too long
I am running Magento 2.2 on php7.1 and getting the following errors in my var/report and on my error log:
> {"0":"Warning: SessionHandler::read(): The session id is too long or contains ...
1
vote
1
answer
2k
views
Set only last added product in the quote
In my website i have bounded the user to only add one product into the cart , however from the session quote object it loads multiple products. How can i restrict quote object to show only last added ...
5
votes
3
answers
5k
views
Magento 2.2.2: Customer session not working with cache enable
I tried this code but when cache is disable. it works, but when I enable cache it does not work.
$ObjectManager = \Magento\Framework\App\ObjectManager::getInstance();
$session = $ObjectManager->...
1
vote
1
answer
941
views
Magento 2 where session data is stored (see example)
I'm trying to figure out how magento is hiding quote ids on client side
I've checked quote mask ids table, but this id is not there, so leaves me to guess its in session data "jQuery.localStorage.get('...
1
vote
0
answers
771
views
Magento2: How to set new session and clear session in login and logout
I want to add new session when user logged in also unset this session when user logged out.
When user logged in
set $this->customerSession->setRegisterEventId('1');
after user logged out
Unset ...
1
vote
1
answer
3k
views
Magento 2: How to set multiple session value in an array?
I know how to set and get session value in magento 2. Here is what I do:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$mysession = $objectManager->create('Magento\Customer\...
0
votes
1
answer
2k
views
Class 'Memcached' not found when trying to configure sessions in Memcached
I'm getting the below error when I run the following PHP:
$mem = new Memcached();
$mem->addServer("127.0.0.1", 11211);
$result = $mem->get("blah");
if ($result) {
echo $result;
} else {
...
3
votes
1
answer
365
views
Can't access session into admin phtml file on Magento 2
I tried to set a session from a model file and access this on a phtml file like this and it's not working:
namespace/vendor/Model/ProcessModel.php:
protected $backendSession;
public ...
0
votes
1
answer
1k
views
Magento2 - How to hide price until login by using custom block about customer session?
I'm trying to hide prices until the customer logs in to our website.
To meet this goal, I'm willing to use customer sessions and if session is true, my product detail page shows the price. Or not, ...
2
votes
0
answers
260
views
Magento 2: Session Information
Magento 2 has multiple session types. I know that each type gives you access to different information ie current customer information.
The sessions I know of are:
\Magento\Backend\Model\Session
\...
2
votes
3
answers
2k
views
Magento 2: Get Admin session in frontend
How can i get the admin session in frontend.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$adminSession = $objectManager->create('Magento\Security\Model\...
4
votes
1
answer
4k
views
Suddenly started using another logged in user's session - Magento 2
This might be too broad of a question but it is a gigantic security issue and I have no idea where to start debugging this.
I was testing some features on my dev server while someone else was logged ...
3
votes
2
answers
14k
views
How to clear sessions of all users in Magento 2
In magento 1 I used to clear session deleting var/session dir.
But how to make it in Magento 2?
env.php fragment:
'session' =>
array (
'save' => 'files',
)
Any help will be ...
2
votes
1
answer
8k
views
Magento 2 Get Session ID and make cart accessible from anywhere
I need to make the cart page accessible to an external user?
In Magento 1 I had this in my Controller:
class Sostanza_Livehelp_IndexController extends Mage_Core_Controller_Front_Action {
...
1
vote
3
answers
4k
views
Customer session for logged in customer by token based authentication
We are using token based authentication over rest api from that resource
/rest/V1/integration/customer/token?username=USER_NAME&password=P@$$WORD
to consume magento rest api web services.
We ...
1
vote
2
answers
806
views
Set and Get magento2 session with custom value
I am working on custom module for catalog session.I have set the custom value with key in catalog session.If i get from another page with that session then the value is not coming.(its working fine in ...
1
vote
1
answer
1k
views
delete session files older than one day, not working
I would like to clean session files older than one day.
I clean with cron with this
find /path/to/magento/var/session/ -mtime +1 -exec rm {} \;
and my cron setting is to run once a day, so
0 0 * * ...
2
votes
2
answers
1k
views
Magento 2 - Session based authentication doesn't work
I don't know if this is a bug in Magento 2 API or not, so I didn't post it on Magento 2 Github issues.
According to this link: http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-...
0
votes
1
answer
3k
views
Magento 2 : set value in session from js file
I want to save string from js file in session because i want to use that value in controller. How to save value in session from js file.
I want to save one string which size is 200kb. so i want to ...
0
votes
1
answer
44
views
How to extend Configurable Class with session data
I'm trying to extend the class \Magento\Swatches\Block\Product\Renderer\Configurable to access session data.
So I did this as proposed on so many stacks and tutorials.
class ExtendConfigurable ...
0
votes
1
answer
893
views
Magento 2: Mini cart product count not updating for current session
I'm using a live chatbox API which is integrated into Magento 2.
The problem is:
When I add a product from the live chat box, the product counter is not getting updated in the Magento's mini cart. (...
0
votes
1
answer
55
views
Programatically retrieving administrator
I am trying to create a single sign on module for my company within Magento. I've set up a connection to the OAuth guarded server and managed to log in on the authentication server.
What I would like ...
2
votes
1
answer
944
views
Session data not saving through controller
I've got a couple controller that I'm trying to use to save and retrieve a custom piece of session data. It works on my local development environment but doesn't work on my staging environment. Here'...