Answer the question
In order to leave comments, you need to log in
How to convert the price of a product if the user himself decides in which currency to indicate the price of his product?
Good afternoon. I can't figure out how to convert the currency if the price for each product can be indicated in different currencies.
There is a table:
products
id|cost|currency_id
1| 11 | 1
2| 133| 2
currencies
id|symbol|course
1|RUB|1
2|USD|63
Now I have a table of currencies that depends on the ruble. What is the best way to design the database so that if the user chooses the RUB currency, then everything is in rubles, USD is all in dollars.
So far I have one idea, to create a table (currency_id, currency2_id, cost) and dance further from this. Has anyone come across this problem and know the solution?
Answer the question
In order to leave comments, you need to log in
You think correctly - you need to create a table containing the exchange rates of one currency for another
if the user himself decides in what currency to indicate the price of his goods?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question