Usd & euro
Anyone who could tell how to let customers display prices in EURO or USD? (PHP)
Anyone who could tell how to let customers display prices in EURO or USD? (PHP)
Do you have set prices in each currency, or do you want to do a currency conversion?
I guess you would first determine how you wanted to expose that option to the end user. It could be done a variety of ways.
A currency conversion from EURO to USD. I just want to use one price for each item in the database if possible?
How would you know which price to display to the user? Where are you having difficulty?
It is possible to do any number of ways. You just need to decide what you want to do and what your user experience would be and make it happen. If you get stuck along the way, ask a specific question here and we can help.
I'll try to be more specific, I want a link in the header of the pages which says; show prices in: EURO | USD. The prices are shown in EURO by default but if a visitor/customer prefers to use USD he may choose the "USD" and then the page reload and show prices in USD instead of EURO. I also just want to have one coloumn in the database products table for price and that would be in EURO, when showing USD it will be calculated from the price in EURO * exchange rate for USD.
OK, now you asking some questions that can be answered ;)
I guess the easiest way to do it would be to add an include file to the top of every page in your site, so you can manage the functionality from one place.
Then add a variable declaration for the exchange rate. If you want you can get it from the database, or just update this file directly to reflect accurate rates.
You can create and set a sesison variable on the included page to keep track of the currency settings. You can apply the "set session value" server behavior in the general section of ecart to set the value of the session variable to "EURO" if it is not defined to accomplish the desired result.
This will then give you the session variable and the exchange rate on any page where you need it. From there you make your "Show prices in" option simply update that session variable.
Then wherever you reference a price "[pricecode]", you can instead reference it:
(($_SESSION['CurrencyFormatSessionName'] == "USD")?([pricecode]*$_currencyRate):[pricecode])
The same general principal would be used whenever displaying currency in the cart or on the page where you need currency conversion.
Thanks a lot Ray, I will try this.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.