Làm thế nào để có được ID khách hàng từ phiên? Tôi đã thử điều này nhưng không hiệu quả.
protected $_customerBonusPointFactory;
protected $_customerSession;
public function __construct(Session $customerSession, \Magento\Framework\View\Element\Template\Context $context) {
    $this->_customerSession = $customerSession;
    parent::__construct($context);
}
public function _prepareLayout() {
    var_dump($this->_customerSession->getCustomer()->getId());
    exit();
    return parent::_prepareLayout();
}
          $this->session->isLoggedIn()trả về true trong lớp trình điều khiển của tôi nhưng trả về false trong lớp khối của tôi. Tại sao?
                cacheable=falsexem Magento 2 - Nhận ID khách hàng từ phiên trong lớp khối
                