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


PHP Data::getInfoBlock方法代码示例

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


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

示例1: _prepareLayout

 /**
  * @return void
  */
 protected function _prepareLayout()
 {
     if ($headBlock = $this->getLayout()->getBlock('head')) {
         $headBlock->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId()));
     }
     $this->setChild('payment_info', $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment()));
 }
开发者ID:aiesh,项目名称:magento2,代码行数:10,代码来源:Creditmemo.php

示例2: _prepareLayout

 /**
  * Add payment info block to layout
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     if ($info = $this->getPaymentInfo()) {
         $this->setChild($this->_getInfoBlockName(), $this->_paymentData->getInfoBlock($info, $this->getLayout()));
     }
     return parent::_prepareLayout();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:AbstractContainer.php

示例3: setPayment

 /**
  * Set payment
  *
  * @param Info $payment
  * @return $this
  */
 public function setPayment($payment)
 {
     $paymentInfoBlock = $this->_paymentData->getInfoBlock($payment);
     $this->setChild('info', $paymentInfoBlock);
     $this->setData('payment', $payment);
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:13,代码来源:Payment.php

示例4: testGetInfoBlock

 public function testGetInfoBlock()
 {
     $blockType = 'method_block_type';
     $methodMock = $this->getMockBuilder('Magento\\Payment\\Model\\MethodInterface')->getMockForAbstractClass();
     $infoMock = $this->getMockBuilder('Magento\\Payment\\Model\\Info')->disableOriginalConstructor()->setMethods([])->getMock();
     $blockMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\BlockInterface')->disableOriginalConstructor()->setMethods(['setInfo', 'toHtml'])->getMock();
     $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($blockMock);
     $blockMock->expects($this->once())->method('setInfo')->with($infoMock);
     $this->assertSame($blockMock, $this->helper->getInfoBlock($infoMock));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:DataTest.php

示例5: _prepareLayout

 /**
  * @return void
  */
 protected function _prepareLayout()
 {
     $this->pageConfig->getTitle()->set(__('Order # %1', $this->getOrder()->getRealOrderId()));
     $infoBlock = $this->paymentHelper->getInfoBlock($this->getOrder()->getPayment(), $this->getLayout());
     $this->setChild('payment_info', $infoBlock);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:9,代码来源:Info.php

示例6: insertOrder

 /**
  * Insert order to pdf page
  *
  * @param \Zend_Pdf_Page &$page
  * @param \Magento\Sales\Model\Order $obj
  * @param bool $putOrderId
  * @return void
  */
 protected function insertOrder(&$page, $obj, $putOrderId = true)
 {
     if ($obj instanceof \Magento\Sales\Model\Order) {
         $shipment = null;
         $order = $obj;
     } elseif ($obj instanceof \Magento\Sales\Model\Order\Shipment) {
         $shipment = $obj;
         $order = $shipment->getOrder();
     }
     $this->y = $this->y ? $this->y : 815;
     $top = $this->y;
     $page->setFillColor(new \Zend_Pdf_Color_GrayScale(0.45));
     $page->setLineColor(new \Zend_Pdf_Color_GrayScale(0.45));
     $page->drawRectangle(25, $top, 570, $top - 55);
     $page->setFillColor(new \Zend_Pdf_Color_GrayScale(1));
     $this->setDocHeaderCoordinates(array(25, $top, 570, $top - 55));
     $this->_setFontRegular($page, 10);
     if ($putOrderId) {
         $page->drawText(__('Order # ') . $order->getRealOrderId(), 35, $top -= 30, 'UTF-8');
     }
     $page->drawText(__('Order Date: ') . $this->_localeDate->formatDate($order->getCreatedAtStoreDate(), 'medium', false), 35, $top -= 15, 'UTF-8');
     $top -= 10;
     $page->setFillColor(new \Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
     $page->setLineColor(new \Zend_Pdf_Color_GrayScale(0.5));
     $page->setLineWidth(0.5);
     $page->drawRectangle(25, $top, 275, $top - 25);
     $page->drawRectangle(275, $top, 570, $top - 25);
     /* Calculate blocks info */
     /* Billing Address */
     $billingAddress = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
     /* Payment */
     $paymentInfo = $this->_paymentData->getInfoBlock($order->getPayment())->setIsSecureMode(true)->toPdf();
     $paymentInfo = htmlspecialchars_decode($paymentInfo, ENT_QUOTES);
     $payment = explode('{{pdf_row_separator}}', $paymentInfo);
     foreach ($payment as $key => $value) {
         if (strip_tags(trim($value)) == '') {
             unset($payment[$key]);
         }
     }
     reset($payment);
     /* Shipping Address and Method */
     if (!$order->getIsVirtual()) {
         /* Shipping Address */
         $shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
         $shippingMethod = $order->getShippingDescription();
     }
     $page->setFillColor(new \Zend_Pdf_Color_GrayScale(0));
     $this->_setFontBold($page, 12);
     $page->drawText(__('Sold to:'), 35, $top - 15, 'UTF-8');
     if (!$order->getIsVirtual()) {
         $page->drawText(__('Ship to:'), 285, $top - 15, 'UTF-8');
     } else {
         $page->drawText(__('Payment Method:'), 285, $top - 15, 'UTF-8');
     }
     $addressesHeight = $this->_calcAddressHeight($billingAddress);
     if (isset($shippingAddress)) {
         $addressesHeight = max($addressesHeight, $this->_calcAddressHeight($shippingAddress));
     }
     $page->setFillColor(new \Zend_Pdf_Color_GrayScale(1));
     $page->drawRectangle(25, $top - 25, 570, $top - 33 - $addressesHeight);
     $page->setFillColor(new \Zend_Pdf_Color_GrayScale(0));
     $this->_setFontRegular($page, 10);
     $this->y = $top - 40;
     $addressesStartY = $this->y;
     foreach ($billingAddress as $value) {
         if ($value !== '') {
             $text = array();
             foreach ($this->string->split($value, 45, true, true) as $_value) {
                 $text[] = $_value;
             }
             foreach ($text as $part) {
                 $page->drawText(strip_tags(ltrim($part)), 35, $this->y, 'UTF-8');
                 $this->y -= 15;
             }
         }
     }
     $addressesEndY = $this->y;
     if (!$order->getIsVirtual()) {
         $this->y = $addressesStartY;
         foreach ($shippingAddress as $value) {
             if ($value !== '') {
                 $text = array();
                 foreach ($this->string->split($value, 45, true, true) as $_value) {
                     $text[] = $_value;
                 }
                 foreach ($text as $part) {
                     $page->drawText(strip_tags(ltrim($part)), 285, $this->y, 'UTF-8');
                     $this->y -= 15;
                 }
             }
         }
         $addressesEndY = min($addressesEndY, $this->y);
//.........这里部分代码省略.........
开发者ID:aiesh,项目名称:magento2,代码行数:101,代码来源:AbstractPdf.php


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