I currently have a website that is showing a price for a product within a <div>. I would like this number to change if the user is from outside the UK, for example changing the price to Euros rather than GBP.
Is this possible? I can't find an example I understand.
You should give more example info but Im not going to be so critical.
You could capture the location using google maps if they agree to it, or ip address and then set a class to all the price divs and price symbol divs.
try something like this
<div id="parent_id">
<div class="item">
<span class="symbol">£</span> <div class="price_divs" id="div1">5.00</div>
</div>
<div class="item">
<span class="symbol">£</span> <div class="price_divs" id="div2">5.00</div>
</div>
<div class="item">
<span class="symbol">£</span> <div class="price_divs" id="div3">5.00</div>
</div>
</div>
<script>
jQuery(function(){ ///requires jquery
if(location == "US"){ //location must be a global variable given a value from google maps
var all_pricing = $('#parent_id').find('.price_divs');
$('.symbol').html('$');
$.each(all_pricing,function(x,y){
var c = convertToDollars($('#'+y.id).html());
$('#'+y.id).html(c);
});
}
function convertToDollars(cost)
{
///some conversion here
return cost;
}
});
</script>