3

Observed in Magento EE 1.14.2.0, sales_flat_quote_item table has same value of price and base_price even the base currency and store currency are different.
But the strange thing is unit price and row totals are showing correct values in cart & checkout pages.

After further investigation it is found that unit price is calculated as converted value of price.

  • If this is the case why the Magento team didn't use the base_price.
  • And what's the point of having same values for price and base_price if the base currency and store currency are different?

Can anyone shade some lights on it?

2 Answers 2

3

The base_price is always using the Magento installation base currency

There can be only one default base currency per installation/website. Then the price is view related and will register the same value as base_price if the store view from which the price was sourced use the base currency or if the conversion rate is equal.

Dynamic rate update configuration

In all cases where a different currency from the base one is used, where Magento has been set up to update currency rates by CRON, the registered price should differ from the base_price.

Fixed prices configuration

It is also important to take into consideration that Magento can be configured in a way where it uses one currency per website without conversion or rate update. In this case for example Website1 can use USD and Website2 USD, while both sharing the exact same price without any conversion. Of course this is far from an ideal solution as where the exchange vary greatly either it would be a lost or the price would be too high. In these cases, it is always possible to manually adjust the price per website without aftecting the others. This can be a time consuming task with large catalogs but a custom script or extension may be used to calculate and apply a conversion from a chosen website base currency to an other via CRON job.

As you are experiencing a situation where base_price and price are equal, this would mean that your rate update via CRON is not configured or not running and by default the prices are set equal. Unless you would be facing a bug or Magento would be refactoring the price management system.

Registered VS Displayed Prices

Something important to mention is the difference between "registered prices" and "displayed prices". Converted prices shown on the website are not usually registered in the database, they are converted on request (on page load) based on the base_price. A currency switcher can allow to display a large amount of different currencies but after all, behind the scene and at checkout, everything will be processed using the base currency. The only exception to this is distinct websites using different base currencies as stipulated above. This explains why the amounts are converted on the different store pages. If a customer checks out using a currency different from the base one, then in the database the order price will reflect a converted amount while the base_price will reflect the amount in the base currency.

sales_flat_quote_item table

In principle, the table sales_flat_quote_item should store both the base_price and price amount but on the other side the price can be converted on request in the cart/checkout and both ways if a customer adds a product to cart and by the meantime he places his order the rate has updated then the price shown at checkout should also be different. A question remains, is it worth saving the converted price to the quote table?

It is possible that sales_flat_quote_item was initially created to store both base/converted values and it would have changed along the road.

Regarding your update, I did not dig up in the Magento 2 code for the currency conversion specifically and I'm working with CE edition but from my understanding Magento should store and calculate all prices using base_[price]. If you take a look at the sales_order database table, you will find several columns, including taxes, shipping_amount and discounts with the base_ suffix.

NOTE: Testing could be done in order to confirm the behavior, it might be worth adding some items to the cart using a different currency, taking notes of the result registered in sales_flat_quote_item for the quote then placing an order and comparing the result from the two tables.

0

price and base_price are the normal price and special price applied to that particular product from admin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.