当前位置: 首页>>代码示例>>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;未经允许,请勿转载。