Plugin Directory

Changeset 541155


Ignore:
Timestamp:
05/08/2012 04:37:40 AM (14 years ago)
Author:
beshkin
Message:

tagging version 0.6.2

Location:
e-commerce-multi-currency-support
Files:
3 edited
6 copied

Legend:

Unmodified
Added
Removed
  • e-commerce-multi-currency-support/tags/0.6.2/readme.txt

    r540820 r541155  
    44Requires at least: 2.9
    55Tested up to: 3.1.1
    6 Stable tag: 0.6.1
     6Stable tag: 0.6.2
    77
    88
     
    1717
    1818== Changelog ==
     19= 0.6.2 =
     20- fixed defaulting to incorrect country in drop-down list.
    1921= 0.6.1 =
    2022- fixed issue with source price bigger than 1000
  • e-commerce-multi-currency-support/tags/0.6.2/widgets/currency_chooser_widget.php

    r525847 r541155  
    2424        //Display Currency Info:
    2525        $sql ="SELECT * FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `visible`='1' ORDER BY `country` ASC";
    26         //echo $_SESSION['wpsc_base_currency_code'];
     26        //echo $_SESSION['wpsc_base_currency_isocode'];
    2727        $countries = $wpdb->get_results($sql, ARRAY_A);
    2828        $output .= '<form method="post" action="" id="wpsc-mcs-widget-form">';
     
    3030        if (!isset($_SESSION['wpsc_base_currency_code']))
    3131        {
    32             $currency_code = $wpdb->get_results("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
     32            $currency_code = $wpdb->get_results("SELECT `code`,`isocode` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
    3333            $local_currency_code = $currency_code[0]['code'];
     34            $local_currency_isocode = $currency_code[0]['isocode'];
    3435        }else{
    3536            $local_currency_code=$_SESSION['wpsc_base_currency_code'];
     
    3940                if ($instance['show_code'] == 1) $country_code =" (".$country['code'].")";
    4041                $selected_code = '';
    41                 if($_SESSION['wpsc_currency_code'] == $country['id']){
     42                if($_SESSION['wpsc_base_currency_isocode'] == $country['isocode']){
    4243                    $selected_code = "selected='selected'";
    4344
    4445                }else {
    45                     if ( !isset($_SESSION['wpsc_currency_code']) && $local_currency_code == $country['code'])
     46                    if ( !isset($_SESSION['wpsc_base_currency_isocode']) && $local_currency_isocode == $country['isocode'])
    4647                        $selected_code = "selected='selected'";
    4748                }
  • e-commerce-multi-currency-support/tags/0.6.2/wpsc-currency-changer.php

    r540820 r541155  
    44Plugin URI: http://misha.beshkin.lv
    55Description: A plugin that provides a currency converter tool integrated into the WordPress Shopping Cart. This is trunk from wp-e-commerce-multi-currency-magic plugin.
    6 Version: 0.6.1
     6Version: 0.6.2
    77Author: Misha Beshkin
    88Author URI: http://misha.beshkin.lv
     
    3030
    3131// Get currency settings
    32     $currency_code = $wpdb->get_results("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
     32    $currency_code = $wpdb->get_results("SELECT `code`,`isocode` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
    3333
    3434    $local_currency_code = $currency_code[0]['code'];
     35    $local_currency_isocode = $currency_code[0]['isocode'];
    3536    $_SESSION['wpsc_base_currency_code'] = $local_currency_code;
     37    $_SESSION['wpsc_base_currency_isocode'] = $local_currency_isocode;
    3638    if(!isset($_POST['reset'])){
    37         $foreign_currency_code = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".$_POST['currency_option']."' LIMIT 1");
    38         $_SESSION['wpsc_currency_code'] =$_POST['currency_option'];
    39         $wpsc_cart->selected_currency_code = $foreign_currency_code;
     39        $currency_code = $wpdb->get_results("SELECT `code`,`isocode` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".$_POST['currency_option']."' LIMIT 1",ARRAY_A);
     40        //$foreign_currency_code = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".$_POST['currency_option']."' LIMIT 1");
     41        $foreign_currency_code = $currency_code[0]['code'];
     42        $foreign_currency_isocode = $currency_code[0]['isocode'];
     43        $wpsc_cart->selected_currency_code = $foreign_currency_code;
     44        $_SESSION['wpsc_base_currency_isocode'] = $foreign_currency_isocode;
     45        $wpsc_cart->selected_currency_isocode = $foreign_currency_isocode;
    4046    }else{
    4147        $_SESSION['wpsc_currency_code'] =get_option('currency_type');
    4248        $wpsc_cart->selected_currency_code = $local_currency_code;
     49        $_SESSION['wpsc_base_currency_isocode'] = $local_currency_isocode;
    4350        $foreign_currency_code = $local_currency_code;
    4451    }
     
    136143 */
    137144function wpsc_add_currency_code($total){
    138     global $wpsc_cart;
     145    global $wpsc_cart, $wpdb, $wpsc_query;
    139146       if ($wpsc_cart->selected_currency_code != '')
    140147        {
     
    147154                $total1 = preg_replace('/\&\#(036|8364)\;/','',$total1);
    148155            }
     156
    149157        $total_proto = trim(preg_replace("/([^0-9\\.,])/i", "",$total1));
    150     $totalpre1 = trim(preg_replace("/([^0-9\\.])/i", "",$total1));
    151     $totalpre = (float)$totalpre1;
    152 
    153     $total_converted =  number_format($totalpre * $wpsc_cart->currency_conversion, 2, '.', '');
    154     $total = preg_replace('/([A-Z]{3}|[$€£]|\&\#(036|8364)\;)/', $wpsc_cart->selected_currency_code, $total);
    155     $total = str_replace($total_proto, $total_converted , $total);
    156 //exit('<pre>'.$total.'</pre>');
     158        $totalpre1 = trim(preg_replace("/([^0-9\\.])/i", "",$total1));
     159        $totalpre = (float)$totalpre1;
     160
     161        $results = get_product_meta(get_the_ID(),'currency',true);
     162        if ( count( $results ) > 0 ) {
     163            foreach ( (array)$results as $isocode => $curr ) {
     164                if ($isocode == $wpsc_cart->selected_currency_isocode)
     165                {
     166                    //$totalpre = $curr;
     167                    break;
     168                }
     169            }
     170        }
     171
     172        $total_converted =  number_format($totalpre * $wpsc_cart->currency_conversion, 2, '.', '');
     173        $total = preg_replace('/([A-Z]{3}|[$€£]|\&\#(036|8364)\;)/', $wpsc_cart->selected_currency_code, $total);
     174        $total = str_replace($total_proto, $total_converted , $total);
     175//exit('<pre>'.$totalpre.'</pre>');
    157176
    158177           }
  • e-commerce-multi-currency-support/trunk/readme.txt

    r540820 r541155  
    44Requires at least: 2.9
    55Tested up to: 3.1.1
    6 Stable tag: 0.6.1
     6Stable tag: 0.6.2
    77
    88
     
    1717
    1818== Changelog ==
     19= 0.6.2 =
     20- fixed defaulting to incorrect country in drop-down list.
    1921= 0.6.1 =
    2022- fixed issue with source price bigger than 1000
  • e-commerce-multi-currency-support/trunk/widgets/currency_chooser_widget.php

    r525847 r541155  
    2424        //Display Currency Info:
    2525        $sql ="SELECT * FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `visible`='1' ORDER BY `country` ASC";
    26         //echo $_SESSION['wpsc_base_currency_code'];
     26        //echo $_SESSION['wpsc_base_currency_isocode'];
    2727        $countries = $wpdb->get_results($sql, ARRAY_A);
    2828        $output .= '<form method="post" action="" id="wpsc-mcs-widget-form">';
     
    3030        if (!isset($_SESSION['wpsc_base_currency_code']))
    3131        {
    32             $currency_code = $wpdb->get_results("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
     32            $currency_code = $wpdb->get_results("SELECT `code`,`isocode` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
    3333            $local_currency_code = $currency_code[0]['code'];
     34            $local_currency_isocode = $currency_code[0]['isocode'];
    3435        }else{
    3536            $local_currency_code=$_SESSION['wpsc_base_currency_code'];
     
    3940                if ($instance['show_code'] == 1) $country_code =" (".$country['code'].")";
    4041                $selected_code = '';
    41                 if($_SESSION['wpsc_currency_code'] == $country['id']){
     42                if($_SESSION['wpsc_base_currency_isocode'] == $country['isocode']){
    4243                    $selected_code = "selected='selected'";
    4344
    4445                }else {
    45                     if ( !isset($_SESSION['wpsc_currency_code']) && $local_currency_code == $country['code'])
     46                    if ( !isset($_SESSION['wpsc_base_currency_isocode']) && $local_currency_isocode == $country['isocode'])
    4647                        $selected_code = "selected='selected'";
    4748                }
  • e-commerce-multi-currency-support/trunk/wpsc-currency-changer.php

    r540820 r541155  
    44Plugin URI: http://misha.beshkin.lv
    55Description: A plugin that provides a currency converter tool integrated into the WordPress Shopping Cart. This is trunk from wp-e-commerce-multi-currency-magic plugin.
    6 Version: 0.6.1
     6Version: 0.6.2
    77Author: Misha Beshkin
    88Author URI: http://misha.beshkin.lv
     
    3030
    3131// Get currency settings
    32     $currency_code = $wpdb->get_results("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
     32    $currency_code = $wpdb->get_results("SELECT `code`,`isocode` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A);
    3333
    3434    $local_currency_code = $currency_code[0]['code'];
     35    $local_currency_isocode = $currency_code[0]['isocode'];
    3536    $_SESSION['wpsc_base_currency_code'] = $local_currency_code;
     37    $_SESSION['wpsc_base_currency_isocode'] = $local_currency_isocode;
    3638    if(!isset($_POST['reset'])){
    37         $foreign_currency_code = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".$_POST['currency_option']."' LIMIT 1");
    38         $_SESSION['wpsc_currency_code'] =$_POST['currency_option'];
    39         $wpsc_cart->selected_currency_code = $foreign_currency_code;
     39        $currency_code = $wpdb->get_results("SELECT `code`,`isocode` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".$_POST['currency_option']."' LIMIT 1",ARRAY_A);
     40        //$foreign_currency_code = $wpdb->get_var("SELECT `code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".$_POST['currency_option']."' LIMIT 1");
     41        $foreign_currency_code = $currency_code[0]['code'];
     42        $foreign_currency_isocode = $currency_code[0]['isocode'];
     43        $wpsc_cart->selected_currency_code = $foreign_currency_code;
     44        $_SESSION['wpsc_base_currency_isocode'] = $foreign_currency_isocode;
     45        $wpsc_cart->selected_currency_isocode = $foreign_currency_isocode;
    4046    }else{
    4147        $_SESSION['wpsc_currency_code'] =get_option('currency_type');
    4248        $wpsc_cart->selected_currency_code = $local_currency_code;
     49        $_SESSION['wpsc_base_currency_isocode'] = $local_currency_isocode;
    4350        $foreign_currency_code = $local_currency_code;
    4451    }
     
    136143 */
    137144function wpsc_add_currency_code($total){
    138     global $wpsc_cart;
     145    global $wpsc_cart, $wpdb, $wpsc_query;
    139146       if ($wpsc_cart->selected_currency_code != '')
    140147        {
     
    147154                $total1 = preg_replace('/\&\#(036|8364)\;/','',$total1);
    148155            }
     156
    149157        $total_proto = trim(preg_replace("/([^0-9\\.,])/i", "",$total1));
    150     $totalpre1 = trim(preg_replace("/([^0-9\\.])/i", "",$total1));
    151     $totalpre = (float)$totalpre1;
    152 
    153     $total_converted =  number_format($totalpre * $wpsc_cart->currency_conversion, 2, '.', '');
    154     $total = preg_replace('/([A-Z]{3}|[$€£]|\&\#(036|8364)\;)/', $wpsc_cart->selected_currency_code, $total);
    155     $total = str_replace($total_proto, $total_converted , $total);
    156 //exit('<pre>'.$total.'</pre>');
     158        $totalpre1 = trim(preg_replace("/([^0-9\\.])/i", "",$total1));
     159        $totalpre = (float)$totalpre1;
     160
     161        $results = get_product_meta(get_the_ID(),'currency',true);
     162        if ( count( $results ) > 0 ) {
     163            foreach ( (array)$results as $isocode => $curr ) {
     164                if ($isocode == $wpsc_cart->selected_currency_isocode)
     165                {
     166                    //$totalpre = $curr;
     167                    break;
     168                }
     169            }
     170        }
     171
     172        $total_converted =  number_format($totalpre * $wpsc_cart->currency_conversion, 2, '.', '');
     173        $total = preg_replace('/([A-Z]{3}|[$€£]|\&\#(036|8364)\;)/', $wpsc_cart->selected_currency_code, $total);
     174        $total = str_replace($total_proto, $total_converted , $total);
     175//exit('<pre>'.$totalpre.'</pre>');
    157176
    158177           }
Note: See TracChangeset for help on using the changeset viewer.