VirtueMart  3.2.14.9808
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
CurrencyDisplay Class Reference

Public Member Functions

 setPriceArray ()
 
 getCurrencyForDisplay ($currencyId=0)
 
 priceDisplay ($price, $currencyId=0, $quantity=1.0, $inToShopCurrency=false, $nb=-1)
 
 roundForDisplay ($price, $currencyId=0, $quantity=1.0, $inToShopCurrency=false, $nb=-1)
 
 getFormattedCurrency ($nb, $nbDecimal=-1)
 
 getFormattedNumber ($n, $dec)
 
 createPriceDiv ($name, $description, $product_price, $priceOnly=false, $switchSequel=false, $quantity=1.0, $forceNoLabel=false, $force=false)
 
 convertCurrencyTo ($currency, $price, $shop=true)
 
 ensureUsingCurrencyCode ($curr)
 
 getCurrencyIdByField ($value=0, $fieldName='currency_code_3')
 
 formatNumber ($number, $decimals=2, $decimal_point= '.', $thousand_separator= ' ')
 
 getSymbol ()
 
 getId ()
 

Static Public Member Functions

static getInstance ($currencyId=0, $vendorId=0)
 

Public Attributes

 $_priceConfig = array()
 
 $exchangeRateShopper = 1.0
 
 $_vendorCurrency = 0
 
 $_vendorCurrency_code_3 = 0
 
 $_vendorCurrency_numeric = 0
 

Static Public Attributes

static $_instance = array()
 
static $priceNames
 

Private Member Functions

 __construct ($vendorId=0)
 
 setCurrencyDisplayToStyleStr ($style)
 

Private Attributes

 $_currencyConverter
 
 $_currency_id = '0'
 
 $_symbol = 'udef'
 
 $_nbDecimal = 2
 
 $_decimal = ','
 
 $_thousands = ' '
 
 $_positivePos = '{number}{symbol}'
 
 $_negativePos = '{sign}{number}{symbol}'
 
 $_numeric_code = 0
 

Constructor & Destructor Documentation

CurrencyDisplay::__construct (   $vendorId = 0)
private

Member Function Documentation

CurrencyDisplay::convertCurrencyTo (   $currency,
  $price,
  $shop = true 
)
Author
Max Milbers
Parameters
unknown_type$currency
unknown_type$price
unknown_type$shop
CurrencyDisplay::createPriceDiv (   $name,
  $description,
  $product_price,
  $priceOnly = false,
  $switchSequel = false,
  $quantity = 1.0,
  $forceNoLabel = false,
  $force = false 
)

function to create a div to show the prices, is necessary for JS

Author
Max Milbers
Patrick Kohl
Parameters
stringname of the price
Stringdescription key
arraythe prices of the product return a div for prices which is visible according to config and have all ids and class set
CurrencyDisplay::ensureUsingCurrencyCode (   $curr)

Changes the virtuemart_currency_id into the right currency_code For exampel 47 => EUR

Author
Max Milbers
Frederic Bidon
CurrencyDisplay::formatNumber (   $number,
  $decimals = 2,
  $decimal_point = '.',
  $thousand_separator = ' ' 
)
Author
Horvath, Sandor [HU] http://de.php.net/manual/de/function.number-format.php
Max Milbers
Parameters
double$number
int$decimals
string$thousand_separator
string$decimal_point
CurrencyDisplay::getCurrencyForDisplay (   $currencyId = 0)

getCurrencyForDisplay: get The actual displayed Currency Use this only in a view, plugin or modul, never in a model

Parameters
integer$currencyIdreturn integer $currencyId: displayed Currency
CurrencyDisplay::getCurrencyIdByField (   $value = 0,
  $fieldName = 'currency_code_3' 
)

Changes the currency_code into the right virtuemart_currency_id For exampel 'currency_code_3' : EUR => 47

Author
Max Milbers
Kohl Patrick
CurrencyDisplay::getFormattedCurrency (   $nb,
  $nbDecimal = -1 
)

Format, Round and Display Value

Author
Max Milbers
Parameters
valnumber
CurrencyDisplay::getFormattedNumber (   $n,
  $dec 
)
CurrencyDisplay::getId ( )

Return the currency ID

static CurrencyDisplay::getInstance (   $currencyId = 0,
  $vendorId = 0 
)
static

Gives back the format of the currency, gets $style if none is set, with the currency Id, when nothing is found it tries the vendorId. When no param is set, you get the format of the mainvendor

Author
Max Milbers
Parameters
int$currencyIdId of the currency
int$vendorIdId of the vendor
string$styleThe vendor_currency_display_code FORMAT: 1: id, 2: CurrencySymbol, 3: NumberOfDecimalsAfterDecimalSymbol, 4: DecimalSymbol, 5: Thousands separator 6: Currency symbol position with Positive values : 7: Currency symbol position with Negative values :

EXAMPLE: ||€|2|,||1|8

Returns
string
CurrencyDisplay::getSymbol ( )

Return the currency symbol

CurrencyDisplay::priceDisplay (   $price,
  $currencyId = 0,
  $quantity = 1.0,
  $inToShopCurrency = false,
  $nb = -1 
)

This function is for the gui only! Use this only in a view, plugin or modul, never in a model TODO for vm3 remove quantity option

Parameters
float$price
integer$currencyIdreturn string formatted price
CurrencyDisplay::roundForDisplay (   $price,
  $currencyId = 0,
  $quantity = 1.0,
  $inToShopCurrency = false,
  $nb = -1 
)
CurrencyDisplay::setCurrencyDisplayToStyleStr (   $style)
private

Parse the given currency display string into the currency diplsy values.

This function takes the currency style string as saved in the vendor record and parses it into its appropriate values. An example style string would be 1|€|2|,|.|0|0

Author
Max Milbers
Parameters
String$currencyStyleString containing the currency display settings
CurrencyDisplay::setPriceArray ( )

This function sets an array, which holds the information if a price is to be shown and the number of rounding digits

Author
Max Milbers

Member Data Documentation

CurrencyDisplay::$_currency_id = '0'
private
CurrencyDisplay::$_currencyConverter
private
CurrencyDisplay::$_decimal = ','
private
CurrencyDisplay::$_instance = array()
static
CurrencyDisplay::$_nbDecimal = 2
private
CurrencyDisplay::$_negativePos = '{sign}{number}{symbol}'
private
CurrencyDisplay::$_numeric_code = 0
private
CurrencyDisplay::$_positivePos = '{number}{symbol}'
private
CurrencyDisplay::$_priceConfig = array()
CurrencyDisplay::$_symbol = 'udef'
private
CurrencyDisplay::$_thousands = ' '
private
CurrencyDisplay::$_vendorCurrency = 0
CurrencyDisplay::$_vendorCurrency_code_3 = 0
CurrencyDisplay::$_vendorCurrency_numeric = 0
CurrencyDisplay::$exchangeRateShopper = 1.0
CurrencyDisplay::$priceNames
static
Initial value:
= array('basePrice','variantModification','basePriceVariant',
'basePriceWithTax','discountedPriceWithoutTax', 'discountedPriceWithoutTaxTt',
'salesPrice', 'salesPriceTt', 'priceWithoutTax', 'priceWithoutTaxTt',
'salesPriceWithDiscount','discountAmount','discountAmountTt','taxAmount', 'taxAmountTt','unitPrice')

The documentation for this class was generated from the following file: