wmaraci reklam

Opencart 3.0.2 Kullanıyorum Ama Kurları Otomatik Güncellemiyor!

4 Mesajlar 1.398 Okunma
pst.net
wmaraci reklam

stiltasarim stiltasarim Üni Hakkında - Üniversite Kullanıcı
  • Üyelik 06.04.2013
  • Yaş/Cinsiyet 26 / E
  • Meslek Bilgisayar Mühendisi - Öğrenci
  • Konum İstanbul Avrupa
  • Ad Soyad A** Ç**
  • Mesajlar 1370
  • Beğeniler 194 / 204
  • Ticaret 18, (%100)
Merhaba Arkadaşlar;

Opencart 3.0.2 versiyonunu kullanıyorum ama otomatik olarak döviz kurlarını güncellemiyor. Bu sorunu daha öncesinde yaşayan bir arkadaş var mı? Veya bu sorunu nasıl çözebileceğimi bilen bir arkadaş var mı?
 

 

wmaraci
reklam

selvi11 selvi11 WM Aracı Kullanıcı
  • Üyelik 25.09.2018
  • Yaş/Cinsiyet 43 / E
  • Meslek tasarımcıyım
  • Konum Bilecik
  • Ad Soyad I** S**
  • Mesajlar 7
  • Beğeniler 0 / 1
  • Ticaret 0, (%0)
admin/model/localisation/currency.php


dosyasının değiştirmen gerekir opencart orjinal sürümde yahoo üzerinden güncelleme yapar


dosyanın içeriğini bu kodalar ile değiştirmeni öneririm

class ModelLocalisationCurrency extends Model {
public function addCurrency($data) {
$this->db->query("INSERT INTO " . DB_PREFIX . "currency SET title = '" . $this->db->escape($data['title']) . "', code = '" . $this->db->escape($data['code']) . "', symbol_left = '" . $this->db->escape($data['symbol_left']) . "', symbol_right = '" . $this->db->escape($data['symbol_right']) . "', decimal_place = '" . $this->db->escape($data['decimal_place']) . "', value = '" . $this->db->escape($data['value']) . "', status = '" . (int)$data['status'] . "', date_modified = NOW()");

$currency_id = $this->db->getLastId();

if ($this->config->get('config_currency_auto')) {
$this->refresh(true);
}

$this->cache->delete('currency');

return $currency_id;
}

public function editCurrency($currency_id, $data) {
$this->db->query("UPDATE " . DB_PREFIX . "currency SET title = '" . $this->db->escape($data['title']) . "', code = '" . $this->db->escape($data['code']) . "', symbol_left = '" . $this->db->escape($data['symbol_left']) . "', symbol_right = '" . $this->db->escape($data['symbol_right']) . "', decimal_place = '" . $this->db->escape($data['decimal_place']) . "', value = '" . $this->db->escape($data['value']) . "', status = '" . (int)$data['status'] . "', date_modified = NOW() WHERE currency_id = '" . (int)$currency_id . "'");

$this->cache->delete('currency');
}

public function deleteCurrency($currency_id) {
$this->db->query("DELETE FROM " . DB_PREFIX . "currency WHERE currency_id = '" . (int)$currency_id . "'");

$this->cache->delete('currency');
}

public function getCurrency($currency_id) {
$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "currency WHERE currency_id = '" . (int)$currency_id . "'");

return $query->row;
}

public function getCurrencyByCode($currency) {
$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "currency WHERE code = '" . $this->db->escape($currency) . "'");

return $query->row;
}

public function getCurrencies($data = array()) {
if ($data) {
$sql = "SELECT * FROM " . DB_PREFIX . "currency";

$sort_data = array(
'title',
'code',
'value',
'date_modified'
);

if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY title";
}

if (isset($data['order']) && ($data['order'] == 'DESC')) {
$sql .= " DESC";
} else {
$sql .= " ASC";
}

if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
}

if ($data['limit'] < 1) {
$data['limit'] = 20;
}

$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
}

$query = $this->db->query($sql);

return $query->rows;
} else {
$currency_data = $this->cache->get('currency');

if (!$currency_data) {
$currency_data = array();

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency ORDER BY title ASC");

foreach ($query->rows as $result) {
$currency_data[$result['code']] = array(
'currency_id' => $result['currency_id'],
'title' => $result['title'],
'code' => $result['code'],
'symbol_left' => $result['symbol_left'],
'symbol_right' => $result['symbol_right'],
'decimal_place' => $result['decimal_place'],
'value' => $result['value'],
'status' => $result['status'],
'date_modified' => $result['date_modified']
);
}

$this->cache->set('currency', $currency_data);
}

return $currency_data;
}
}

public function refresh($force = false) {
$currency_data = array();

if ($force) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "'");
} else {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "' AND date_modified < '" . $this->db->escape(date('Y-m-d H:i:s', strtotime('-1 day'))) . "'");
}

foreach ($query->rows as $result) {
$currency_data[] = $this->config->get('config_currency') . $result['code'] . '=X';
$currency_data[] = $result['code'] . $this->config->get('config_currency') . '=X';
}

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, 'https://www.tcmb.gov.tr/kurlar/today.xml');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$contents = curl_exec($curl);

curl_close($curl);
$content = simplexml_load_string($contents);

foreach ($query->rows as $result) {
$currency = $result['code'];
$value_search = $content->xpath("Currency[@Kod='$currency']");
if (!empty($value_search)){$value=$value_search[0]->ForexSelling;}
if ((float)$value) {
$this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (float)$value . "', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($currency) . "'");
}
}

