我在Codeigniter 2.0中开发了一个电子商务网站,MySQL集成了PayPal,并以美元作为默认货币。现在,我的客户要求我更改电子商务以支持多个国家/地区的货币。我的多货币不会转换货币,但会固定所有货币的每种产品的价格。是的,这对我的客户来说将是一项大数据输入工作,但它是我的电子商务网站的唯一选择。
我列出了 PayPal 支持的货币。在为电子商务创建数据库时陷入困境
我有 2 个新表结构选项,但找不到最好的一个。请考虑产品将动态添加,并且将来可能会添加新货币。
选项 1
pro_id | USD_PRICE | EUR_PRICE |
----------------------------------------
1 | 2 | 1.5
2 | 2.5 | 2
3 | 10 | 8
4 | 2 | 1.5
选项 2
pro_id | price | currency_code |
----------------------------------------
1 | 2 | USD
1 | 1.5 | EUR
3 | 10 | USD
3 | 8 | EUR
最佳答案
这就是我设计表格的方式
product table
id, base amount, base currencyid
currency table
currencyid , description
forex table
currencyid, forexcurrencyid, forexrate, forex date
order table
productid, base amount, converted amount, currencyid, ....
关于mysql - 多币种电子商务网站的价格表结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44325777/