Osicommerce Forum » Osicommerce Forum

Çoklu Para Birimi

(7 posts)
  • organic tarafından 10 ay önce başlatıldı.
  • phphp tarafından Son cevaplar
  1. organic
    Üye

    Revize sistemde kullandığınız Çoklu para birimi modülünü manuel olarak bizimle paylaşırmısınız..

    10 ay önce gönderildi. #
  2. admin
    Başkan

    "Manual olarak" derken osCommerce Modülü olarak hazırlanmış adım adım kurulum açıklama versiyonunu mu kastediyorsun?

    10 ay önce gönderildi. #
  3. organic
    Üye

    evet

    10 ay önce gönderildi. #
  4. admin
    Başkan

    osCommerce Çoklu Para birimi kullanımı için özet kurulum açıklaması;

    !!Kurmadan önce mutlaka yedek alın!!
    !!Kurmadan önce madde 6'yı okuyun!!
    1 - aşağıdaki sorguyu phpMyadmin ile çalıştır(veya eşdeğer bir programla)

    ALTER TABLE 'products' ADD 'products_currency' VARCHAR( 32 ) NOT NULL ;
    ALTER TABLE 'orders_products' ADD 'products_currency' VARCHAR( 32 ) NOT NULL;
    ALTER TABLE 'currencies' CHANGE 'code' 'code' VARCHAR( 32 ) NOT NULL ;

    2- catalog/admin/includes/application_top.php dosyasını aç

    aşağıdaki satırları

    define('CURRENCY_SERVER_PRIMARY', 'oanda');
    define('CURRENCY_SERVER_BACKUP', 'xe');

    şu satırlarla değiştir

    define('CURRENCY_SERVER_PRIMARY', 'tcmb');
    define('CURRENCY_SERVER_BACKUP', 'oanda');
    define('CURRENCY_SERVER_BACKUP2', 'xe');

    3- catalog/admin/includes/functions/localization.php dosyasının tamamını aşağıdaki ile değiştir

    <?php
    /*
      $Id: localization.php 1739 2007-12-20 00:52:16Z hpdl $
    
      osCommerce, Open Source E-Commerce Solutions
      http://www.oscommerce.com
    
      Copyright (c) 2003 osCommerce
    
      Released under the GNU General Public License
    */
    
      function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
        $page = file('http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code .  '&format=CSV&dest=Get+Table&sel_list=' . $base);
    
        $match = array();
    
        preg_match('/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i', implode('', $page), $match);
    
        if (sizeof($match) > 0) {
          return $match[3];
        } else {
          return false;
        }
      }
    
      function quote_xe_currency($to, $from = DEFAULT_CURRENCY) {
        $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);
    
        $match = array();
    
        preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', implode('', $page), $match);
    
        if (sizeof($match) > 0) {
          return $match[1];
        } else {
          return false;
        }
      }
    
     function quote_tcmb_currency($to, $from = DEFAULT_CURRENCY) {
    
        switch($to){
        case 'USD':
        $to = 'US DOLLAR';
        break;
    
        case 'EUR':
        $to = 'EURO';
        break;
    
        case 'GBP':
        $to = 'POUND STERLING';
        break;
    
        case 'JPY':
        $to = 'YEN';
        break;
    
        case 'CAD':
        $to = 'CANADIAN DOLLAR';
        break;
    
        case 'CHF':
        $to = 'SWISS FRANK';
        break;
    
        case 'AUD':
        $to = 'AUSTRALIAN DOLL';
        break;
        }
    
        if($to !='TL'){
        $page = file('http://www.tcmb.gov.tr/kurlar/today.xml');
        $element_ilk = '<CurrencyName>'.$to.'</CurrencyName><ForexBuying>';
        $element_son  = '</ForexBuying>';
    
        $kalan = stristr($page[2], $element_ilk);
        $pos = strpos($kalan, $element_son);
        $oran = substr($kalan, strlen($element_ilk), $pos-strlen($element_ilk));
        $b=1;
        $oranw= pow($oran,-1);}else{$oranw=1;}
    
        if($oranw >0) {return "$oranw";}else{return false;}
    
        }
    
    ?>

    4- catalog/admin/includes/classes/currencies.php dosyasının içeriğini aşağıdaki ile değiştir:

    <?php
    /*
      $Id: currencies.php 1739 2007-12-20 00:52:16Z hpdl $
    
      osCommerce, Open Source E-Commerce Solutions
      http://www.oscommerce.com
    
      Copyright (c) 2007 osCommerce
    
      Released under the GNU General Public License
    */
    
    ////
    // Class to handle currencies
    // TABLES: currencies
      class currencies {
        var $currencies;
    
    // class constructor
        function currencies() {
          $this->currencies = array();
          $currencies_query = tep_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES);
          while ($currencies = tep_db_fetch_array($currencies_query)) {
    	    $this->currencies[$currencies['code']] = array('title' => $currencies['title'],
                                                           'symbol_left' => $currencies['symbol_left'],
                                                           'symbol_right' => $currencies['symbol_right'],
                                                           'decimal_point' => $currencies['decimal_point'],
                                                           'thousands_point' => $currencies['thousands_point'],
                                                           'decimal_places' => $currencies['decimal_places'],
                                                           'value' => $currencies['value']);
          }
        }
    
    // class methods
        function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') {
          if ($calculate_currency_value) {
            $rate = ($currency_value) ? $currency_value : $this->currencies[$currency_type]['value'];
            $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number * $rate, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
    // if the selected currency is in the european euro-conversion and the default currency is euro,
    // the currency will displayed in the national currency and euro currency
            if ( (DEFAULT_CURRENCY == 'EUR') && ($currency_type == 'DEM' || $currency_type == 'BEF' || $currency_type == 'LUF' || $currency_type == 'ESP' || $currency_type == 'FRF' || $currency_type == 'IEP' || $currency_type == 'ITL' || $currency_type == 'NLG' || $currency_type == 'ATS' || $currency_type == 'PTE' || $currency_type == 'FIM' || $currency_type == 'GRD') ) {
              $format_string .= ' <small>[' . $this->format($number, true, 'EUR') . ']</small>';
            }
          } else {
            $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
          }
    
          return $format_string;
        }
    
        function get_value($code) {
          return $this->currencies[$code]['value'];
        }
    
        function display_price($products_price, $products_tax, $quantity = 1, $currency_type = DEFAULT_CURRENCY) {
          return $this->format(tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$currency_type]['decimal_places']) * $quantity);
        }
      }
    ?>

    5- catalog/includes/classes/currencies.php dosyasının içeriğini aşağıdaki ile değiştir:

    <?php
    /*
      $Id: currencies.php 1803 2008-01-11 18:16:37Z hpdl $
    
      osCommerce, Open Source E-Commerce Solutions
      http://www.oscommerce.com
    
      Copyright (c) 2008 osCommerce
    
      Released under the GNU General Public License
    */
    
    ////
    // Class to handle currencies
    // TABLES: currencies
      class currencies {
        var $currencies;
    
    // class constructor
        function currencies() {
          $this->currencies = array();
          $currencies_query = tep_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES);
          while ($currencies = tep_db_fetch_array($currencies_query)) {
            $this->currencies[$currencies['code']] = array('title' => $currencies['title'],
                                                           'symbol_left' => $currencies['symbol_left'],
                                                           'symbol_right' => $currencies['symbol_right'],
                                                           'decimal_point' => $currencies['decimal_point'],
                                                           'thousands_point' => $currencies['thousands_point'],
                                                           'decimal_places' => $currencies['decimal_places'],
                                                           'value' => $currencies['value']);
          }
        }
    
    // class methods
        function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') {
          global $currency;
    
          if (empty($currency_type)) $currency_type = $currency;
    
          if ($calculate_currency_value == true) {
            $rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value'];
            $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
          } else {
            $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
          }
    
          return $format_string;
        }
    
        function calculate_price($products_currency,$products_price, $products_tax, $quantity = 1) {
          global $currency;
    
          //return tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$currency]['decimal_places']) * $quantity;
          $products_price = pow($this->currencies[$products_currency]['value'],-1)*$products_price;
          return tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$products_currency]['decimal_places']) * $quantity;
    
        }
    
        function is_set($code) {
          if (isset($this->currencies[$code]) && tep_not_null($this->currencies[$code])) {
            return true;
          } else {
            return false;
          }
        }
    
        function get_value($code) {
          return $this->currencies[$code]['value'];
        }
    
        function get_decimal_places($code) {
          return $this->currencies[$code]['decimal_places'];
        }
    
        function display_price($products_currency, $products_price, $products_tax, $quantity = 1) {
          return $this->format($this->calculate_price($products_currency,$products_price, $products_tax, $quantity));
        }
      }
    ?>

    6- Her $currencies->display_price geçen sayfada aşağıda örnek (products_new.php yeni ürünler sayfası) olarak anlatılan açıklamaları uygula

    aşağıdaki satırı bul;

    $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price,

    virgülden sonra aşağıdaki ifadeyi ekle

    p.products_currency,

    aşağıdaki satırı bul

    $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']))

    şununla değiştir (bu adımda parantez arasına $products_new['products_currency'], şeklinde ek parametre eklemiş olduk)

    $currencies->display_price($products_new['products_currency'], $products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']))
    10 ay önce gönderildi. #
  5. phphp
    Üye

    ben revize sistemin üzerine Star Product modülünü kurdum fakat anasayfa gösteremedim acaba star_product.php dosyasını editleyip burada bizimle paylaşırmısınız sizinde dediğiniz gibi
    $currencies->display_price satırlarında gerekli değişikliği yaptım.. ayrıca
    p.products_currency, bu ifadeyide ekledim fakat 1054 hatası verdi...
    sizden ricam star_product.php dosyasını editlenişini bizimle paylaşırmısınız..

    http://rapidshare.com/files/318961829/star_product.php.html

    9 ay önce gönderildi. #
  6. admin
    Başkan

    1054 hatası veritabanında olması gereken bir kolon olmadığında oluşur, belki star products modülünün sql komutları tam kurulmamış olabilir.

    9 ay önce gönderildi. #
  7. phphp
    Üye

    ekte verdiğim dosyayı editleyebilirmisiniz ?

    8 ay önce gönderildi. #

Bu konu için RSS beslemesi

Cevapla

Mesaj göndermek için giriş yapmalısınız