WooCommerce Multilingual – run WooCommerce with WPML - Version 2.2

Version Description

Download this release

Release Info

Developer dgwatkins
Plugin Icon 128x128 WooCommerce Multilingual – run WooCommerce with WPML
Version 2.2
Comparing to
See all releases

Code changes from version 2.0 to 2.2

Files changed (3) hide show
  1. readme.txt +1 -1
  2. woocommerce_wpml.class.php +34 -16
  3. wpml-woocommerce.php +2 -2
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multili
5
  License: GPLv2
6
  Requires at least: 3.0
7
  Tested up to: 3.5
8
- Stable tag: 2.0
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
5
  License: GPLv2
6
  Requires at least: 3.0
7
  Tested up to: 3.5
8
+ Stable tag: 2.2
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
woocommerce_wpml.class.php CHANGED
@@ -78,6 +78,7 @@ class woocommerce_wpml {
78
  add_filter('woocommerce_json_search_found_products', array($this, 'search_products'));
79
  add_filter('woocommerce_currency', array($this, 'set_ml_currency'));
80
  add_action('admin_print_scripts', array($this,'js_scripts_setup'), 11);
 
81
  add_action('init', array($this, 'translate_email_notifications'));
82
 
83
  // Slug translation
@@ -829,25 +830,25 @@ class woocommerce_wpml {
829
  return $currency_symbol;
830
  }
831
 
832
- /**
833
- * Filters the product price.
834
- */
835
- function woocommerce_price($price){
836
- global $sitepress, $wpdb;
837
 
838
- if (get_option('icl_enable_multi_currency') != 'yes') {
839
- $sql = "SELECT value FROM ". $wpdb->prefix ."icl_currencies WHERE language_code = '". $sitepress->get_current_language() ."'";
840
- $currency = $wpdb->get_results($sql, OBJECT);
841
-
842
- if($currency){
843
- $exchange_rate = $currency[0]->value;
844
- $price = round($price * $exchange_rate, (int) get_option( 'woocommerce_price_num_decimals' ));
845
- $price = apply_filters('woocommerce_multilingual_price', $price);
846
- }
847
  }
848
 
849
- return $price;
850
- }
851
 
852
  /**
853
  * Translates WooCommerce emails.
@@ -1483,6 +1484,23 @@ class woocommerce_wpml {
1483
  <?php
1484
  }
1485
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1486
 
1487
  /**
1488
  * WooCommerce Multilingual deactivation hook.
78
  add_filter('woocommerce_json_search_found_products', array($this, 'search_products'));
79
  add_filter('woocommerce_currency', array($this, 'set_ml_currency'));
80
  add_action('admin_print_scripts', array($this,'js_scripts_setup'), 11);
81
+ add_action('wp_head', array($this, 'refresh_cart'));
82
  add_action('init', array($this, 'translate_email_notifications'));
83
 
84
  // Slug translation
830
  return $currency_symbol;
831
  }
832
 
833
+ /**
834
+ * Filters the product price.
835
+ */
836
+ function woocommerce_price($price){
837
+ global $sitepress, $wpdb;
838
 
839
+ if (get_option('icl_enable_multi_currency') == 'yes') {
840
+ $sql = "SELECT value FROM ". $wpdb->prefix ."icl_currencies WHERE language_code = '". $sitepress->get_current_language() ."'";
841
+ $currency = $wpdb->get_results($sql, OBJECT);
842
+
843
+ if($currency){
844
+ $exchange_rate = $currency[0]->value;
845
+ $price = round($price * $exchange_rate, (int) get_option( 'woocommerce_price_num_decimals' ));
846
+ $price = apply_filters('woocommerce_multilingual_price', $price);
847
+ }
848
  }
849
 
850
+ return $price;
851
+ }
852
 
853
  /**
854
  * Translates WooCommerce emails.
1484
  <?php
1485
  }
1486
  }
1487
+
1488
+ function refresh_cart() {
1489
+ ?>
1490
+ <script type="text/javascript">
1491
+ jQuery(document).ready(function($) {
1492
+ if ( $( '.widget_shopping_cart_content' ) ) {
1493
+ setTimeout(function() {
1494
+ if ($.cookie('wcml-previous-language') != '<?php echo ICL_LANGUAGE_CODE ?>') {
1495
+ $.cookie('wcml-previous-language', '<?php echo ICL_LANGUAGE_CODE ?>');
1496
+ $.ajax( $fragment_refresh );
1497
+ }
1498
+ }, 0);
1499
+ }
1500
+ });
1501
+ </script>
1502
+ <?php
1503
+ }
1504
 
1505
  /**
1506
  * WooCommerce Multilingual deactivation hook.
wpml-woocommerce.php CHANGED
@@ -5,11 +5,11 @@
5
  Description: Allows running fully multilingual e-Commerce sites with WooCommerce and WPML. <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/">Documentation</a>.
6
  Author: ICanLocalize
7
  Author URI: http://wpml.org/
8
- Version: 2.0
9
  */
10
 
11
  if(defined('WCML_VERSION')) return;
12
- define('WCML_VERSION', '2.0');
13
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
14
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
15
  define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);
5
  Description: Allows running fully multilingual e-Commerce sites with WooCommerce and WPML. <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/">Documentation</a>.
6
  Author: ICanLocalize
7
  Author URI: http://wpml.org/
8
+ Version: 2.2
9
  */
10
 
11
  if(defined('WCML_VERSION')) return;
12
+ define('WCML_VERSION', '2.2');
13
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
14
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
15
  define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);