2017-06-02 135 views
1

我已經開發了一個電子商務網站Codeigniter 2.0,MySQL集成了PayPal,USD爲默認貨幣。現在我的客戶要求我改變電子商務以支持多個國家的貨幣。我的多貨幣不會轉換貨幣,但是會爲所有貨幣確定每種產品的價格。是的,它會爲我的客戶提供大量的數據錄入工作,但它是我電子商務網站的唯一選擇。多種貨幣電子商務網站的價格表結構

我列出了貝寶支持的貨幣。並創建數據庫電子商務時卡住

我有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 

回答

2

這是我怎麼會設計表

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, .... 
+0

感謝你的建議。我將繼續與我的選擇2與您的方法 –