Price

Architecture

For more information about our position regarding the price architecture, you can read: Currency.

Presentation

Price bundle handles everything related to prices, (right now, only currencies, but it will soon be extended to add taxes, …)

Installation

This central e-commerce bundle requires you add a bcscale method in your Kernel.php file to ensure that prices are correctly computed. Please, update your Kernel.php file like this:

class Kernel extends BaseKernel
{
    public function boot()
    {
        bcscale(3); // or any other value greater than 0

        // ...
    }

    // ...
}

Configuration

Price bundle configuration is as follows:

1
2
3
4
5
6
7
8
sonata_price:
    currency: EUR # Or any valid value according ISO 4217 standard
doctrine:
    dbal:
        # ...

        types:
            currency: Sonata\Component\Currency\CurrencyDoctrineType

You can also change the services class (defined as parameters):

  • sonata.price.currency.detector.class for the currency detector
  • sonata.price.currency.manager.class for the currency manager (finding the CurrencyInterface item matching the currency label)

As you may see in the sample configuration, we defined a new doctrine field type to store currencies in database.