WooCommerce Multilingual – run WooCommerce with WPML - Version 3.5.1

Version Description

  • Fixed a bug related to some queries that could potentially cause performance issues.
Download this release

Release Info

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

Code changes from version 3.5 to 3.5.1

Files changed (3) hide show
  1. inc/products.class.php +76 -54
  2. readme.txt +4 -1
  3. wpml-woocommerce.php +2 -2
inc/products.class.php CHANGED
@@ -9,11 +9,12 @@ class WCML_Products{
9
  function __construct(){
10
 
11
  add_action('init', array($this, 'init'));
12
- add_action('init', array($this, 'wc_cart_widget_actions'));
13
- add_action('init', array($this, 'set_tax_and_price_config'), 9999); // After TM parses wpml-config.xml
14
 
15
  //add action for coupons data from WC_Coupon construct
16
  add_action('woocommerce_coupon_loaded',array($this,'wcml_coupon_loaded'));
 
 
17
  }
18
 
19
  function init(){
@@ -113,6 +114,8 @@ class WCML_Products{
113
 
114
  //filter to copy excerpt value
115
  add_filter( 'wpml_copy_from_original_custom_fields', array( $this, 'filter_excerpt_field_content_copy' ) );
 
 
116
  }
117
 
118
  function hide_multilingual_content_setup_box(){
@@ -2592,67 +2595,86 @@ function get_cart_attribute_translation($taxonomy,$attribute,$product_id,$tr_pro
2592
  }
2593
 
2594
 
2595
- function set_tax_and_price_config() {
2596
- global $sitepress, $iclTranslationManagement, $sitepress_settings, $wpdb, $woocommerce_wpml;
2597
 
2598
- $all_products_taxonomies = get_taxonomies(array('object_type'=>array('product')),'objects');
2599
- foreach($all_products_taxonomies as $tax_key => $tax){
2600
- if($tax_key == 'product_type') continue;
2601
- $sitepress_settings["translation-management"]["taxonomies_readonly_config"][$tax_key] = 1;
2602
- $iclTranslationManagement->settings['taxonomies_readonly_config'][$tax_key] = 1;
2603
- $sitepress_settings["taxonomies_sync_option"][$tax_key] = 1;
2604
- $sitepress->verify_taxonomy_translations($tax_key);
2605
- }
2606
- $sitepress->save_settings($sitepress_settings);
2607
 
2608
- $wpml_settings = $sitepress->get_settings();
2609
- if (!isset($wpml_settings['translation-management'])) {
2610
- return;
2611
- }
2612
 
2613
- $keys = array(
2614
- '_regular_price',
2615
- '_sale_price',
2616
- '_price',
2617
- '_min_variation_regular_price',
2618
- '_min_variation_sale_price',
2619
- '_min_variation_price',
2620
- '_max_variation_regular_price',
2621
- '_max_variation_sale_price',
2622
- '_max_variation_price',
2623
- '_sale_price_dates_from',
2624
- '_sale_price_dates_to',
2625
- '_wcml_schedule'
2626
- );
2627
 
2628
- $save = false;
2629
- if (isset($iclTranslationManagement) && $iclTranslationManagement instanceof TranslationManagement ) {
2630
- foreach ($keys as $key) {
2631
- $iclTranslationManagement->settings['custom_fields_readonly_config'][] = $key;
2632
- if (!isset($sitepress_settings['translation-management']['custom_fields_translation'][$key]) ||
2633
- $wpml_settings['translation-management']['custom_fields_translation'][$key] != 1) {
2634
- $wpml_settings['translation-management']['custom_fields_translation'][$key] = 1;
2635
- $save = true;
2636
- }
2637
-
2638
- if(!empty($woocommerce_wpml->multi_currency_support)){
2639
- foreach($woocommerce_wpml->multi_currency_support->get_currency_codes() as $code){
2640
- $new_key = $key.'_'.$code;
2641
- $iclTranslationManagement->settings['custom_fields_readonly_config'][] = $new_key;
2642
- if (!isset($sitepress_settings['translation-management']['custom_fields_translation'][$new_key]) ||
2643
- $wpml_settings['translation-management']['custom_fields_translation'][$new_key] != 0) {
2644
- $wpml_settings['translation-management']['custom_fields_translation'][$new_key] = 0;
2645
- $save = true;
2646
  }
 
2647
  }
2648
- }
2649
 
2650
- }
 
 
2651
 
2652
- if ($save) {
2653
- $sitepress->save_settings($wpml_settings);
2654
  }
2655
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2656
  }
2657
 
2658
 
9
  function __construct(){
10
 
11
  add_action('init', array($this, 'init'));
12
+ add_action('init', array($this, 'wc_cart_widget_actions'));
 
13
 
14
  //add action for coupons data from WC_Coupon construct
15
  add_action('woocommerce_coupon_loaded',array($this,'wcml_coupon_loaded'));
16
+
17
+ add_action('init', array($this, 'set_prices_config'), 9999 ); // After TM
18
  }
19
 
20
  function init(){
114
 
115
  //filter to copy excerpt value
116
  add_filter( 'wpml_copy_from_original_custom_fields', array( $this, 'filter_excerpt_field_content_copy' ) );
117
+
118
+ add_filter('icl_wpml_config_array', array($this, 'set_taxonomies_config'));
119
  }
120
 
121
  function hide_multilingual_content_setup_box(){
2595
  }
2596
 
2597
 
2598
+ function set_taxonomies_config( $config_all ) {
2599
+ global $woocommerce_wpml;
2600
 
2601
+ $all_products_taxonomies = get_taxonomies( array( 'object_type' => array( 'product' ) ), 'objects' );
 
 
 
 
 
 
 
 
2602
 
2603
+ foreach($all_products_taxonomies as $tax_key => $tax) {
2604
+ if($tax_key == 'product_type' ) continue;
 
 
2605
 
2606
+ $found = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
2607
 
2608
+ foreach( $config_all['wpml-config']['taxonomies']['taxonomy'] as $key => $taxonomy ){
2609
+
2610
+ if( $tax_key == $taxonomy['value'] ){
2611
+ $config_all['wpml-config']['taxonomies']['taxonomy'][$key]['attr']['translate'] = 1;
2612
+ $found = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
2613
  }
2614
+
2615
  }
 
2616
 
2617
+ if( !$found ){
2618
+ $config_all['wpml-config']['taxonomies']['taxonomy'][] = array( 'value' => $tax_key, 'attr' => array( 'translate' => 1 ) );
2619
+ }
2620
 
 
 
2621
  }
2622
+
2623
+ return $config_all;
2624
+ }
2625
+
2626
+
2627
+ function set_prices_config(){
2628
+ global $sitepress, $iclTranslationManagement, $sitepress_settings, $woocommerce_wpml;
2629
+
2630
+ $wpml_settings = $sitepress->get_settings();
2631
+
2632
+ if (!isset($wpml_settings['translation-management']) || !isset($iclTranslationManagement) || !( $iclTranslationManagement instanceof TranslationManagement) ) {
2633
+ return;
2634
+ }
2635
+
2636
+ $keys = array(
2637
+ '_regular_price',
2638
+ '_sale_price',
2639
+ '_price',
2640
+ '_min_variation_regular_price',
2641
+ '_min_variation_sale_price',
2642
+ '_min_variation_price',
2643
+ '_max_variation_regular_price',
2644
+ '_max_variation_sale_price',
2645
+ '_max_variation_price',
2646
+ '_sale_price_dates_from',
2647
+ '_sale_price_dates_to',
2648
+ '_wcml_schedule'
2649
+ );
2650
+
2651
+ $save = false;
2652
+
2653
+ foreach ($keys as $key) {
2654
+ $iclTranslationManagement->settings['custom_fields_readonly_config'][] = $key;
2655
+ if (!isset($sitepress_settings['translation-management']['custom_fields_translation'][$key]) ||
2656
+ $wpml_settings['translation-management']['custom_fields_translation'][$key] != 1) {
2657
+ $wpml_settings['translation-management']['custom_fields_translation'][$key] = 1;
2658
+ $save = true;
2659
+ }
2660
+
2661
+ if(!empty($woocommerce_wpml->multi_currency_support)){
2662
+ foreach($woocommerce_wpml->multi_currency_support->get_currency_codes() as $code){
2663
+ $new_key = $key.'_'.$code;
2664
+ $iclTranslationManagement->settings['custom_fields_readonly_config'][] = $new_key;
2665
+ if (!isset($sitepress_settings['translation-management']['custom_fields_translation'][$new_key]) ||
2666
+ $wpml_settings['translation-management']['custom_fields_translation'][$new_key] != 0) {
2667
+ $wpml_settings['translation-management']['custom_fields_translation'][$new_key] = 0;
2668
+ $save = true;
2669
+ }
2670
+ }
2671
+ }
2672
+
2673
+ }
2674
+
2675
+ if ($save) {
2676
+ $sitepress->save_settings($wpml_settings);
2677
+ }
2678
  }
2679
 
2680
 
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: 4.1
8
- Stable tag: 3.5
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
@@ -78,6 +78,9 @@ In order for the checkout and store pages to appear translated, you need to crea
78
 
79
  == Changelog ==
80
 
 
 
 
81
  = 3.5 =
82
  * Added support for creating products in secondary languages only.
83
  * Added enhancements for the Woocommerce Multilingual products table (filter by original language, display language flag).
5
  License: GPLv2
6
  Requires at least: 3.0
7
  Tested up to: 4.1
8
+ Stable tag: 3.5.1
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
78
 
79
  == Changelog ==
80
 
81
+ = 3.5.1 =
82
+ * Fixed a bug related to some queries that could potentially cause performance issues.
83
+
84
  = 3.5 =
85
  * Added support for creating products in secondary languages only.
86
  * Added enhancements for the Woocommerce Multilingual products table (filter by original language, display language flag).
wpml-woocommerce.php CHANGED
@@ -5,12 +5,12 @@
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: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com/
8
- Version: 3.5
9
  */
10
 
11
 
12
  if(defined('WCML_VERSION')) return;
13
- define('WCML_VERSION', '3.5');
14
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
15
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
16
  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: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com/
8
+ Version: 3.5.1
9
  */
10
 
11
 
12
  if(defined('WCML_VERSION')) return;
13
+ define('WCML_VERSION', '3.5.1');
14
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
15
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
16
  define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);