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


PHP CustomerInterface::getStoreId方法代码示例

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


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

示例1: send

 /**
  * Send customer email
  *
  * @return bool
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function send()
 {
     if ($this->_website === null || $this->_customer === null) {
         return false;
     }
     if ($this->_type == 'price' && count($this->_priceProducts) == 0 || $this->_type == 'stock' && count($this->_stockProducts) == 0) {
         return false;
     }
     if (!$this->_website->getDefaultGroup() || !$this->_website->getDefaultGroup()->getDefaultStore()) {
         return false;
     }
     if ($this->_customer->getStoreId() > 0) {
         $store = $this->_storeManager->getStore($this->_customer->getStoreId());
     } else {
         $store = $this->_website->getDefaultStore();
     }
     $storeId = $store->getId();
     if ($this->_type == 'price' && !$this->_scopeConfig->getValue(self::XML_PATH_EMAIL_PRICE_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId)) {
         return false;
     } elseif ($this->_type == 'stock' && !$this->_scopeConfig->getValue(self::XML_PATH_EMAIL_STOCK_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId)) {
         return false;
     }
     if ($this->_type != 'price' && $this->_type != 'stock') {
         return false;
     }
     $this->_appEmulation->startEnvironmentEmulation($storeId);
     if ($this->_type == 'price') {
         $this->_getPriceBlock()->setStore($store)->reset();
         foreach ($this->_priceProducts as $product) {
             $product->setCustomerGroupId($this->_customer->getGroupId());
             $this->_getPriceBlock()->addProduct($product);
         }
         $block = $this->_getPriceBlock();
         $templateId = $this->_scopeConfig->getValue(self::XML_PATH_EMAIL_PRICE_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
     } else {
         $this->_getStockBlock()->setStore($store)->reset();
         foreach ($this->_stockProducts as $product) {
             $product->setCustomerGroupId($this->_customer->getGroupId());
             $this->_getStockBlock()->addProduct($product);
         }
         $block = $this->_getStockBlock();
         $templateId = $this->_scopeConfig->getValue(self::XML_PATH_EMAIL_STOCK_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
     }
     $alertGrid = $this->_appState->emulateAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND, [$block, 'toHtml']);
     $this->_appEmulation->stopEnvironmentEmulation();
     $transport = $this->_transportBuilder->setTemplateIdentifier($templateId)->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId])->setTemplateVars(['customerName' => $this->_customerHelper->getCustomerName($this->_customer), 'alertGrid' => $alertGrid])->setFrom($this->_scopeConfig->getValue(self::XML_PATH_EMAIL_IDENTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId))->addTo($this->_customer->getEmail(), $this->_customerHelper->getCustomerName($this->_customer))->getTransport();
     $transport->sendMessage();
     return true;
 }
开发者ID:nja78,项目名称:magento2,代码行数:57,代码来源:Email.php

示例2: sendPasswordResetNotificationEmail

 /**
  * Send email to customer when his password is reset
  *
  * @param CustomerInterface $customer
  * @return $this
  */
 protected function sendPasswordResetNotificationEmail($customer)
 {
     $storeId = $customer->getStoreId();
     if (!$storeId) {
         $storeId = $this->getWebsiteStoreId($customer);
     }
     $customerEmailData = $this->getFullCustomerObject($customer);
     $this->sendEmailTemplate($customer, self::XML_PATH_RESET_PASSWORD_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY, ['customer' => $customerEmailData, 'store' => $this->storeManager->getStore($storeId)], $storeId);
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:AccountManagement.php

示例3: sendPasswordReminderEmail

 /**
  * Send email with new customer password
  *
  * @param CustomerInterface $customer
  * @param string $newPasswordToken
  * @return $this
  */
 public function sendPasswordReminderEmail($customer, $newPasswordToken)
 {
     $this->url->setScope($customer->getStoreId());
     //TODO : Fix how template is built. Maybe Framework Object or create new Email template data model?
     // Check template to see what values need to be set in the data model to be passed
     // Need to set the reset_password_url property of the object
     $store = $this->storeManager->getStore($customer->getStoreId());
     $resetUrl = $this->url->getUrl('customer/account/createPassword', ['_query' => ['id' => $customer->getId(), 'token' => $newPasswordToken], '_store' => $customer->getStoreId(), '_secure' => $store->isFrontUrlSecure()]);
     $customerEmailData = $this->getFullCustomerObject($customer);
     $customerEmailData->setResetPasswordUrl($resetUrl);
     $this->sendEmailTemplate($customer, self::XML_PATH_REMIND_EMAIL_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY, ['customer' => $customerEmailData, 'store' => $store], $customer->getStoreId());
     return $this;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:20,代码来源:AccountManagement.php

示例4: sendPasswordResetNotificationEmail

 /**
  * Send email to customer when his password is reset
  *
  * @param CustomerInterface $customer
  * @return $this
  */
 protected function sendPasswordResetNotificationEmail($customer)
 {
     $storeId = $customer->getStoreId();
     if (!$storeId) {
         $storeId = $this->getWebsiteStoreId($customer);
     }
     $customerEmailData = $this->getFullCustomerObject($customer);
     /** @var \Magento\Framework\Mail\TransportInterface $transport */
     $transport = $this->transportBuilder->setTemplateIdentifier($this->scopeConfig->getValue(self::XML_PATH_RESET_PASSWORD_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId))->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId])->setTemplateVars(['customer' => $customerEmailData, 'store' => $this->storeManager->getStore($storeId)])->setFrom($this->scopeConfig->getValue(self::XML_PATH_FORGOT_EMAIL_IDENTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId))->addTo($customer->getEmail(), $this->customerViewHelper->getCustomerName($customer))->getTransport();
     $transport->sendMessage();
     return $this;
 }
开发者ID:nja78,项目名称:magento2,代码行数:18,代码来源:AccountManagement.php

示例5: passwordReset

 /**
  * Send email to customer when his password is reset
  *
  * @param CustomerInterface $customer
  * @return void
  */
 private function passwordReset(CustomerInterface $customer)
 {
     $storeId = $customer->getStoreId();
     if (!$storeId) {
         $storeId = $this->getWebsiteStoreId($customer);
     }
     $customerEmailData = $this->getFullCustomerObject($customer);
     $this->sendEmailTemplate($customer, self::XML_PATH_RESET_PASSWORD_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY, ['customer' => $customerEmailData, 'store' => $this->storeManager->getStore($storeId)], $storeId);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:EmailNotification.php


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