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


PHP Data::getInfoBlockHtml方法代碼示例

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


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

示例1: testGetInfoBlockHtml

 public function testGetInfoBlockHtml()
 {
     list($storeId, $blockHtml, $secureMode, $blockType) = [1, 'HTML MARKUP', true, 'method_block_type'];
     $methodMock = $this->getMockBuilder('Magento\\Payment\\Model\\MethodInterface')->getMockForAbstractClass();
     $infoMock = $this->getMockBuilder('Magento\\Payment\\Model\\Info')->disableOriginalConstructor()->setMethods([])->getMock();
     $paymentBlockMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\BlockInterface')->disableOriginalConstructor()->setMethods(['setArea', 'setIsSecureMode', 'getMethod', 'setStore', 'toHtml', 'setInfo'])->getMock();
     $this->appEmulation->expects($this->once())->method('startEnvironmentEmulation')->with($storeId);
     $infoMock->expects($this->once())->method('getMethodInstance')->willReturn($methodMock);
     $methodMock->expects($this->once())->method('getInfoBlockType')->willReturn($blockType);
     $this->layoutMock->expects($this->once())->method('createBlock')->with($blockType)->willReturn($paymentBlockMock);
     $paymentBlockMock->expects($this->once())->method('setInfo')->with($infoMock);
     $paymentBlockMock->expects($this->once())->method('setArea')->with(\Magento\Framework\App\Area::AREA_FRONTEND)->willReturnSelf();
     $paymentBlockMock->expects($this->once())->method('setIsSecureMode')->with($secureMode);
     $paymentBlockMock->expects($this->once())->method('getMethod')->willReturn($methodMock);
     $methodMock->expects($this->once())->method('setStore')->with($storeId);
     $paymentBlockMock->expects($this->once())->method('toHtml')->willReturn($blockHtml);
     $this->appEmulation->expects($this->once())->method('stopEnvironmentEmulation');
     $this->assertEquals($blockHtml, $this->helper->getInfoBlockHtml($infoMock, $storeId));
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:19,代碼來源:DataTest.php

示例2: getPaymentHtml

 /**
  * Get payment info block as html
  *
  * @param Order $order
  * @return string
  */
 protected function getPaymentHtml(Order $order)
 {
     return $this->paymentHelper->getInfoBlockHtml($order->getPayment(), $this->identityContainer->getStore()->getStoreId());
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:10,代碼來源:OrderSender.php

示例3: sendNewOrderEmail

 /**
  * Send email with order data
  *
  * @return $this
  */
 public function sendNewOrderEmail()
 {
     $storeId = $this->getStore()->getId();
     if (!$this->_salesData->canSendNewOrderEmail($storeId)) {
         return $this;
     }
     // Get the destination email addresses to send copies to
     $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
     $copyMethod = $this->_scopeConfig->getValue(self::XML_PATH_EMAIL_COPY_METHOD, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
     $paymentBlockHtml = $this->_paymentData->getInfoBlockHtml($this->getPayment(), $storeId);
     // Retrieve corresponding email template id and customer name
     if ($this->getCustomerIsGuest()) {
         $templateId = $this->_scopeConfig->getValue(self::XML_PATH_EMAIL_GUEST_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
         $customerName = $this->getBillingAddress()->getName();
     } else {
         $templateId = $this->_scopeConfig->getValue(self::XML_PATH_EMAIL_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
         $customerName = $this->getCustomerName();
     }
     $this->_transportBuilder->setTemplateIdentifier($templateId)->setTemplateOptions(array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId))->setTemplateVars(array('order' => $this, 'billing' => $this->getBillingAddress(), 'payment_html' => $paymentBlockHtml, 'store' => $this->getStore()))->setFrom($this->_scopeConfig->getValue(self::XML_PATH_EMAIL_IDENTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId))->addTo($this->getCustomerEmail(), $customerName);
     if ($copyTo && $copyMethod == 'bcc') {
         // Add bcc to customer email
         foreach ($copyTo as $email) {
             $this->_transportBuilder->addBcc($email);
         }
     }
     /** @var \Magento\Framework\Mail\TransportInterface $transport */
     $transport = $this->_transportBuilder->getTransport();
     $transport->sendMessage();
     // Email copies are sent as separated emails if their copy method is 'copy'
     if ($copyTo && $copyMethod == 'copy') {
         foreach ($copyTo as $email) {
             $this->_transportBuilder->setTemplateIdentifier($templateId)->setTemplateOptions(array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId))->setTemplateVars(array('order' => $this, 'billing' => $this->getBillingAddress(), 'payment_html' => $paymentBlockHtml, 'store' => $this->getStore()))->setFrom($this->_scopeConfig->getValue(self::XML_PATH_EMAIL_IDENTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId))->addTo($email)->getTransport()->sendMessage();
         }
     }
     $this->setEmailSent(true);
     $this->_getResource()->saveAttribute($this, 'email_sent');
     return $this;
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:43,代碼來源:Order.php


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