Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
__construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Locale\FormatInterface $localeFormat, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Directory\Helper\Data $directoryHelper, \Magento\Directory\Model\Currency\FilterFactory $currencyFilterFactory, \Magento\Framework\Locale\CurrencyInterface $localeCurrency, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[], CurrencyConfig $currencyConfig=null) | |
getCode () | |
getCurrencyCode () | |
getRates () | |
setRates (array $rates) | |
load ($id, $field=null) | |
getRate ($toCurrency) | |
getAnyRate ($toCurrency) | |
convert ($price, $toCurrency=null) | |
getFilter () | |
format ($price, $options=[], $includeContainer=true, $addBrackets=false) | |
formatPrecision ( $price, $precision, $options=[], $includeContainer=true, $addBrackets=false) | |
formatTxt ($price, $options=[]) | |
getCurrencySymbol () | |
getOutputFormat () | |
getConfigAllowCurrencies () | |
getConfigDefaultCurrencies () | |
getConfigBaseCurrencies () | |
getCurrencyRates ($currency, $toCurrencies=null) | |
saveRates ($rates) | |
![]() | |
__construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[]) | |
__sleep () | |
__wakeup () | |
setIdFieldName ($name) | |
getIdFieldName () | |
getId () | |
setId ($value) | |
isDeleted ($isDeleted=null) | |
hasDataChanges () | |
setData ($key, $value=null) | |
unsetData ($key=null) | |
setDataChanges ($value) | |
getOrigData ($key=null) | |
setOrigData ($key=null, $data=null) | |
dataHasChangedFor ($field) | |
getResourceName () | |
getResourceCollection () | |
getCollection () | |
load ($modelId, $field=null) | |
beforeLoad ($identifier, $field=null) | |
afterLoad () | |
isSaveAllowed () | |
setHasDataChanges ($flag) | |
save () | |
afterCommitCallback () | |
isObjectNew ($flag=null) | |
beforeSave () | |
validateBeforeSave () | |
getCacheTags () | |
cleanModelCache () | |
afterSave () | |
delete () | |
beforeDelete () | |
afterDelete () | |
afterDeleteCommit () | |
getResource () | |
getEntityId () | |
setEntityId ($entityId) | |
clearInstance () | |
getStoredData () | |
getEventPrefix () | |
![]() | |
__construct (array $data=[]) | |
addData (array $arr) | |
setData ($key, $value=null) | |
unsetData ($key=null) | |
getData ($key='', $index=null) | |
getDataByPath ($path) | |
getDataByKey ($key) | |
setDataUsingMethod ($key, $args=[]) | |
getDataUsingMethod ($key, $args=null) | |
hasData ($key='') | |
toArray (array $keys=[]) | |
convertToArray (array $keys=[]) | |
toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true) | |
convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true) | |
toJson (array $keys=[]) | |
convertToJson (array $keys=[]) | |
toString ($format='') | |
__call ($method, $args) | |
isEmpty () | |
serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"') | |
debug ($data=null, &$objects=[]) | |
offsetSet ($offset, $value) | |
offsetExists ($offset) | |
offsetUnset ($offset) | |
offsetGet ($offset) | |
Data Fields | |
const | XML_PATH_CURRENCY_ALLOW = 'currency/options/allow' |
const | XML_PATH_CURRENCY_DEFAULT = 'currency/options/default' |
const | XML_PATH_CURRENCY_BASE = 'currency/options/base' |
Protected Member Functions | |
_construct () | |
![]() | |
_construct () | |
_init ($resourceModel) | |
_setResourceModel ($resourceName, $collectionName=null) | |
_getResource () | |
_getEventData () | |
_beforeLoad ($modelId, $field=null) | |
_afterLoad () | |
_hasModelChanged () | |
_getValidatorBeforeSave () | |
_createValidatorBeforeSave () | |
_getValidationRulesBeforeSave () | |
_clearReferences () | |
_clearData () | |
![]() | |
_getData ($key) | |
_underscore ($name) | |
Protected Attributes | |
$_filter | |
$_rates | |
$_localeFormat | |
$_storeManager | |
$_directoryHelper | |
$_currencyFilterFactory | |
$_localeCurrency | |
![]() | |
$_eventPrefix = 'core_abstract' | |
$_eventObject = 'object' | |
$_idFieldName = 'id' | |
$_hasDataChanges = false | |
$_origData | |
$_isDeleted = false | |
$_resource | |
$_resourceCollection | |
$_resourceName | |
$_collectionName | |
$_cacheTag = false | |
$_dataSaveAllowed = true | |
$_isObjectNew = null | |
$_validatorBeforeSave = null | |
$_eventManager | |
$_cacheManager | |
$_registry | |
$_logger | |
$_appState | |
$_actionValidator | |
$storedData = [] | |
![]() | |
$_data = [] | |
Additional Inherited Members | |
![]() | |
static | $_underscoreCache = [] |
Currency model
@api
@SuppressWarnings(PHPMD.CouplingBetweenObjects)
Definition at line 21 of file Currency.php.
__construct | ( | \Magento\Framework\Model\Context | $context, |
\Magento\Framework\Registry | $registry, | ||
\Magento\Framework\Locale\FormatInterface | $localeFormat, | ||
\Magento\Store\Model\StoreManagerInterface | $storeManager, | ||
\Magento\Directory\Helper\Data | $directoryHelper, | ||
\Magento\Directory\Model\Currency\FilterFactory | $currencyFilterFactory, | ||
\Magento\Framework\Locale\CurrencyInterface | $localeCurrency, | ||
\Magento\Framework\Model\ResourceModel\AbstractResource | $resource = null , |
||
\Magento\Framework\Data\Collection\AbstractDb | $resourceCollection = null , |
||
array | $data = [] , |
||
CurrencyConfig | $currencyConfig = null |
||
) |
\Magento\Framework\Model\Context | $context | |
\Magento\Framework\Registry | $registry | |
\Magento\Framework\Locale\FormatInterface | $localeFormat | |
\Magento\Store\Model\StoreManagerInterface | $storeManager | |
\Magento\Directory\Helper\Data | $directoryHelper | |
Currency\FilterFactory | $currencyFilterFactory | |
\Magento\Framework\Locale\CurrencyInterface | $localeCurrency | |
\Magento\Framework\Model\ResourceModel\AbstractResource | $resource | |
\Magento\Framework\Data\Collection\AbstractDb | $resourceCollection | |
array | $data | |
CurrencyConfig | $currencyConfig | @SuppressWarnings(PHPMD.ExcessiveParameterList) |
Definition at line 88 of file Currency.php.
|
protected |
convert | ( | $price, | |
$toCurrency = null |
|||
) |
Convert price to currency format
float | $price | |
mixed | $toCurrency |
Definition at line 223 of file Currency.php.
format | ( | $price, | |
$options = [] , |
|||
$includeContainer = true , |
|||
$addBrackets = false |
|||
) |
Format price to currency format
float | $price | |
array | $options | |
bool | $includeContainer | |
bool | $addBrackets |
Definition at line 278 of file Currency.php.
formatPrecision | ( | $price, | |
$precision, | |||
$options = [] , |
|||
$includeContainer = true , |
|||
$addBrackets = false |
|||
) |
Apply currency format to number with specific rounding precision
float | $price | |
int | $precision | |
array | $options | |
bool | $includeContainer | |
bool | $addBrackets |
Definition at line 293 of file Currency.php.
formatTxt | ( | $price, | |
$options = [] |
|||
) |
float | $price | |
array | $options |
Fix problem with 12 000 000, 1 200 000
f - the argument is treated as a float, and presented as a floating-point number (locale aware). F - the argument is treated as a float, and presented as a floating-point number (non-locale aware).
Definition at line 317 of file Currency.php.
getAnyRate | ( | $toCurrency | ) |
Get currency rate (base=>allowed or allowed=>base)
mixed | $toCurrency |
Definition at line 204 of file Currency.php.
getCode | ( | ) |
getConfigAllowCurrencies | ( | ) |
Retrieve allowed currencies according to config
Definition at line 357 of file Currency.php.
getConfigBaseCurrencies | ( | ) |
Definition at line 387 of file Currency.php.
getConfigDefaultCurrencies | ( | ) |
Retrieve default currencies according to config
Definition at line 379 of file Currency.php.
getCurrencyCode | ( | ) |
getCurrencyRates | ( | $currency, | |
$toCurrencies = null |
|||
) |
Retrieve currency rates to other currencies
string | $currency | |
array | null | $toCurrencies |
Definition at line 399 of file Currency.php.
getCurrencySymbol | ( | ) |
Return currency symbol for current locale and currency code
Definition at line 337 of file Currency.php.
getFilter | ( | ) |
getOutputFormat | ( | ) |
Definition at line 345 of file Currency.php.
getRate | ( | $toCurrency | ) |
Get currency rate (only base => allowed)
mixed | $toCurrency |
Definition at line 187 of file Currency.php.
getRates | ( | ) |
load | ( | $id, | |
$field = null |
|||
) |
Loading currency data
string | $id | |
string | $field |
Definition at line 174 of file Currency.php.
saveRates | ( | $rates | ) |
Save currency rates
array | $rates |
Definition at line 414 of file Currency.php.
setRates | ( | array | $rates | ) |
Currency Rates setter
array | $rates | Currency Rates |
Definition at line 160 of file Currency.php.
|
protected |
Definition at line 62 of file Currency.php.
|
protected |
Definition at line 57 of file Currency.php.
|
protected |
Definition at line 35 of file Currency.php.
|
protected |
Definition at line 67 of file Currency.php.
|
protected |
Definition at line 47 of file Currency.php.
|
protected |
Definition at line 42 of file Currency.php.
|
protected |
Definition at line 52 of file Currency.php.
const XML_PATH_CURRENCY_ALLOW = 'currency/options/allow' |
CONFIG path constants
Definition at line 26 of file Currency.php.
const XML_PATH_CURRENCY_BASE = 'currency/options/base' |
Definition at line 30 of file Currency.php.
const XML_PATH_CURRENCY_DEFAULT = 'currency/options/default' |
Definition at line 28 of file Currency.php.