Iam developing a shoping cart site. I want to change the price of the product if the country changes.The prices of the the products shoul be all over the project Whenever country changes according to the currency. For this iam trying to set a session variable in jquery and with this i want to retreive the data.But Iam unable to get it.
if suppose iam selecting the USD in index page its working fine.And if iam redirecting to another page.its not working.
Every indidual pages its working fine.which means for every page iam changes the country then the price of the product changing. For this i want to pass the session variable. But Iam unable to set the session variable in Jquery.Can Anty one help me to solve this issue. Here iam Inserting the Jquery code
Currency.format = 'money_with_currency_format';
var shopCurrency = 'INR';
//Sometimes merchants change their shop currency, let's tell our JavaScript file
Currency.money_with_currency_format[shopCurrency] = "${{amount}} INR";
Currency.money_format[shopCurrency] = "${{amount}} INR";
//Default currency
var defaultCurrency = 'INR' || shopCurrency;
//Cookie currency
var cookieCurrency = Currency.cookie.read();
//Fix for customer account pages
jQuery('span.money span.money').each(function () {
jQuery(this).parents('span.money').removeClass('money');
});
//Saving the current price
jQuery('span.money').each(function () {
jQuery(this).attr('data-currency-INR', jQuery(this).html());
});
//If there's no cookie.
if (cookieCurrency == null)
{
if (shopCurrency !== defaultCurrency)
{
Currency.convertAll(shopCurrency, defaultCurrency);
}
else
{
Currency.currentCurrency = defaultCurrency;
}
}
//If the cookie value does not correspond to any value in the currency dropdown.
elseif(jQuery('[name=currencies]').size() && jQuery('[name=currencies] option[value=' + cookieCurrency + ']').size() === 0)
{
Currency.currentCurrency = shopCurrency;
Currency.cookie.write(shopCurrency);
}
elseif(cookieCurrency === shopCurrency)
{
Currency.currentCurrency = shopCurrency;
}
else
{
Currency.convertAll(shopCurrency, cookieCurrency);
}
//Currency value changes
jQuery('[name=currencies]').val(Currency.currentCurrency).change(function () {
var newCurrency = jQuery(this).val();
Currency.convertAll(Currency.currentCurrency, newCurrency);
jQuery('.selected-currency').text(Currency.currentCurrency);
});
var original_selectCallback = window.selectCallback;
var selectCallback = function (variant, selector)
{
original_selectCallback(variant, selector);
Currency.convertAll(shopCurrency, jQuery('[name=currencies]').val());
jQuery('.selected-currency').text(Currency.currentCurrency);
};
jQuery('.selected-currency').text(Currency.currentCurrency);
<?php
//PHP Session Created
$_SESSION['newCurrency'] = $_POST['currencies'];
?>
//Currencies Html Code
< select id = "currencies" name = "currencies" >
< option value = "INR" selected = "selected" > INR < /option> / / default
< option value = "USD" > USD < /option>
< option value = "CAD" > CAD < /option>
< option value = "GBP" > GBP < /option>
< option value = "EUR" > EUR < /option>
< /select>
//Display's generated session
<?php
echo $_SESSION['newCurrency'];
?>