Jump to content

V4 - Specify currency in URL?


Jortex

Recommended Posts

Hi all,

 

I know you can specify the template used (?systpl=portal) and order form (cant remember this one) but is there anyway to specify the currency in the URL when linking to the order pages?

 

If not, i think this would make a great edition to V4.

 

Cheers.

Link to comment
Share on other sites

It is not possible using the URL as far as I am aware (Unless WHMCS have added it since I last asked).

 

However you can achieve a currency change from any page or link with a custom php page.

 

Create a php page called setcur.php with the following code.

 

<?php
session_start();
$_SESSION["currency"] = $_GET["cur"];
if (isset($_GET["rurl"])){
$rurl = $_SERVER['HOST'] . $_GET["rurl"];
} else {
$rurl = $_SERVER['HTTP_REFERER'];
}
header('Location: ' . $rurl);
?>

 

And create your links with -

 

setcur.php?cur=1

 

This simply redirects back to the referring page or to have the script redirect to a specific page use -

 

setcur.php?cur=1&rurl=url-to-return-too.htm

 

variable "cur" should be currency id of one of the currencies you have created.

 

The currency is set using the session variable "currency" (unless the user is logged in then it uses the currency set when they signed up)

Link to comment
Share on other sites

  • WHMCS CEO

That's a complicated way of doing it. You can of course set it via the url by just simulating what the form shown for currency selection does - eg. cart.php?currency=1 cart.php?currency=2. It's the same thing as you can do with the gid for group selection & pid for product selection.

 

Matt

Link to comment
Share on other sites

That's a complicated way of doing it. You can of course set it via the url by just simulating what the form shown for currency selection does - eg. cart.php?currency=1 cart.php?currency=2. It's the same thing as you can do with the gid for group selection & pid for product selection.

 

Matt

 

You are correct of course Matt.

 

My script does however have one advantage, it will work on any page not just the cart page so you can set and show the current currency to the user throughout the site, good if you have currency specific call-outs / adverts or custom pricing pages.

 

Unless this has changed since RC1?

Link to comment
Share on other sites

You are correct of course Matt.

 

My script does however have one advantage, it will work on any page not just the cart page so you can set and show the current currency to the user throughout the site, good if you have currency specific call-outs / adverts or custom pricing pages.

 

Unless this has changed since RC1?

 

Well, actually it works in any page, eg. cart.php?gid=1&currency=2 cart.php?gid=3&currency=2 , etc.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated