當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CurrentCustomer::getCustomer方法代碼示例

本文整理匯總了PHP中Magento\Customer\Helper\Session\CurrentCustomer::getCustomer方法的典型用法代碼示例。如果您正苦於以下問題:PHP CurrentCustomer::getCustomer方法的具體用法?PHP CurrentCustomer::getCustomer怎麽用?PHP CurrentCustomer::getCustomer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Customer\Helper\Session\CurrentCustomer的用法示例。


在下文中一共展示了CurrentCustomer::getCustomer方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getCustomer

 /**
  * Returns the Magento Customer Model for this block
  *
  * @return \Magento\Customer\Api\Data\CustomerInterface|null
  */
 public function getCustomer()
 {
     try {
         return $this->currentCustomer->getCustomer();
     } catch (NoSuchEntityException $e) {
         return null;
     }
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:13,代碼來源:Info.php

示例2: getSectionData

 /**
  * {@inheritdoc}
  */
 public function getSectionData()
 {
     if (!$this->currentCustomer->getCustomerId()) {
         return [];
     }
     $customer = $this->currentCustomer->getCustomer();
     return ['fullname' => $this->customerViewHelper->getCustomerName($customer), 'firstname' => $customer->getFirstname()];
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:11,代碼來源:Customer.php

示例3: testGetCustomerLoadCustomerFromService

 /**
  * test get customer method, method returns customer from service
  */
 public function testGetCustomerLoadCustomerFromService()
 {
     $this->moduleManagerMock->expects($this->once())->method('isEnabled')->with($this->equalTo('Magento_PageCache'))->will($this->returnValue(false));
     $this->customerSessionMock->expects($this->once())->method('getId')->will($this->returnValue($this->customerId));
     $this->customerRepositoryMock->expects($this->once())->method('getById')->with($this->equalTo($this->customerId))->will($this->returnValue($this->customerDataMock));
     $this->assertEquals($this->customerDataMock, $this->currentCustomer->getCustomer());
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:10,代碼來源:CurrentCustomerTest.php

示例4: getCustomer

 /**
  * Retrieve the Customer Data using the customer Id from the customer session.
  *
  * @return Customer
  */
 public function getCustomer()
 {
     return $this->currentCustomer->getCustomer();
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:9,代碼來源:Edit.php


注:本文中的Magento\Customer\Helper\Session\CurrentCustomer::getCustomer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。