Back to PhocacartCurrency class

Method getCurrencyRelation

public static
getCurrencyRelation
(mixed $currentCurrency, mixed $defaultCurrency)

Method getCurrencyRelation - Source code

public static function getCurrencyRelation($currentCurrency, $defaultCurrency)
{
    $o = '';
    if (isset($currentCurrency['id']) && isset($defaultCurrency['id'])) {
        if ($currentCurrency['id'] == $defaultCurrency['id']) {
            return '';
        }
        if (isset($currentCurrency['exchange_rate']) && isset($defaultCurrency['exchange_rate'])) {
            if ($currentCurrency['exchange_rate'] > 0) {
                $o .= '<div>1 ' . $defaultCurrency['code'] . ' = ' . PhocacartPrice::cleanPrice($currentCurrency['exchange_rate']) . ' ' . $currentCurrency['code'] . '</div>';
            }
            if ($currentCurrency['exchange_rate'] > 0) {
                $o .= '<div>1 ' . $currentCurrency['code'] . ' = ' . PhocacartPrice::cleanPrice(round(1 / $currentCurrency['exchange_rate'], 8)) . ' ' . $defaultCurrency['code'] . '</div>';
            }
            return $o;
        }
    }
    return;
}