Back to PhocacartPrice class

Method getCurrencyAndRateByOrder

public static
getCurrencyAndRateByOrder
(mixed $orderId = 0)

Method getCurrencyAndRateByOrder - Source code

// STATIC PART
/*
 * Used for example by orders - we don't want to have current exchange rate
 * but rate which was actual in date of order
 */
public static function getCurrencyAndRateByOrder($orderId = 0)
{
    if ((int) $orderId > 0) {
        $db = Factory::getDBO();
        $query = ' SELECT a.currency_id, a.currency_exchange_rate FROM #__phocacart_orders AS a' . ' WHERE a.id = ' . (int) $orderId . ' ORDER BY a.id';
        $db->setQuery($query);
        $currencyOrder = $db->loadObject();
        if (!empty($currencyOrder)) {
            return $currencyOrder;
        }
        return false;
    }
}