当前位置: 首页>>代码示例>>PHP>>正文


PHP Session::setCustomerData方法代码示例

本文整理汇总了PHP中Magento\Backend\Model\Session::setCustomerData方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::setCustomerData方法的具体用法?PHP Session::setCustomerData怎么用?PHP Session::setCustomerData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Backend\Model\Session的用法示例。


在下文中一共展示了Session::setCustomerData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testToHtmlEmptyGlobalShareAndSessionData

 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  * @magentoDataFixture Magento/Core/_files/second_third_store.php
  * @magentoConfigFixture current_store customer/account_share/scope 0
  */
 public function testToHtmlEmptyGlobalShareAndSessionData()
 {
     $this->registry->register(RegistryConstants::CURRENT_CUSTOMER_ID, 1);
     $customer = $this->customerAccountService->getCustomer(1);
     $this->backendSession->setCustomerData(array('account' => $customer->__toArray()));
     $block = $this->layout->createBlock('Magento\\Customer\\Block\\Adminhtml\\Edit\\Tab\\View\\Accordion');
     $html = $block->toHtml();
     $this->assertContains('Wishlist - 0 item(s)', $html);
     $this->assertContains('Shopping Cart of Main Website - 0 item(s)', $html);
     $this->assertContains('Shopping Cart of Second Website - 0 item(s)', $html);
     $this->assertContains('Shopping Cart of Third Website - 0 item(s)', $html);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:AccordionTest.php

示例2: testNewCustomer

 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  */
 public function testNewCustomer()
 {
     $customerBuilder = $this->objectManager->get('\\Magento\\Customer\\Service\\V1\\Data\\CustomerBuilder');
     $this->backendSession->setCustomerData(array('customer_id' => 0, 'account' => $customerBuilder->create()->__toArray()));
     $result = $this->accountBlock->initForm()->toHtml();
     // Contains send email controls
     $this->assertContains('<input id="_accountsendemail"', $result);
     $this->assertContains('<select id="_accountsendemail_store_id"', $result);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:AccountTest.php

示例3: testNewCustomer

 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  */
 public function testNewCustomer()
 {
     /** @var \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerFactory */
     $customerFactory = $this->objectManager->get('Magento\\Customer\\Api\\Data\\CustomerInterfaceFactory');
     $customerData = $this->dataObjectProcessor->buildOutputDataArray($customerFactory->create(), '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
     $this->backendSession->setCustomerData(['customer_id' => 0, 'account' => $customerData]);
     $result = $this->accountBlock->initForm()->toHtml();
     // Contains send email controls
     $this->assertContains('<input id="_accountsendemail"', $result);
     $this->assertContains('<select id="_accountsendemail_store_id"', $result);
 }
开发者ID:opexsw,项目名称:magento2,代码行数:14,代码来源:AccountTest.php

示例4: setupExistingCustomerData

 /**
  * Put existing customer data into the backend session
  */
 protected function setupExistingCustomerData()
 {
     /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
     $customer = $this->_customerRepository->getById(1);
     $this->_customerData = ['customer_id' => $customer->getId(), 'account' => $this->customerMapper->toFlatArray($customer)];
     $this->_customerData['account']['id'] = $customer->getId();
     /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */
     $addresses = $customer->getAddresses();
     foreach ($addresses as $addressData) {
         $this->_customerData['address'][$addressData->getId()] = $this->addressMapper->toFlatArray($addressData);
         $this->_customerData['address'][$addressData->getId()]['id'] = $addressData->getId();
     }
     $this->_backendSession->setCustomerData($this->_customerData);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:AddressesTest.php

示例5: setupExistingCustomerData

 /**
  * Put existing customer data into the backend session
  */
 protected function setupExistingCustomerData()
 {
     /** @var Customer $customer */
     $customer = $this->_customerAccountService->getCustomer(1);
     $this->_customerData = array('customer_id' => $customer->getId(), 'account' => \Magento\Framework\Service\ExtensibleDataObjectConverter::toFlatArray($customer));
     $this->_customerData['account']['id'] = $customer->getId();
     /** @var Address[] $addresses */
     $addresses = $this->_addressService->getAddresses(1);
     foreach ($addresses as $addressData) {
         $this->_customerData['address'][$addressData->getId()] = AddressConverter::toFlatArray($addressData);
         $this->_customerData['address'][$addressData->getId()]['id'] = $addressData->getId();
     }
     $this->_backendSession->setCustomerData($this->_customerData);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:AddressesTest.php


注:本文中的Magento\Backend\Model\Session::setCustomerData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。