$this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '1.00000', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($this->config->get('config_currency')) . "'");

$this->cache->delete('currency');
}

public function getTotalCurrencies() {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "currency");

return $query->row['total'];
}
}
 

 

selvi11 selvi11 WM Aracı Kullanıcı
  • Üyelik 25.09.2018
  • Yaş/Cinsiyet 43 / E
  • Meslek tasarımcıyım
  • Konum Bilecik
  • Ad Soyad I** S**
  • Mesajlar 7
  • Beğeniler 0 / 1
  • Ticaret 0, (%0)
class ModelLocalisationCurrency extends Model {
public function addCurrency($data) {
$this->db->query("INSERT INTO " . DB_PREFIX . "currency SET title = '" . $this->db->escape($data['title']) . "', code = '" . $this->db->escape($data['code']) . "', symbol_left = '" . $this->db->escape($data['symbol_left']) . "', symbol_right = '" . $this->db->escape($data['symbol_right']) . "', decimal_place = '" . $this->db->escape($data['decimal_place']) . "', value = '" . $this->db->escape($data['value']) . "', status = '" . (int)$data['status'] . "', date_modified = NOW()");

$currency_id = $this->db->getLastId();

if ($this->config->get('config_currency_auto')) {
$this->refresh(true);
}

$this->cache->delete('currency');

return $currency_id;
}

public function editCurrency($currency_id, $data) {
$this->db->query("UPDATE " . DB_PREFIX . "currency SET title = '" . $this->db->escape($data['title']) . "', code = '" . $this->db->escape($data['code']) . "', symbol_left = '" . $this->db->escape($data['symbol_left']) . "', symbol_right = '" . $this->db->escape($data['symbol_right']) . "', decimal_place = '" . $this->db->escape($data['decimal_place']) . "', value = '" . $this->db->escape($data['value']) . "', status = '" . (int)$data['status'] . "', date_modified = NOW() WHERE currency_id = '" . (int)$currency_id . "'");

$this->cache->delete('currency');
}

public function deleteCurrency($currency_id) {
$this->db->query("DELETE FROM " . DB_PREFIX . "currency WHERE currency_id = '" . (int)$currency_id . "'");

$this->cache->delete('currency');
}

public function getCurrency($currency_id) {
$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "currency WHERE currency_id = '" . (int)$currency_id . "'");

return $query->row;
}

public function getCurrencyByCode($currency) {
$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "currency WHERE code = '" . $this->db->escape($currency) . "'");

return $query->row;
}

public function getCurrencies($data = array()) {
if ($data) {
$sql = "SELECT * FROM " . DB_PREFIX . "currency";

$sort_data = array(
'title',
'code',
'value',
'date_modified'
);

if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY title";
}

if (isset($data['order']) && ($data['order'] == 'DESC')) {
$sql .= " DESC";
} else {
$sql .= " ASC";
}

if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
}

if ($data['limit'] < 1) {
$data['limit'] = 20;
}

$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
}

$query = $this->db->query($sql);

return $query->rows;
} else {
$currency_data = $this->cache->get('currency');

if (!$currency_data) {
$currency_data = array();

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency ORDER BY title ASC");

foreach ($query->rows as $result) {
$currency_data[$result['code']] = array(
'currency_id' => $result['currency_id'],
'title' => $result['title'],
'code' => $result['code'],
'symbol_left' => $result['symbol_left'],
'symbol_right' => $result['symbol_right'],
'decimal_place' => $result['decimal_place'],
'value' => $result['value'],
'status' => $result['status'],
'date_modified' => $result['date_modified']
);
}

$this->cache->set('currency', $currency_data);
}

return $currency_data;
}
}

public function refresh($force = false) {
$currency_data = array();

if ($force) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "'");
} else {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "' AND date_modified < '" . $this->db->escape(date('Y-m-d H:i:s', strtotime('-1 day'))) . "'");
}

foreach ($query->rows as $result) {
$currency_data[] = $this->config->get('config_currency') . $result['code'] . '=X';
$currency_data[] = $result['code'] . $this->config->get('config_currency') . '=X';
}

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, 'https://www.tcmb.gov.tr/kurlar/today.xml');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$contents = curl_exec($curl);

curl_close($curl);
$content = simplexml_load_string($contents);

foreach ($query->rows as $result) {
$currency = $result['code'];
$value_search = $content->xpath("Currency[@Kod='$currency']");
if (!empty($value_search)){$value=$value_search[0]->ForexSelling;}
if ((float)$value) {
$this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (float)$value . "', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($currency) . "'");
}
}

$this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '1.00000', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($this->config->get('config_currency')) . "'");

$this->cache->delete('currency');
}

public function getTotalCurrencies() {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "currency");

return $query->row['total'];
}
}
 

 

sakaci79 sakaci79 WM Aracı Kullanıcı
  • Üyelik 19.02.2018
  • Yaş/Cinsiyet 45 / E
  • Meslek waterjet
  • Konum Bursa
  • Ad Soyad S** K**
  • Mesajlar 10
  • Beğeniler 0 / 0
  • Ticaret 0, (%0)
kullandım gerçekten işe yarıyor ama şu var 10.12 diye başlıyor 0.10 olması için ne yapabilirim acaba 6 euro luk ürün 0.59 oluyor
 

 

wmaraci
Mersin evden eve nakliyat
wmaraci
Konuyu toplam 1 kişi okuyor. (0 kullanıcı ve 1 misafir)
Site Ayarları
  • Tema Seçeneği
  • Site Sesleri
  • Bildirimler
  • Özel Mesaj Al