/** * Convert a numeric price to the shop currency * @param mixed $price the price to convert * @return Money the price wrapped in a Money DBField to be used for templates or similar */ public static function price_for_display($price) { $currency = ShopConfig::get_site_currency(); $field = Money::create("Price"); $field->setAmount($price); $field->setCurrency($currency); return $field; }
/** * Return the currency of this order. * Note: this is a fixed value across the entire site. * * @return string */ public function Currency() { return ShopConfig::get_site_currency(); }
/** * @return Money */ public function PromoSavings() { $currency = method_exists('ShopConfig', 'get_site_currency') ? ShopConfig::get_site_currency() : Payment::site_currency(); $field = new Money("PromoSavings"); $field->setAmount($this->calculatePromoSavings()); $field->setCurrency($currency); return $field; }