init
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Stemcell\Customer\CustomerData;
|
||||
|
||||
use Magento\Customer\Helper\Session\CurrentCustomer;
|
||||
use Magento\Customer\Helper\View;
|
||||
use Magento\Framework\App\ObjectManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Customer extends \Magento\Customer\CustomerData\Customer
|
||||
{
|
||||
protected View $customerViewHelper;
|
||||
|
||||
/**
|
||||
* @param CurrentCustomer $currentCustomer
|
||||
* @param View $customerViewHelper
|
||||
*/
|
||||
public function __construct(
|
||||
CurrentCustomer $currentCustomer,
|
||||
View $customerViewHelper
|
||||
) {
|
||||
$this->currentCustomer = $currentCustomer;
|
||||
$this->customerViewHelper = $customerViewHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSectionData()
|
||||
{
|
||||
if (!$this->currentCustomer->getCustomerId()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$customer = $this->currentCustomer->getCustomer();
|
||||
return [
|
||||
'fullname' => $this->customerViewHelper->getCustomerName($customer),
|
||||
'firstname' => $customer->getId(),
|
||||
'websiteId' => $customer->getWebsiteId(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user