Jump to content
UTM.SPACE community
china630

Национальный Банк Азербайджана

Recommended Posts

В папке models создать файл az.class.php


<?php
/**
* @author Darang
* @copyright 2012 JExt
*/
defined ( '_JEXEC' ) or die ( 'Restricted access' );
class currency_data_az extends currency_data{

function __construct() {
parent::__construct ();
$this->url = "http://cbar.az/currencies/";
$this->bank_name = "ЦБ Азербайджана";
$this->bank_url = "http://cbar.az/";
$this->currency_name = "манат";
$this->date_format = 'd.m.Y';
}

function get_array($xml, $day = '', $replace_currency_array) {
// Handle no data received error
if (! isset ( $xml->document->ValType )) {
$error ['error'] = 1;
return $error;
}
// Save currencies' rates in an associative array indexed by currency 3 char code
$rates = array (); // array to store currencies exchange rates
$rates ['date'] = $xml->document->attributes ( 'date' );
$data = $xml->document->ValType[1]->Valute;
foreach ( $data as $dt ) {
$code = $dt->attributes ( "code" );
// Store data for selected by user currencies only, if they are set
if (empty ( $this->currencies ) || in_array ( $code, $this->currencies )) {
$rates ['currency'] [$code] ['charcode'] = $dt->attributes ( "code" ); // num code
$rates ['currency'] [$code] ['scale'] = $dt->Nominal [0]->data (); // units
// Set currency name (array with replacement rules will be searched for the ISO code)
$rates ['currency'] [$code] ['name'] = parent::replace_currency_name ( $dt->Name [0]->data (), $code, $replace_currency_array );
// Get the rate & replace comma to dot for further number processing
$rates ['currency'] [$code] ['rate'] = str_replace ( ',', '.', $dt->Value [0]->data () );
}
}
// Save additional info (only one time)
if ($day == 'today' || $this->before_flag == FALSE) {
$rates ['info'] = array ("bank_name" => $this->bank_name, "bank_url" => $this->bank_url, "currency_name" => $this->currency_name );
}
return $rates;

}

/**
* Возвращает url адрес для получения xml
* @param unknown_type $date
*/
public function getUrl($date="")
{

if(strlen($date)>1)
{
$url=$this->url.$date.'.xml';
}
else
{
$date = date("d.m.Y");
$url=$this->url.$date.'.xml';
}
return $url;
}
}
?>

в mod_jextcurrency.xml в секцию source_class добавить

<option value="az">Банк Азербайджана</option>

Share this post


Link to post
Share on other sites

Здравствуйте!

Несколько дней чтото не парсятся курсы валют. Не могли бы подсказать в чем проблема?

Чингиз.

Share this post


Link to post
Share on other sites

поменяйте


$data = $xml->document->ValType[0]->Valute

на


$data = $xml->document->ValType[1]->Valute

и почистите кеш

Share this post


Link to post
Share on other sites

Чтото у меня опять ошибочка выходит. Не подскажите в чем проблемка?

А вот и та самая ошибочка:

Warning: Invalid argument supplied for foreach() in ...\modules\mod_jextcurrency\classes\currency.class.php on line 153

Warning: Invalid argument supplied for foreach() in ...\modules\mod_jextcurrency\tmpl\default.php on line 23

Чингиз.

Edited by china630

Share this post


Link to post
Share on other sites

теперь надо наоборот поменять, я не знаю чего они их меняют местами

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...