Download the PHP package ecommpro/module-custom-currency without Composer
On this page you can find all versions of the php package ecommpro/module-custom-currency. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ecommpro/module-custom-currency
More information about ecommpro/module-custom-currency
Files in ecommpro/module-custom-currency
Package module-custom-currency
Short Description Custom Currency for Magento 2
License MIT
Informations about the package module-custom-currency
Custom Currency for Magento 2
- No critical rewrites.
- Add as many currencies as you want.
- Customize default currencies like USD or EUR.
- Customize precision (decimal places).
- Preloaded with the general purpose currency Point and some of top cryptocurencies like Bitcoin (BTC) or Ethereum (ETH).
Installation
composer require ecommpro/module-custom-currency
Execute the following commands
php bin/magento module:enable EcommPro_CustomCurrency
php bin/magento setup:upgrade
Access the Magento 2 administration panel and configure the module.
User Guide
Description
EcommPro Custom Currency allows you to create and edit new currencies directly from the Magento administrator. Manage the options of these currencies such as the precision of decimals, the symbol as image, emoji or text, position, etc. Advisable for cryptocurrency.
Regarding currencies, Magento 2 has a lack.
The currency system is heavily dependent on the PHP intl ICU extension.
This is not bad. The intl extension is battle tested and powerful.
But it covers only official fiat currencies.
What about using custom currencies like points? Or what about the increasingly popular crypto currencies like Bitcoin (BTC), Tron (TRX), Ripple (XRP), among others?
At the moment there’s no a solution provided from the Magento 2 core.
We’ve created a module to manage custom currencies, preloaded with some useful data like points currency and some of the most popular cryptos.
We’ve decided to publish it in GitHub as open source.
https://github.com/ecommpro/custom-currency
We hope it is useful for you.
What can I do with EcommPro Custom Currency?
- Create as many coins as you need.
- Enables, disables or eliminates coins.
- Give them a code, a name in the singular and in the plural.
- Set the precision in decimals, ideal for cryptocurrency.
- Set the symbol position (before or after the price).
- Manage the currency symbol as text, emoji or image.
Module Guide
You can access the module options easily from the side menu, Stores > Currency > EcommPro Custom Currency
.
You can list and manage new currencies easily from a Magento Grid.
Customize your new coins with the variety of possible options such as number of decimals, position, name or symbol.
From the Magento coin configuration section, select your new coins.
Go to a listing or product listing and you will see your new currency in action.
You can add your own currencies from the admin page or via dependency injection XML:
Admin Page
Visit Stores > Configuration > EcommPro > Custom Currency
and add the currencies you want in the text box, separated by blank lines, with the format:
Example:
Dependency Injection XML
If you want your currencies be available at install time, this should be the chosen method.
Add the currencies as the array of arrays argument of the EcommPro\CustomCurrency\Model\Config
object constructor:
Internals
This module is based on these observations:
- Magento class loader doesn't load a class if it was previously loaded.
- Magento doesn't check the type of PHP ResourceBundle returned by
Magento\Framework\Locale\Bundle\CurrencyBundle
and simply uses it as an array, as it implements array access and iteration. - In magento core files,
Magento\Framework\Locale\Bundle\CurrencyBundle
is always instantiated via constructor withnew
:(new CurrencyBundle())
So, the key idea is to load our own version of Magento\Framework\Locale\Bundle\CurrencyBundle
(a really simple class), override the get
method and return a modified array imitating the original ResourceBundle
.
Help and information
If you need help or a specialized service you can receive support by writing an email from the following form: https://ecomm.pro/en/contact-us/