WooCommerce Multilingual – run WooCommerce with WPML - Version 3.2.1

Version Description

  • Fixed bug related to product category urls translaiton
  • Fixed bug related to back-compatibility with WooCommerce 2.0.20
Download this release

Release Info

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

Code changes from version 3.2 to 3.2.1

inc/terms.class.php CHANGED
@@ -21,7 +21,7 @@ class WCML_Terms{
21
 
22
  add_filter('option_rewrite_rules', array($this, 'rewrite_rules_filter'), 3, 1); // high priority
23
 
24
- add_filter('term_link', array($this, 'translate_category_base'), 3, 3); // high priority
25
  add_filter('term_link', array($this, 'translate_brand_link'), 10, 3);
26
 
27
  add_filter('get_term', array($this, 'clean_term'), 14, 2);
@@ -207,7 +207,7 @@ class WCML_Terms{
207
  static $no_recursion_flag;
208
 
209
  // handles product categories, product tags and attributes
210
-
211
  $wc_taxonomies = wc_get_attribute_taxonomies();
212
  foreach($wc_taxonomies as $k => $v){
213
  $wc_taxonomies_wc_format[] = 'pa_' . $v->attribute_name;
@@ -218,7 +218,6 @@ class WCML_Terms{
218
  $cache_key = 'termlink#' . $taxonomy .'#' . $term->term_id;
219
  if($link = wp_cache_get($cache_key, 'terms')){
220
  $termlink = $link;
221
-
222
  }else{
223
 
224
  $no_recursion_flag = false;
@@ -229,7 +228,7 @@ class WCML_Terms{
229
  if(!empty($term_language)){
230
 
231
  $permalinks = get_option( 'woocommerce_permalinks' );
232
- $base = $taxonomy == 'product_tag' ? $permalinks['tag_base'] : ($taxonomy == 'category_tag' ? $permalinks['category_base'] : $permalinks['attribute_base']);
233
 
234
  if($base === ''){
235
  // handle exception - default woocommerce category and tag bases used
@@ -259,7 +258,7 @@ class WCML_Terms{
259
  }
260
  }else{
261
 
262
- $string_identifier = $taxonomy == 'product_tag' || $taxonomy == 'product_category' ? $taxonomy : 'attribute';
263
 
264
  if($term_language->language_code != $strings_language){
265
  $base_translated = $wpdb->get_var("
@@ -268,7 +267,7 @@ class WCML_Terms{
268
  JOIN {$wpdb->prefix}icl_string_translations t ON t.string_id = s.id
269
  WHERE s.value='". esc_sql($base)."'
270
  AND s.language = '{$strings_language}'
271
- AND s.name LIKE 'URL {$string_identifier} slug:%'
272
  AND t.language = '{$term_language->language_code}'
273
  ");
274
 
@@ -283,7 +282,7 @@ class WCML_Terms{
283
  $wp_rewrite->extra_permastructs[$taxonomy]['struct'] = str_replace($base, $base_translated, $wp_rewrite->extra_permastructs[$taxonomy]['struct']);
284
  $no_recursion_flag = true;
285
  $termlink = get_term_link($term, $taxonomy);
286
-
287
  $wp_rewrite->extra_permastructs[$taxonomy]['struct'] = $buff;
288
 
289
  }
@@ -613,27 +612,27 @@ class WCML_Terms{
613
 
614
  if(isset( $attribute_taxonomies_arr ) && in_array($taxonomy, $attribute_taxonomies_arr)){
615
 
616
- $wcml_settings = $woocommerce_wpml->get_settings();
617
 
618
- // get term language
619
- $term_language = $sitepress->get_element_language_details($tt_id, 'tax_' . $taxonomy);
620
 
621
- if($term_language->language_code != $sitepress->get_default_language()){
622
- // get term in the default language
623
- $term_id = icl_object_id($term_id, $taxonomy, false, $sitepress->get_default_language());
624
 
625
- //does it belong to any posts (variations)
626
- $objects = get_objects_in_term($term_id, $taxonomy);
627
 
628
- if(!isset($wcml_settings['variations_needed'][$taxonomy])){
629
- $wcml_settings['variations_needed'][$taxonomy] = 0;
630
- }
631
- $wcml_settings['variations_needed'][$taxonomy] += count($objects);
632
 
633
- $woocommerce_wpml->update_settings($wcml_settings);
634
 
635
- }
636
- }
637
 
638
  }
639
 
21
 
22
  add_filter('option_rewrite_rules', array($this, 'rewrite_rules_filter'), 3, 1); // high priority
23
 
24
+ add_filter('term_link', array($this, 'translate_category_base'), 0, 3); // high priority
25
  add_filter('term_link', array($this, 'translate_brand_link'), 10, 3);
26
 
27
  add_filter('get_term', array($this, 'clean_term'), 14, 2);
207
  static $no_recursion_flag;
208
 
209
  // handles product categories, product tags and attributes
210
+
211
  $wc_taxonomies = wc_get_attribute_taxonomies();
212
  foreach($wc_taxonomies as $k => $v){
213
  $wc_taxonomies_wc_format[] = 'pa_' . $v->attribute_name;
218
  $cache_key = 'termlink#' . $taxonomy .'#' . $term->term_id;
219
  if($link = wp_cache_get($cache_key, 'terms')){
220
  $termlink = $link;
 
221
  }else{
222
 
223
  $no_recursion_flag = false;
228
  if(!empty($term_language)){
229
 
230
  $permalinks = get_option( 'woocommerce_permalinks' );
231
+ $base = $taxonomy == 'product_tag' ? $permalinks['tag_base'] : ($taxonomy == 'product_cat' ? $permalinks['category_base'] : $permalinks['attribute_base']);
232
 
233
  if($base === ''){
234
  // handle exception - default woocommerce category and tag bases used
258
  }
259
  }else{
260
 
261
+ $string_identifier = ($taxonomy == 'product_tag' || $taxonomy == 'product_cat') ? $taxonomy : 'attribute';
262
 
263
  if($term_language->language_code != $strings_language){
264
  $base_translated = $wpdb->get_var("
267
  JOIN {$wpdb->prefix}icl_string_translations t ON t.string_id = s.id
268
  WHERE s.value='". esc_sql($base)."'
269
  AND s.language = '{$strings_language}'
270
+ AND s.name LIKE 'Url {$string_identifier} slug:%'
271
  AND t.language = '{$term_language->language_code}'
272
  ");
273
 
282
  $wp_rewrite->extra_permastructs[$taxonomy]['struct'] = str_replace($base, $base_translated, $wp_rewrite->extra_permastructs[$taxonomy]['struct']);
283
  $no_recursion_flag = true;
284
  $termlink = get_term_link($term, $taxonomy);
285
+
286
  $wp_rewrite->extra_permastructs[$taxonomy]['struct'] = $buff;
287
 
288
  }
612
 
613
  if(isset( $attribute_taxonomies_arr ) && in_array($taxonomy, $attribute_taxonomies_arr)){
614
 
615
+ $wcml_settings = $woocommerce_wpml->get_settings();
616
 
617
+ // get term language
618
+ $term_language = $sitepress->get_element_language_details($tt_id, 'tax_' . $taxonomy);
619
 
620
+ if($term_language->language_code != $sitepress->get_default_language()){
621
+ // get term in the default language
622
+ $term_id = icl_object_id($term_id, $taxonomy, false, $sitepress->get_default_language());
623
 
624
+ //does it belong to any posts (variations)
625
+ $objects = get_objects_in_term($term_id, $taxonomy);
626
 
627
+ if(!isset($wcml_settings['variations_needed'][$taxonomy])){
628
+ $wcml_settings['variations_needed'][$taxonomy] = 0;
629
+ }
630
+ $wcml_settings['variations_needed'][$taxonomy] += count($objects);
631
 
632
+ $woocommerce_wpml->update_settings($wcml_settings);
633
 
634
+ }
635
+ }
636
 
637
  }
638
 
inc/woocommerce-2.0-backward-compatibility.php CHANGED
@@ -58,7 +58,7 @@ if(version_compare(preg_replace('#-(.+)$#', '', $woocommerce->version), '2.1', '
58
  add_filter('woocommerce_available_shipping_methods', array($WCML_Multi_Currency_Support, 'shipping_taxes_filter'));
59
  }
60
 
61
- add_filter('woocommerce_in_cart_product_title',array($this->products, 'translated_cart_item_name'), 10, 3);
62
 
63
 
64
  }
58
  add_filter('woocommerce_available_shipping_methods', array($WCML_Multi_Currency_Support, 'shipping_taxes_filter'));
59
  }
60
 
61
+ add_filter('woocommerce_in_cart_product_title',array($this->strings, 'translated_cart_item_name'), 10, 3);
62
 
63
 
64
  }
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.8
8
- Stable tag: 3.2
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
@@ -77,6 +77,10 @@ In order for the checkout and store pages to appear translated, you need to crea
77
 
78
  == Changelog ==
79
 
 
 
 
 
80
  = 3.2 =
81
  * Compatibility with upcoming WooCommerce 2.1
82
  * Multi-currency support: configure currencies per languages
5
  License: GPLv2
6
  Requires at least: 3.0
7
  Tested up to: 3.8
8
+ Stable tag: 3.2.1
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
77
 
78
  == Changelog ==
79
 
80
+ = 3.2.1 =
81
+ * Fixed bug related to product category urls translaiton
82
+ * Fixed bug related to back-compatibility with WooCommerce 2.0.20
83
+
84
  = 3.2 =
85
  * Compatibility with upcoming WooCommerce 2.1
86
  * Multi-currency support: configure currencies per languages
woocommerce_wpml.class.php CHANGED
@@ -40,18 +40,18 @@ class woocommerce_wpml {
40
  $WCML_WC_MultiCurrency = new WCML_WC_MultiCurrency;
41
  }
42
 
43
- $this->products = new WCML_Products;
44
- $this->store = new WCML_Store_Pages;
45
- $this->emails = new WCML_Emails;
46
- $this->terms = new WCML_Terms;
47
- $this->orders = new WCML_Orders;
48
  $this->troubleshooting = new WCML_Troubleshooting();
49
- $this->compatibility = new WCML_Compatibility();
 
50
 
51
  include WCML_PLUGIN_PATH . '/inc/woocommerce-2.0-backward-compatibility.php';
52
 
53
  new WCML_Ajax_Setup;
54
- new WCML_WC_Strings;
55
 
56
  new WCML_Requests;
57
 
40
  $WCML_WC_MultiCurrency = new WCML_WC_MultiCurrency;
41
  }
42
 
43
+ $this->products = new WCML_Products;
44
+ $this->store = new WCML_Store_Pages;
45
+ $this->emails = new WCML_Emails;
46
+ $this->terms = new WCML_Terms;
47
+ $this->orders = new WCML_Orders;
48
  $this->troubleshooting = new WCML_Troubleshooting();
49
+ $this->compatibility = new WCML_Compatibility();
50
+ $this->strings = new WCML_WC_Strings;
51
 
52
  include WCML_PLUGIN_PATH . '/inc/woocommerce-2.0-backward-compatibility.php';
53
 
54
  new WCML_Ajax_Setup;
 
55
 
56
  new WCML_Requests;
57
 
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: 3.2
9
  */
10
 
11
  if(defined('WCML_VERSION')) return;
12
- define('WCML_VERSION', '3.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);
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: 3.2.1
9
  */
10
 
11
  if(defined('WCML_VERSION')) return;
12
+ define('WCML_VERSION', '3.2.1');
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);