本文整理汇总了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));
}
示例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));
}
}
}
示例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));
}
示例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);
}
}