Exemplo n.º 1
0
function multicurrency_add_prices($formatted_price)
{
    if (osc_item_price() != NULL && osc_item_price() != '' && osc_item_price() != 0) {
        $rates = ModelMC::newInstance()->getRates(osc_item_currency());
        $data = array();
        foreach ($rates as $r) {
            $price = osc_item_price() / 1000000 * $r['f_rate'];
            $symbol = $r['s_to'];
            $currencyFormat = osc_locale_currency_format();
            $currencyFormat = str_replace('{NUMBER}', number_format($price, osc_locale_num_dec(), osc_locale_dec_point(), osc_locale_thousands_sep()), $currencyFormat);
            $currencyFormat = str_replace('{CURRENCY}', $symbol, $currencyFormat);
            $data[] = $currencyFormat;
        }
        return $formatted_price . ' <a class=MCtooltip href="#">' . __('Other currencies', 'multicurrency') . '<span>' . implode("<br />", $data) . '</span></a>';
    }
    return $formatted_price;
}
Exemplo n.º 2
0
/**
 * Formats the price using the appropiate currency.
 *
 * @param float $price
 * @return string
 */
function osc_format_price($price)
{
    if ($price == null) {
        return osc_apply_filter('item_price_null', __('Check with seller'));
    }
    if ($price == 0) {
        return osc_apply_filter('item_price_zero', __('Free'));
    }
    $price = $price / 1000000;
    $currencyFormat = osc_locale_currency_format();
    $currencyFormat = str_replace('{NUMBER}', number_format($price, osc_locale_num_dec(), osc_locale_dec_point(), osc_locale_thousands_sep()), $currencyFormat);
    $currencyFormat = str_replace('{CURRENCY}', osc_item_currency(), $currencyFormat);
    return osc_apply_filter('item_price', $currencyFormat);
}
Exemplo n.º 3
0
function osc_prepare_price($price)
{
    return number_format($price / 1000000, osc_locale_num_dec(), osc_locale_dec_point(), osc_locale_thousands_sep());
}