From 90853d47e77fee5888db267c175ccb83eb66862d Mon Sep 17 00:00:00 2001 From: mMarinetti Date: Wed, 26 Oct 2011 17:41:32 +0000 Subject: [PATCH] [*] FO : $currency->prefix and $currency->suffix are now a convenient shortcut for displaying price git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9661 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Currency.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/classes/Currency.php b/classes/Currency.php index 8cc7f9235..629264d6b 100644 --- a/classes/Currency.php +++ b/classes/Currency.php @@ -73,8 +73,27 @@ class CurrencyCore extends ObjectModel protected $webserviceParameters = array( 'objectsNodeName' => 'currencies', ); + + /** + * contains the sign to display before price, according to its format + * @var string + */ + public $prefix = null; + /** + * contains the sign to display after price, according to its format + * @var string + */ + public $suffix = null; + public function __construct($id = null, $id_lang = null, $id_shop = null) + { + parent::__construct($id, $id_lang, $id_shop); + // prefix and suffix are convenient shortcut for displaying + // price sign before or after the price number + $this->prefix = $this->format % 2 != 0 ? $this->sign.' ' : ''; + $this->suffix = $this->format % 2 == 0 ? ' '.$this->sign : ''; + } /** * Overriding check if currency with the same iso code already exists. * If it's true, currency is doesn't added.