kirilkirkov / Ecommerce-CodeIgniter-Bootstrap

Responsive, Multi-Vendor, MultiLanguage Online Store Platform (shopping cart solution)
MIT License
1.29k stars 946 forks source link

Convert currency in publish product is not working anymore #81

Closed loginetsolutions closed 6 years ago

loginetsolutions commented 6 years ago

Convert currencies from Google finance is not working anymore. Changed currency_convertor_helper for <?php

if (!defined('BASEPATH')) { exit('No direct script access allowed'); }

function convertCurrency($amount, $from, $to) { if ($from == $to) { return number_format(round($amount, 3), 2); } $data = json_decode(file_getcontents("https://free.currencyconverterapi.com/api/v5/convert?q=".$from."".$to."&compact=y"));

$currencies = $from."_".$to;
    $rate = $data->$currencies->val;
$converted = $amount * $rate;
return number_format(round($converted, 3), 2);

}

kirilkirkov commented 6 years ago

@loginetsolutions Yes. Google finance will not working and with this commit - https://github.com/kirilkirkov/Shopping-Cart-Solution-CodeIgniter/commit/0e0e1326851c554e25792b13d6a5441444d02072 i remove currency convertor. Now paypal currency will be get from selected site language

loginetsolutions commented 6 years ago

I just changed the helper to other url:

function convertCurrency($amount, $from, $to)
{
    if ($from == $to) {
        return number_format(round($amount, 3), 2);
    }
    $data = json_decode(file_get_contents("https://free.currencyconverterapi.com/api/v5/convert?q=".$from."_".$to."&compact=y"));

    $currencies = $from."_".$to;
    $rate = $data->$currencies->val;
    $converted = $amount * $rate;
    return number_format(round($converted, 3), 2);
}
kirilkirkov commented 6 years ago

@loginetsolutions ok, its fine while working and this api :)