Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Rounding auto prices

This part of the 4.x documentation is for eZ Publish 4.0, only reference section is common for all eZ Publish 4.x versions as well as eZ Publish 5.x "LegacyStack", please select the version you are using for the most up to date documentation!

The price rounding process is affected by settings which are specified in the "[MathSettings]" section of the "settings/shop.ini" configuration file such as:

  • RoundingPrecision
  • RoundingType
  • RoundingTarget

You can specify your own price rounding criteria for auto prices calculation by creating an override for this configuration file.

RoundingPrecision

This setting specifies how many significant digits after the decimal point should be kept while rounding. By default, the precision is set to 2. Normally, there is no need to set for example "RoundingPrecision=3" because only two decimal digits are stored in the database for each price.

RoundingType

This setting defines which rounding method should be used. The possible values are described in the following table.

Setting

Description

Actual value

Rounded value

RoundingType=round

returns the closest value

0.124

0.12

RoundingType=round

returns the closest value

0.125

0.13

RoundingType=ceil

returns the next highest value by rounding up

0.121

0.13

RoundingType=floor

returns the next lowest value by rounding down

0.129

0.12

RoundingType=none

rounding is not used

1/3

*0.333333...

* as long as only two decimal digits are stored in the database for each price, the result will be 0.33

Please note that the examples above are calculated supposing that RoundingPrecision is set to 2.

The default value of the "RoundingType" setting is "round".

RoundingTarget

This setting allows you to force rounding to the specified target. For example, if you prefer "retail" prices like $2.49 instead of $2.50, you can instruct the system to use 9 as the end digit for all your auto prices.

The default value of the "RoundingTarget" is "false".

Please refer to the following table for examples of usage.

Setting

Actual value

Rounded value

RoundingTarget=false

89.468543

89.47

RoundingTarget=5

89.468543

89.45

RoundingTarget=99

89.468543

89.99

Please note that the examples above are calculated supposing that RoundingPrecision is set to 2 and RoundingType is set to "round".

Don't forget to update auto prices for existing products after changing the rounding settings.

Svitlana Shatokhina (05/05/2006 12:08 pm)

Ricardo Correia (17/04/2013 3:03 pm)

Svitlana Shatokhina, Ricardo Correia


Comments

There are no comments.