close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Two or more currencies

Thread began 12/20/2011 2:32 pm by turbo.sarajevo416658 | Last modified 12/22/2011 6:49 am by Jason Byrnes | 1159 views | 3 replies |

turbo.sarajevo416658

Two or more currencies

Hi,

i'm trying to add some kind of dropdown where my customers can choose what currency is used in my shopping cart (or maybe whole site). Currently i would like to let them choose between dollar or euro but i want to add some currencies later. So just to be clear i would also like if they could change currency if there is already something in the cart. I really dont know how to do this and if it is possible...
Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

this is possible, but will take some custom coding to accomplish.

add the following code to the page where the currency selection will be made at line 1:

php:
<?php

@session_start();
switch((isset(
$_POST['currency']))?$_POST['currency']:"") {
    case 
"USD":
        
$_SESSION['currencySymbol'] = "$";
        
$_SESSION['currencyCode'] = "USD";
        break;
    case 
"EUR":
        
$_SESSION['currencySymbol'] = "&euro;";
        
$_SESSION['currencyCode'] = "EUR";    
        break;
    default:
        
$_SESSION['currencySymbol'] = "$";
        
$_SESSION['currencyCode'] = "USD";    
}
?>




use this code in the body to add the currency select list:

php:
<form id="form1" name="form1" method="post"  action="">

  <label>
    <select name="currency" id="currency">
      <option value="USD" selected="selected">USD</option>
      <option value="EUR">Euro</option>
    </select>
  </label>
  <label>
    <input type="submit" name="button" id="button" value="Submit" />
  </label>
</form>




you will then need to edit the eCart object file to use the dynamically set curency symbol.

in my example, the eCart objec is named eCart4, look for the following code:

php:
$eCart4 = new eCart4_Definition("eCart4", 0, "$", "", true, 2, 0, "oz", true, 2, 1, 0);



in your eCart file, it will be slightly different, anywhere that says "eCart4" substitute with the name if your eCart object

change that to:

php:
$eCart4 = new eCart4_Definition("eCart4", 0, "".(isset($_SESSION['currencySymbol']))?$_SESSION['currencySymbol']:"$"."", "", true, 2, 0, "oz", true, 2, 1, 0);



after running the checkout wizard, you will also need to modify the confirm page, to change the parameter that passes the currency code to the gateway use the dynamic one. this change will be different based on the payment gateway you are using, let me know what payment gateway you plan to use and i can tell you the code that will need to be changed.

Sign in to reply to this post

turbo.sarajevo416658

Symbol and value

This changes only the symbol but i also want the value to change. To be precise if a customer selects euro and usd is selected by default i want all numbers in my cart to be recalculated to euro (1USD = 0,75E). I think this could be similar to this you already wrote but i dont know where to put the calculation formulas... I dont use any payment gateway so there shouldn't be any problems.

Sign in to reply to this post

Jason ByrnesWebAssist

That is not supported by eCart and would take quite a bit more custom coding. This is not something that we would be able to assist with here in the forums, if you would like help creating this, Please sign up for a Premiere Support ticket appointment where we could work with you in a one on one session.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...