本文整理匯總了PHP中CCurrencyLang::currencyFormat方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCurrencyLang::currencyFormat方法的具體用法?PHP CCurrencyLang::currencyFormat怎麽用?PHP CCurrencyLang::currencyFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CCurrencyLang
的用法示例。
在下文中一共展示了CCurrencyLang::currencyFormat方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadFromDatabase
/**
* Loads values from database.
* Returns true on success.
*
* @return boolean
*/
protected function loadFromDatabase()
{
if (!isset($this->fields)) {
$pricesList = \CPrice::getListEx(array(), array("=PRODUCT_ID" => $this->id, "+<=QUANTITY_FROM" => 1, "+>=QUANTITY_TO" => 1), false, false, array("PRICE", "CURRENCY", "CATALOG_GROUP_ID", "CATALOG_GROUP_CODE"));
$this->fields = array();
while ($priceInfo = $pricesList->fetch()) {
$priceId = $priceInfo["CATALOG_GROUP_ID"];
$price = \CCurrencyLang::currencyFormat($priceInfo["PRICE"], $priceInfo["CURRENCY"], true);
$this->addField($priceId, $priceId, $price);
$this->addField($priceInfo["CATALOG_GROUP_CODE"], $priceId, $price);
}
}
return is_array($this->fields);
}
示例2: getTotalHtml
public function getTotalHtml($needRecalculate = true)
{
$currency = $this->order->getCurrency();
$basket = $this->order->getBasket();
$totalPrices = OrderEdit::getTotalPrices($this->order, $this, $needRecalculate);
if ($basket) {
$weight = $basket->getWeight();
} else {
$weight = 0;
}
return '
<div class="adm-s-result-container-itog">
<table class="adm-s-result-container-itog-table">
<tr>
<tr>
<td>' . Loc::getMessage("SALE_ORDER_BASKET_PRICE") . '</td>
<td id="' . $this->idPrefix . 'sale_order_edit_basket_price_basket">' . \CCurrencyLang::currencyFormat(floatval($totalPrices["PRICE_BASKET"]), $currency, true) . '</td>
</tr>
<tr>
<td>' . Loc::getMessage("SALE_ORDER_BASKET_PRICE_DISCOUNT") . '</td>
<td id="' . $this->idPrefix . 'sale_order_edit_basket_price_discount">' . \CCurrencyLang::currencyFormat(floatval($totalPrices["PRICE_BASKET_DISCOUNTED"]), $currency, true) . '</td>
</tr>
<tr>
<td>' . Loc::getMessage("SALE_ORDER_BASKET_PRICE_DELIVERY") . '</td>
<td id="' . $this->idPrefix . 'sale_order_edit_basket_price_delivery">' . \CCurrencyLang::currencyFormat(floatval($totalPrices["PRICE_DELIVERY"]), $currency, true) . '</td>
</tr>
<tr>
<td>' . Loc::getMessage("SALE_ORDER_BASKET_PRICE_DELIVERY_DISCOUNT") . '</td>
<td id="' . $this->idPrefix . 'sale_order_edit_basket_price_delivery_discount">' . \CCurrencyLang::currencyFormat(floatval($totalPrices["PRICE_DELIVERY_DISCOUNTED"]), $currency, true) . '</td>
</tr>
<tr>
<td>' . Loc::getMessage("SALE_ORDER_BASKET_TAX") . '</td>
<td id="' . $this->idPrefix . 'sale_order_edit_basket_tax">' . \CCurrencyLang::currencyFormat(floatval($totalPrices["TAX_VALUE"]), $currency, true) . '</td>
</tr>
<tr>
<td>' . Loc::getMessage("SALE_ORDER_BASKET_WEIGHT") . '</td>
<td id="' . $this->idPrefix . 'sale_order_edit_basket_weight">' . roundEx(floatval($weight / $this->weightKoef), SALE_WEIGHT_PRECISION) . " " . $this->weightUnit . '</td>
</tr>
<tr>
<td>' . Loc::getMessage("SALE_ORDER_BASKET_PAID") . '</td>
<td id="' . $this->idPrefix . 'sale_order_edit_summ_paid">' . \CCurrencyLang::currencyFormat(floatval($totalPrices["SUM_PAID"]), $currency, true) . '</td>
</tr>
<tr class="adm-s-result-container-itog-table-result">
<td>' . Loc::getMessage("SALE_ORDER_BASKET_PRICE_TOTAL") . '</td>
<td id="' . $this->idPrefix . 'sale_order_edit_basket_price_total">' . \CCurrencyLang::currencyFormat(floatval($totalPrices["SUM_UNPAID"]), $currency, true) . '</td>
</tr>
</tr>
</table>
</div>
';
}
示例3: formatDiscountDescription
/**
* Format discount description.
*
* @param array $data Discount description.
* @return Result
*/
public static function formatDiscountDescription($data)
{
$result = new Result();
$process = true;
if (empty($data) || !is_array($data) || empty($data['TYPE'])) {
$process = true;
$result->addError(new Main\Entity\EntityError(Loc::getMessage('SALE_ORDER_DISCOUNT_DESCR_ERR_FORMAT_DESCR_BAD'), self::ERROR_ID));
}
$resultData = array('DESCRIPTION' => '');
if ($process) {
switch ($data['TYPE']) {
case self::DESCR_TYPE_SIMPLE:
$resultData['DESCRIPTION'] = $data['DESCR'];
break;
case self::DESCR_TYPE_VALUE:
if ($data['VALUE_TYPE'] == self::DESCR_VALUE_TYPE_PERCENT) {
$value = $data['VALUE'] . '%';
if (isset($data['RESULT_VALUE']) && isset($data['RESULT_UNIT'])) {
$value .= ' (' . \CCurrencyLang::currencyFormat($data['RESULT_VALUE'], $data['RESULT_UNIT'], true) . ')';
}
} else {
if ($data['VALUE_TYPE'] == self::DESCR_VALUE_TYPE_CURRENCY) {
$value = \CCurrencyLang::currencyFormat($data['VALUE'], $data['VALUE_UNIT'], true);
} else {
$subMessageID = $data['VALUE_TYPE'] == self::DESCR_VALUE_TYPE_SUMM ? 'SALE_ORDER_DISCOUNT_DESCR_MESS_SUMM_FORMAT' : 'SALE_ORDER_DISCOUNT_DESCR_MESS_SUMM_BASKET_FORMAT';
$value = Loc::getMessage($subMessageID, array('#VALUE#' => \CCurrencyLang::currencyFormat($data['VALUE'], $data['VALUE_UNIT'], true)));
unset($subMessageID);
}
if (isset($data['RESULT_VALUE']) && isset($data['RESULT_UNIT']) && $data['VALUE_UNIT'] != $data['RESULT_UNIT']) {
$value .= ' (' . \CCurrencyLang::currencyFormat($data['RESULT_VALUE'], $data['RESULT_UNIT'], true) . ')';
}
}
$messageId = 'SALE_ORDER_DISCOUNT_DESCR_MESS_TYPE_DISCOUNT';
if (isset($data['VALUE_ACTION'])) {
switch ($data['VALUE_ACTION']) {
case self::DESCR_VALUE_ACTION_EXTRA:
$messageId = 'SALE_ORDER_DISCOUNT_DESCR_MESS_TYPE_EXTRA';
break;
case self::DESCR_VALUE_ACTION_ACCUMULATE:
$messageId = 'SALE_ORDER_DISCOUNT_DESCR_MESS_TYPE_ACCUMULATE';
break;
}
}
$resultData['DESCRIPTION'] = Loc::getMessage($messageId, array('#VALUE#' => $value));
unset($value, $messageId);
break;
case self::DESCR_TYPE_LIMIT_VALUE:
$messageId = isset($data['LIMIT_TYPE']) && $data['LIMIT_TYPE'] == self::DESCR_LIMIT_MIN ? 'SALE_ORDER_DISCOUNT_DESCR_MESS_LIMIT_MIN_FORMAT' : 'SALE_ORDER_DISCOUNT_DESCR_MESS_LIMIT_MAX_FORMAT';
$value = Loc::getMessage($messageId, array('#PERCENT#' => $data['VALUE'] . '%', '#LIMIT#' => \CCurrencyLang::currencyFormat($data['LIMIT_VALUE'], $data['LIMIT_UNIT'], true)));
if (isset($data['RESULT_VALUE']) && isset($data['RESULT_UNIT'])) {
$value .= ' (' . \CCurrencyLang::currencyFormat($data['RESULT_VALUE'], $data['RESULT_UNIT'], true) . ')';
}
$messageId = isset($data['VALUE_ACTION']) && $data['VALUE_ACTION'] == self::DESCR_VALUE_ACTION_EXTRA ? 'SALE_ORDER_DISCOUNT_DESCR_MESS_TYPE_EXTRA' : 'SALE_ORDER_DISCOUNT_DESCR_MESS_TYPE_DISCOUNT';
$resultData['DESCRIPTION'] = Loc::getMessage($messageId, array('#VALUE#' => $value));
unset($value, $messageId);
break;
case self::DESCR_TYPE_FIXED:
$resultData['DESCRIPTION'] = Loc::getMessage('SALE_ORDER_DISCOUNT_DESCR_MESS_FIXED_FORMAT', array('#VALUE#' => \CCurrencyLang::currencyFormat($data['VALUE'], $data['VALUE_UNIT'], true)));
break;
case self::DESCR_TYPE_MAX_BOUND:
$value = \CCurrencyLang::currencyFormat($data['VALUE'], $data['VALUE_UNIT'], true);
if (isset($data['RESULT_VALUE']) && isset($data['RESULT_UNIT'])) {
$value .= ' (' . \CCurrencyLang::currencyFormat($data['RESULT_VALUE'], $data['RESULT_UNIT'], true) . ')';
} else {
$value .= ' (' . $value . ')';
}
$resultData['DESCRIPTION'] = Loc::getMessage('SALE_ORDER_DISCOUNT_DESCR_MESS_MAX_BOUND_FORMAT', array('#VALUE#' => $value));
unset($value);
break;
default:
break;
}
}
if ($process) {
$result->setData($resultData);
}
return $result;
}