Hello,
This php script converts product currency by currency
Can we do the same in javascript/jquery
function convert($cf,$urun,$secilen_paracinsi_id)
{
// if the product currency is the same as the selected currency, return the product price
if($product['para_birimi'] == $secilen_paracinsi_id)
{
return $urun['b_fiyati'];
}
// the currency_unit is different, convert the price
// if the product currency|selected currency matches a from|to entry in $cf, multiple by the factor
$index = $urun['para_birimi'] .'|'. $secilen_paracinsi_id;
if(isset($cf[$index]))
{
return $urun['b_fiyati'] * $cf[$index];
}
// if the selected currency|product currency matches a from|to entry in $cf, divide by the factor
$index = $secilen_paracinsi_id .'|'. $urun['para_birimi'];
if(isset($cf[$index]))
{
return $urun['b_fiyati'] / $cf[$index];
}
}