close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Currency change for specific customers

Thread began 3/13/2012 3:45 am by bill3786 | Last modified 4/07/2012 3:25 am by bill3786 | 1820 views | 11 replies |

bill3786

Currency change for specific customers

At the moment the products_Results page and products_Detail page displays the product prices in pounds sterling, the numeric value in sterling is stored in the database and displayed next to a static £ symbol on these pages.

All the prices from thereon to the checkout page are conducted in sterling including all shipping and taxes.

Is it possible to distinguish when a user logs in to identify their country of origin based on their registration details and subsequent login to either display prices and conduct the purchase in sterling if they have registered with a UK address or to display Euros and conduct the purchase in Euros (including shipping and taxes) if they have registered with an address which is anywhere in the world outside of the UK.

There would be no automatic conversion for sterling to Euros but the client would enter fixed euros prices into the database for all the products (including shipping and taxes) and these would be periodically reviewed and amended when appropriate. These euro details would then be used for conducting the purchase for all users registered from outside the UK.

How would this impact on the backend of the site for inserting and updating product details and any other areas of the front end of the site?

I need to evaluate how big a task this is to respond to the client's request.

Sign in to reply to this post

Jason ByrnesWebAssist

it wouldn't be a small addition to do this, and would require considerable hand coding.

the product insert and updated pages would need to have a new form element added for the Euro price, and you would need to edit the insert and update record behaviors to use that new form element.


you would need to modify the login to store the users country in a session variable

on the product pages, you would need to create an if statement to show the proper column based on the session value

and you would need to edit the eCart add to cart code to use the correct price column based on the session value.

you would also need to edit the eCart code for sending the transaction to the gateway to use the correct currency code, and edit the shipping behavior code to use the correct currency code

Sign in to reply to this post

bill3786

Ok, thanks for this detailed reply.

Can you suggest a less comprehensive solution that would possibly display sterling and euro prices alongside each other for non-UK cutomers but then proceed to checkout using sterling as normal.

I believe there are online currency converters but is this feasible or even possible?

Sign in to reply to this post

Jason ByrnesWebAssist

your products table would need to have a column for each price.

you could display both prices on the products page and only bind the cart price column to the one where you store pounds sterling.

Sign in to reply to this post

bill3786

The client doesnt want to display both currencies prefering to display either sterling or euro depending on the login details, sterling for UK customers and euro for all non-UK customers.

The transaction through to gateway would then be completed in sterling so only the display on results and detail pages would need to be either sterling or euro.

I'm OK with the extra database column and the insert/update pages but need help with the following from your earlier post.

"you would need to modify the login to store the users country in a session variable"

"on the product pages, you would need to create an if statement to show the proper column based on the session value"

I enclose the login and product pages.

Attached Files
login.zip
products_Detail.zip
products_Results.zip
Sign in to reply to this post

Jason ByrnesWebAssist

on the login page, open the server behaviors panel, and double click the Security Assist Authenticate user server behavior. Go to the Session values tab, click the plus button and select the users country column to store it in a session when the user logs in.


on the page where you display the price, you can use that session variable to determine which to show, for example, if the session is set with the name "country" and has a value of "UK" for United Kingdom:

php:
<?php if(isset($_SESSION['country'])) && $_SESSION['country'] == "UK") { ?>

Show sterling price
<?php } else { ?>
Show Euro price
<?php ?>
Sign in to reply to this post

bill3786

Ok, thanks.

Is there a preferred position for inserting this code block on the product pages?

I'm curious how this block of code selects either the sterling or euro price column from the database?

Sign in to reply to this post

Jason ByrnesWebAssist

place it where you would like the price to be displayed.

In the if statement, add the binding for the Sterling price column from your database where it says "Show sterling price" and add the binding for the Euro price column where it says "Show Euro price".

Sign in to reply to this post

bill3786

Ok thanks, should be able to do it now.

Sign in to reply to this post

bill3786

Thanks Jason, got to work OK, but for anybody following this topic, only after correcting a syntax error as shown below.

<?php if(isset($_SESSION['country'])) && $_SESSION['country'] == "UK") { ?>

should be

<?php if(isset($_SESSION['country']) && $_SESSION['country'] == "UK") { ?>

Sign in to reply to this post
loading

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...