cancel
Showing results for 
Search instead for 
Did you mean: 

How can I make a currency conversion in b2c application

0 Kudos

We have a b2c application for which we are introducing multiple currencies.

This should happen when we get the product feed(or a daily job) and should create a price row with the new currency for all the products according to the conversion rate we provide in the currency model. Now how can we handle this and where can I convert the already existing USD to say JPY.

New to this particular concept, doing my research, any advise would be helpful.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member620692
Active Contributor
0 Kudos

Please look at the following lines from the section, Currency Conversion at https://help.hybris.com/1811/hcd/961b19dfdcd34eff8c6659e0fad865b2.html :

A PriceRow is always specified in a certain currency. If a PriceRow is specified in a currency different from the current customer's session, the PriceRow's value is converted automatically based on the conversion rates in SAP Commerce.

Now, look at the value of the attribute, conversion in the following ImpEx:

 # Currencies
 INSERT_UPDATE Currency;isocode[unique=true];conversion;digits;symbol
 ;EUR;1;2;€
 ;USD;1,4;2;$
 ;JPY;120;0;¥

The conversion attribute on the Currency type defines the conversion ratio relative to the default currency.

Given below is how you create price rows for different currencies:

 #% impex.setLocale( Locale.GERMAN ); 
 INSERT_UPDATE PriceRow;productId[unique=true];unit(code[unique=true,default=pieces]);currency(isocode)[unique=true];price;minqtd;unitFactor;net
 ;107701;pieces;USD;179,93;1;1;false
 ;107701;pieces;JPY;15330;1;1;false

I recommend you to check essential-data.impex and products-prices.impex in hybris/bin/ext-data/electronicsstore/resources/electronicsstore/import and hybris/bin/ext-data/apparelstore/resources/apparelstore/import folders for more such data.

Feel free to comment if you have any further problem with regards to this question.

0 Kudos

Thank you Arvind..

In this scenario, we only have one price row and that is USD, so now we should: 1. Create a price row for other currency 2. Convert it using the conversion attribute.

We only have one currency in our application, USD. Now we are introducing new currencies. I am not sure on how I can create a price row for a new currency, can you please guide me on this.

Correct me if my understanding is wrong.

0 Kudos

Accepted you answer. Can you please let me know which is the best api/service to get currency convresion rate. We are planning to call a service by sending 2 currencies(say USD and CAD ), and get the conversion rate.

former_member620692
Active Contributor
0 Kudos

Thank you. Did you check https://fixer.io/ ?

0 Kudos

Ya Arvind, fixer.io is one of the services we've proposed.

One more query is do we need to do any changes for solr, or will it take the appropriate pricerow automatically for the newly introduced currencies as well.

former_member620692
Active Contributor
0 Kudos

You need to do Solr configuration for the exchange rate. Please check the required configuration at https://lucene.apache.org/solr/guide/7_1/working-with-currencies-and-exchange-rates.html .

Former Member
0 Kudos

Hi, I am trying to set PriceRow for a Product in Brazilian Currency[BRL] and the site's default language is pt. So when I add the following line, #% impex.setLocale( Locale.PORTUGUESE ); before the impex header there is no difference. For example is a product price is 116, it is displayed as 116.0 whereas I need in the format #.###,##

And one more clarification is about the digit attribute in the header. And does it have a role to play in this??

Answers (0)