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


PHP Data::formatCurrency方法代碼示例

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


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

示例1: testCurrency

 public function testCurrency()
 {
     $price = 10.0;
     $priceHtml = '<span class="price">$10.00</span>';
     $this->assertEquals($priceHtml, $this->_helper->currency($price));
     $this->assertEquals($priceHtml, $this->_helper->formatCurrency($price));
 }
開發者ID:,項目名稱:,代碼行數:7,代碼來源:

示例2: _prepareLayout

 /**
  * Prepare fees info
  *
  * @return void
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $this->_shouldRenderInfo = true;
     $this->_addInfo(array('label' => $this->_fields->getFieldLabel('currency_code'), 'value' => $this->_recurringPayment->getCurrencyCode()));
     $params = array('init_amount', 'trial_billing_amount', 'billing_amount', 'tax_amount', 'shipping_amount');
     foreach ($params as $key) {
         $value = $this->_recurringPayment->getData($key);
         if ($value) {
             $this->_addInfo(array('label' => $this->_fields->getFieldLabel($key), 'value' => $this->_coreHelper->formatCurrency($value, false), 'is_amount' => true));
         }
     }
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:18,代碼來源:Fees.php

示例3: testFormatCurrency

 public function testFormatCurrency()
 {
     $amount = '120';
     $includeContainer = false;
     $result = '10grn.';
     $this->priceCurrency->expects($this->once())->method('convertAndFormat')->with($amount, $includeContainer)->will($this->returnValue($result));
     $this->assertEquals($result, $this->model->formatCurrency($amount, $includeContainer));
 }
開發者ID:,項目名稱:,代碼行數:8,代碼來源:

示例4: _prepareLayout

 /**
  * Prepare related grid data
  *
  * @return void
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $this->_prepareRelatedOrders(array('increment_id', 'created_at', 'customer_firstname', 'customer_lastname', 'base_grand_total', 'status'));
     $this->_relatedOrders->addFieldToFilter('status', array('in' => $this->_config->getVisibleOnFrontStatuses()));
     $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager')->setCollection($this->_relatedOrders)->setIsOutputRequired(false);
     $this->setChild('pager', $pager);
     $this->setGridColumns(array(new \Magento\Framework\Object(array('index' => 'increment_id', 'title' => __('Order #'), 'is_nobr' => true, 'width' => 1)), new \Magento\Framework\Object(array('index' => 'created_at', 'title' => __('Date'), 'is_nobr' => true, 'width' => 1)), new \Magento\Framework\Object(array('index' => 'customer_name', 'title' => __('Customer Name'))), new \Magento\Framework\Object(array('index' => 'base_grand_total', 'title' => __('Order Total'), 'is_nobr' => true, 'width' => 1, 'is_amount' => true)), new \Magento\Framework\Object(array('index' => 'status', 'title' => __('Order Status'), 'is_nobr' => true, 'width' => 1))));
     $orders = array();
     foreach ($this->_relatedOrders as $order) {
         $orders[] = new \Magento\Framework\Object(array('increment_id' => $order->getIncrementId(), 'created_at' => $this->formatDate($order->getCreatedAt()), 'customer_name' => $order->getCustomerName(), 'base_grand_total' => $this->_coreHelper->formatCurrency($order->getBaseGrandTotal(), false), 'status' => $order->getStatusLabel(), 'increment_id_link_url' => $this->getUrl('sales/order/view/', array('order_id' => $order->getId()))));
     }
     if ($orders) {
         $this->setGridElements($orders);
     }
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:21,代碼來源:Grid.php


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