Skip to content

Commit

Permalink
#94738 use HttpContext to obtain customer group id
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwaclawczyk committed Jul 8, 2024
1 parent c89c331 commit 2bf3811
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Block/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Snowdog\Menu\Block;

use Magento\Customer\Model\Session;
use Magento\Framework\App\Cache\Type\Block;
use Magento\Framework\App\Http\Context;
use Magento\Framework\DataObject;
use Magento\Framework\View\Element\Template;
use Magento\Framework\Event\Manager as EventManager;
Expand Down Expand Up @@ -80,9 +80,9 @@ class Menu extends Template implements DataObject\IdentityInterface
private $escaper;

/**
* @var Session
* @var Context
*/
private $customerSession;
private $httpContext;

/**
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
Expand All @@ -96,7 +96,7 @@ public function __construct(
TemplateResolver $templateResolver,
ImageFile $imageFile,
Escaper $escaper,
Session $customerSession,
Context $httpContext,
array $data = []
) {
parent::__construct($context, $data);
Expand All @@ -109,7 +109,7 @@ public function __construct(
$this->escaper = $escaper;
$this->setTemplate($this->getMenuTemplate($this->_template));
$this->submenuTemplate = $this->getSubmenuTemplate();
$this->customerSession = $customerSession;
$this->httpContext = $httpContext;
}

/**
Expand Down Expand Up @@ -511,6 +511,6 @@ private function getSubmenuTemplate()

public function getCustomerGroupId()
{
return $this->customerSession->getCustomerGroupId();
return $this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP);
}
}

0 comments on commit 2bf3811

Please sign in to comment.