Jump to content

Data Feed Product Pricing Currency


Recommended Posts

Hello,

I use the Data feed to get the product pricing from WHMCS for my website. What I want to do is make the currency update to their location. I want it to do it automatically based on their location, rather than them having to select the currency.

On WHMCS I have made it so when they are on WHMCS it auto detects their country and shows the correct currency. I'm hoping I can do the same on my website.

 

Thanks in Advance!

Link to comment
Share on other sites

21 hours ago, carlos_tlewis said:

On WHMCS I have made it so when they are on WHMCS it auto detects their country and shows the correct currency. I'm hoping I can do the same on my website.

how are you detecting country in WHMCS - using MG's free hook or another method?

I would have thought all you need to do is setup a similar geolocation solution for your main site and then use a variable in the feed that passes the appropriate currency value for the estimated country location.

Link to comment
Share on other sites

On 4/20/2020 at 12:48 PM, brian! said:

about the simplest i've seen is -  https://ipgeolocationapi.com/ - as long as you don't hammer it with requests!

Thanks Brian!. I've been having a look into this one but I don't think it's going to work right.

I've asked the MG guys to see if they can do a custom script for me. See what they say.

Link to comment
Share on other sites

All I really want is a way for the client to be able to change the currency, even if they have to click a flag to change this. Currently I have 2 web pages, one in the UK and one in the US. Which is a pain and not really a good way to do things.

 

Example:

UK or US

When they click UK it will change all the currency to £

 

Not looking for anything fancy.  Any ideas? tried going on getacoder but it seems down right now. 

 

Link to comment
Share on other sites

15 hours ago, carlos_tlewis said:

All I really want is a way for the client to be able to change the currency, even if they have to click a flag to change this. Currently I have 2 web pages, one in the UK and one in the US. Which is a pain and not really a good way to do things.

this bit isn't relevant to you, but i'll mention for anyone else wanting to add currency to the header in WHMCS directly...

pqtXzar.png

now as I said, that won't apply to you because you're wanting to do this on an external site.. and have it influence a data feed.

15 hours ago, carlos_tlewis said:

Example:

UK or US

When they click UK it will change all the currency to £

Not looking for anything fancy.  Any ideas? tried going on getacoder but it seems down right now. 

fundamentally, you just need to pass a variable value into the feed for the currency - but as i've got no idea if this external site is html, php, wordpress or whatever, i'll give you a basic way to do it in php...

<html>
<body>
<?php
$currency = $_GET['currency'];
echo "<a href=\"".$_SERVER["PHP_SELF"]."?currency=1\">GBP</a> <a href=\"".$_SERVER["PHP_SELF"]."?currency=2\">USD</a><br><br>";
?>
<script language="javascript" src="feeds/productsinfo.php?pid=1&get=price&billingcycle=monthly&currency=<?php echo $currency ?>"></script>
</body>
</html> 

2ofdrBT.gif

obviously, those links can be replaced with flags, images etc and there are other ways to do this - the point being that you are passing a currency value to the data feed and it is then using that value to pull the correct detail for that currency from the database.

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