AbanteCart Community

Shopping Cart Operations => Security => Topic started by: everchanging on March 21, 2019, 03:36:42 PM

Title: Critical Error Message - Currency rate not updated
Post by: everchanging on March 21, 2019, 03:36:42 PM
Hi guys,

I received the following Critical error message:

Message status:
critical
Date:
...
Number of repetitions:
3
Currency Auto Updater Warning: Currency rate code GBP not updated. Trace: #0
…/admin/model/localisation/currency.php on line 230 #1
…/admin/controller/pages/index/home.php on line 173 #2 on line #3
…/core/engine/dispatcher.php on line 293 #4
…/core/engine/dispatcher.php on line 328



How can I resolve this?
Title: Re: Critical Error Message - Help needed
Post by: abolabo on March 22, 2019, 04:42:57 AM
1. you have enabled currency updater.
2. every time you login into admin it make api request to 3d-party service and ask currency exchenge rates  for all of your currencies.
3. Abantecart have hardcoded API-key to make these requests. This key is free and have limitation.
4. To solve issue you shoult to get your own API-key here https://www.alphavantage.co
5. Then go to phpMyAdmin, open table settings and add row with this SQL query

Code: [Select]
INSERT INTO `{your table_prefix}settings`( `store_id`, `group`, `key`, `value`) VALUES ( 0, 'details',   'alphavantage_api_key',  '-your-own-api-key-');
Just paste your table prefix and your own api-key value.

Or make it via phpMyAdmin adding new row form
Title: Re: Critical Error Message - Currency rate not updated
Post by: everchanging on March 22, 2019, 02:18:35 PM
Hi abalabo and thank you for your reply.

I did go to alphavantage and I did get my API Key.

Just for clarification reasons and to see if I have understood you correctly.

In the following code:
Code: [Select]
INSERT INTO `{your table_prefix}settings`( `store_id`, `group`, `key`, `value`) VALUES ( 0, 'details',   'alphavantage_api_key',  '-your-own-api-key-');

I do the following changes (if I am wrong please correct me):

Code: [Select]
{your table_prefix} -> This I DO change

Code: [Select]
( `store_id`, `group`, `key`, `value`) ->This I do NOT change

Code: [Select]
0, 'details', ->This I do NOT change

Code: [Select]
'alphavantage_api_key', -> I insert the API Key that I did receive

Code: [Select]
'-your-own-api-key-' -> and what do I do here since the API Key that I did receive goes in the previous section?

I thank you in advance
Title: Re: Critical Error Message - Currency rate not updated
Post by: abolabo on March 22, 2019, 02:26:55 PM
Hi abalabo and thank you for your reply.

I did go to alphavantage and I did get my API Key.

Just for clarification reasons and to see if I have understood you correctly.

In the following code:
Code: [Select]
INSERT INTO `{your table_prefix}settings`( `store_id`, `group`, `key`, `value`) VALUES ( 0, 'details',   'alphavantage_api_key',  '-your-own-api-key-');

Code: [Select]
'alphavantage_api_key', -> I insert the API Key that I did receive

Code: [Select]
'-your-own-api-key-' -> and what do I do here since the API Key that I did receive goes in the previous section?

I thank you in advance

do not change ''alphavantage_api_key' - it's a name of setting.
Just replace -your-own-api-key- with API-key that you got
Title: Re: Critical Error Message - Currency rate not updated
Post by: everchanging on March 22, 2019, 02:35:52 PM
Hi Abolado, thanks for the quick reply.

So the only thing that I do change in the following code is:

Code: [Select]
INSERT INTO `{your table_prefix}settings`( `store_id`, `group`, `key`, `value`) VALUES ( 0, 'details',   'alphavantage_api_key',  '-your-own-api-key-');
Is

Code: [Select]
'-your-own-api-key-' -> with the API KEY that I did receive?

Thanks again

***Update:***

I apologize for the bombardment of my questions, but which table do I use for "your table_prefix"? I am looking at a ton of tables right now and I do not want to mess with them?


***Update 2:***

Instead of going to the database, can I not do the following?

To change directly the Api Key with the new that I did receive in the code below?

Code: [Select]
public function updateCurrencies()
    {
        $this->load->model( 'setting/setting' );
        $settings = $this->model_setting_setting->getSetting( 'details', 0 );
        $api_key = isset( $settings['alphavantage_api_key'] ) && $settings['alphavantage_api_key'] ? $settings['alphavantage_api_key'] : '************'; <<<------ This one here -------
        $base_currency_code = $settings['config_currency'];

Title: Re: Critical Error Message - Currency rate not updated
Post by: Sam_78 on March 22, 2019, 03:28:45 PM
INSERT INTO `{your table_prefix}settings`( `store_id`, `group`, `key`, `value`) VALUES ( 0, 'details',   'alphavantage_api_key',  '-your-own-api-key-');

{your table_prefix} means if you have a table names `ac_settings` in your database if not then use just `settings`

To verify this go to you database and scroll at the very bottom there should be a table named `settings` if you have added some prefix to it then `prefix_settings`




Title: Re: Critical Error Message - Currency rate not updated
Post by: everchanging on March 22, 2019, 03:53:13 PM
Hi guys, consider this topic closed.

Thank you  :)