You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I include the customer session as a dependency in a plugin for the currency symbol module, it states I'm not logged in, while I am. the isLoggedIn()-method returns false, while getCustomerGroupId() returns the ID of the customer group.
Note that I'm getting this when assigned to a customer group with ID '12'. I don't know if it matters, but I've experienced that code that worked before now doesn't.
Preconditions
Magento 2.1.3
Steps to reproduce
Create a plugin for \Magento\CurrencySymbol\Model\System\Currencysymbol::getCurrencySymbol:
/**
* @var Session
*/
protected $customerSession;
/**
* Currencysymbol constructor.
* @param Session $customerSession
*/
public function __construct(
Session $customerSession
) {
$this->customerSession = $customerSession;
}
/**
* @param \Magento\CurrencySymbol\Model\System\Currencysymbol $subject
* @param $symbol
* @return mixed
*/
public function afterGetCurrencySymbol(\Magento\CurrencySymbol\Model\System\Currencysymbol $subject, $symbol)
{
// will return false:
if ($this->customerSession->isLoggedIn()) {
return 'X';
}
return $symbol;
}
Also check on another spot in the code if the customer is logged in. You'll notice that then isLoggedIn() will return the proper value.
I've looked at the isLoggedIn()-method, and noticed that it looks at getCustomerId(). The weird part is that in my plugin getCustomerId() will return NULL, but getCustomerGroupId() will return the correct group ID.
The text was updated successfully, but these errors were encountered:
Hm, I'm currently experiencing the same effect in a piece of code that used to work before. Perhaps an interesting side-detail: my customer is logged in under customer group with ID '12'. I'll update the original ticket.
@kanduvisla thank you for your submission.
Is there any update on this issue?
Can it be closed now or should it be treated as an issue? If so please add expected result and actual result sections to the description.
When I include the customer session as a dependency in a plugin for the currency symbol module, it states I'm not logged in, while I am. the
isLoggedIn()
-method returns false, whilegetCustomerGroupId()
returns the ID of the customer group.Note that I'm getting this when assigned to a customer group with ID '12'. I don't know if it matters, but I've experienced that code that worked before now doesn't.
Preconditions
Steps to reproduce
Create a plugin for
\Magento\CurrencySymbol\Model\System\Currencysymbol::getCurrencySymbol
:di.xml
:Currencysymbol.php
:Also check on another spot in the code if the customer is logged in. You'll notice that then
isLoggedIn()
will return the proper value.I've looked at the
isLoggedIn()
-method, and noticed that it looks atgetCustomerId()
. The weird part is that in my plugingetCustomerId()
will returnNULL
, butgetCustomerGroupId()
will return the correct group ID.The text was updated successfully, but these errors were encountered: