PHP Class ShopTools, silvershop-core

Mostra file Open project: burnbright/silverstripe-shop Class Usage Examples

Public Methods

Method Description
DBConn ( string $name = 'default' ) : SS_Database Get the DB connection in a SS 3.1 and 3.2+ compatible way
get_current_locale ( ) : string Get the current locale.
install_locale ( string $locale ) Set/Install the given locale.
price_for_display ( mixed $price ) : Money Convert a numeric price to the shop currency

Method Details

DBConn() public static method

Get the DB connection in a SS 3.1 and 3.2+ compatible way
public static DBConn ( string $name = 'default' ) : SS_Database
$name string
return SS_Database

get_current_locale() public static method

Tries to get the locale from Translatable, Fluent or the default i18n (depending on what is installed)
public static get_current_locale ( ) : string
return string the locale in use

install_locale() public static method

This does set the i18n locale as well as the Translatable or Fluent locale (if any of these modules is installed)
public static install_locale ( string $locale )
$locale string the locale to install

price_for_display() public static method

Convert a numeric price to the shop currency
public static price_for_display ( mixed $price ) : Money
$price mixed the price to convert
return Money the price wrapped in a Money DBField to be used for templates or similar