WooCommerce Multilingual – run WooCommerce with WPML - Version 4.3.4

Version Description

  • Fixed error: Cannot redeclare woocommerce_wp_text_input
  • Fixed error when creating booking from admin without creating order
  • Fixed Woocommerce Dynamic Price issue with Advanced category price in second language
  • Fix situation with filtering WC attributes calling by sku
  • Fix a problem that you cannot delete booking from trash
  • Fix prevent letters in multicurrency popup for number of decimals
  • Fix accept only symbols in decimal separator for multi currency
  • Resolved fatal error when a galler shortcode has a leading, trailing or extra comma
  • Fix issue in show comments in all languages functionality
  • Fixed displaying WYSIWYG fields from additional plugins as single line text
  • Fix small issue with order of breadcrumbs in second language
  • Fix default term value in product variation when using display as translated feature
  • Allow users to comment on product that they have bought, but in other languages
  • Fixed WooCommerce Dynamic Pricing compatibility -> filtering by role not applied for secondary currency
  • Added support for translating WooCommerce terms and conditions
  • Fixed totals in order if the product has custom price in second currency
  • Fix displaying email subject when you have 3rd party email notification plugin
  • Fixed product view price when secondary currency have different range of dates for sale price
  • Fix small issue with creations of WooCommerce Booking in backend
Download this release

Release Info

Developer sergey.r
Plugin Icon 128x128 WooCommerce Multilingual – run WooCommerce with WPML
Version 4.3.4
Comparing to
See all releases

Code changes from version 4.3.3 to 4.3.4

changelog/4.3.4.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Fixes
2
+ * [wcml-2494] Fixed error: Cannot redeclare woocommerce_wp_text_input
3
+ * [wcml-2492] Fixed error when creating booking from admin without creating order
4
+ * [wcml-2491] Fixed Woocommerce Dynamic Price issue with Advanced category price in second language
5
+ * [wcml-2485] Fix situation with filtering WC attributes calling by sku
6
+ * [wcml-2484] Fix a problem that you cannot delete booking from trash
7
+ * [wcml-2482] Fix prevent letters in multicurrency popup for number of decimals
8
+ * [wcml-2479] Fix accept only symbols in decimal separator for multi currency
9
+ * [wcml-2478] Resolved fatal error when a galler shortcode has a leading, trailing or extra comma
10
+ * [wcml-2477] Fix issue in show comments in all languages functionality
11
+ * [wcml-2475] Fixed displaying WYSIWYG fields from additional plugins as single line text
12
+ * [wcml-2473] Fix small issue with order of breadcrumbs in second language
13
+ * [wcml-2472] Fix default term value in product variation when using display as translated feature
14
+ * [wcml-2469] Allow users to comment on product that they have bought, but in other languages
15
+ * [wcml-2465] Fixed WooCommerce Dynamic Pricing compatibility -> filtering by role not applied for secondary currency
16
+ * [wcml-2461] Added support for translating WooCommerce terms and conditions
17
+ * [wcml-2460] Fixed totals in order if the product has custom price in second currency
18
+ * [wcml-2457] Fix displaying email subject when you have 3rd party email notification plugin
19
+ * [wcml-2418] Fixed product view price when secondary currency have different range of dates for sale price
20
+ * [wcml-2378] Fix small issue with creations of WooCommerce Booking in backend
classes/media/class-wcml-product-gallery-filter.php CHANGED
@@ -19,7 +19,7 @@ class WCML_Product_Gallery_Filter implements IWPML_Action {
19
  if ( '_product_image_gallery' === $meta_key &&
20
  in_array( get_post_type( $object_id ), array( 'product', 'product_variation' ) ) ) {
21
 
22
- remove_filter( 'get_post_metadata', array( $this, 'localize_image_ids' ), 10, 3 );
23
 
24
  $meta_value = array();
25
 
@@ -29,6 +29,8 @@ class WCML_Product_Gallery_Filter implements IWPML_Action {
29
  $original_gallery_value = get_post_meta( $source_element->get_id(), '_product_image_gallery', true );
30
  if ( $original_gallery_value ) {
31
  $original_gallery = explode( ',', $original_gallery_value );
 
 
32
  foreach ( $original_gallery as $attachment_id ) {
33
  $attachment_element = $this->translation_element_factory->create( $attachment_id, 'post' );
34
  $translated_attachment = $attachment_element->get_translation( $post_element->get_language_code() );
19
  if ( '_product_image_gallery' === $meta_key &&
20
  in_array( get_post_type( $object_id ), array( 'product', 'product_variation' ) ) ) {
21
 
22
+ remove_filter( 'get_post_metadata', array( $this, 'localize_image_ids' ), 10 );
23
 
24
  $meta_value = array();
25
 
29
  $original_gallery_value = get_post_meta( $source_element->get_id(), '_product_image_gallery', true );
30
  if ( $original_gallery_value ) {
31
  $original_gallery = explode( ',', $original_gallery_value );
32
+ $original_gallery = array_filter( $original_gallery );
33
+
34
  foreach ( $original_gallery as $attachment_id ) {
35
  $attachment_element = $this->translation_element_factory->create( $attachment_id, 'post' );
36
  $translated_attachment = $attachment_element->get_translation( $post_element->get_language_code() );
compatibility/class-wcml-bookings.php CHANGED
@@ -81,7 +81,8 @@ class WCML_Bookings {
81
 
82
  add_action( 'init', array( $this, 'load_assets' ) );
83
 
84
- add_action( 'save_post', array( $this, 'save_custom_costs' ), 110, 1 );
 
85
  add_action( 'wcml_before_sync_product_data', array( $this, 'sync_bookings' ), 10, 3 );
86
  add_action( 'wcml_before_sync_product', array( $this, 'sync_booking_data' ), 10, 2 );
87
 
@@ -231,6 +232,13 @@ class WCML_Bookings {
231
 
232
  }
233
 
 
 
 
 
 
 
 
234
  function wcml_price_field_after_booking_base_cost( $post_id ) {
235
 
236
  $this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_cost' );
@@ -296,6 +304,10 @@ class WCML_Bookings {
296
 
297
  $wc_currencies = get_woocommerce_currencies();
298
 
 
 
 
 
299
  echo '<div class="wcml_custom_cost_field" >';
300
 
301
  foreach ( $currencies as $currency_code => $currency ) {
@@ -1790,7 +1802,11 @@ class WCML_Bookings {
1790
 
1791
  function delete_bookings( $booking_id ) {
1792
 
1793
- if ( $booking_id > 0 && get_post_type( $booking_id ) == 'wc_booking' ) {
 
 
 
 
1794
 
1795
  $translated_bookings = $this->get_translated_bookings( $booking_id );
1796
 
@@ -1813,7 +1829,10 @@ class WCML_Bookings {
1813
 
1814
  add_action( 'before_delete_post', array( $this, 'delete_bookings' ) );
1815
  }
 
1816
 
 
 
1817
  }
1818
 
1819
  function trash_bookings( $booking_id ) {
@@ -2461,7 +2480,9 @@ class WCML_Bookings {
2461
 
2462
  if( class_exists( 'WC_Email_Booking_Confirmed' ) && isset( $this->woocommerce->mailer()->emails[ 'WC_Email_Booking_Confirmed' ] ) ){
2463
  $booking = get_wc_booking( $booking_id );
2464
- $this->translate_email_strings( 'WC_Email_Booking_Confirmed', 'woocommerce_booking_confirmed_settings', $booking->get_order()->get_id() );
 
 
2465
  }
2466
 
2467
  }
@@ -2533,4 +2554,16 @@ class WCML_Bookings {
2533
  $this->woocommerce->mailer()->emails[$email_class]->subject = $this->woocommerce_wpml->emails->wcml_get_translated_email_string( 'admin_texts_'.$setting_slug, '['.$setting_slug.']subject', $order_id, $user_lang );
2534
  }
2535
 
 
 
 
 
 
 
 
 
 
 
 
 
2536
  }
81
 
82
  add_action( 'init', array( $this, 'load_assets' ) );
83
 
84
+ add_action( 'save_post', array( $this, 'save_booking_action_handler' ), 110 );
85
+
86
  add_action( 'wcml_before_sync_product_data', array( $this, 'sync_bookings' ), 10, 3 );
87
  add_action( 'wcml_before_sync_product', array( $this, 'sync_booking_data' ), 10, 2 );
88
 
232
 
233
  }
234
 
235
+ public function save_booking_action_handler( $booking_id ) {
236
+
237
+ $this->maybe_set_booking_language( $booking_id );
238
+
239
+ $this->save_custom_costs( $booking_id );
240
+ }
241
+
242
  function wcml_price_field_after_booking_base_cost( $post_id ) {
243
 
244
  $this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_cost' );
304
 
305
  $wc_currencies = get_woocommerce_currencies();
306
 
307
+ if ( ! function_exists( 'woocommerce_wp_text_input' ) ) {
308
+ include_once dirname( WC_PLUGIN_FILE ) . 'includes/admin/wc-meta-box-functions.php';
309
+ }
310
+
311
  echo '<div class="wcml_custom_cost_field" >';
312
 
313
  foreach ( $currencies as $currency_code => $currency ) {
1802
 
1803
  function delete_bookings( $booking_id ) {
1804
 
1805
+ if (
1806
+ ! $this->is_delete_all_action()
1807
+ && $booking_id
1808
+ && get_post_type( $booking_id ) == 'wc_booking'
1809
+ ) {
1810
 
1811
  $translated_bookings = $this->get_translated_bookings( $booking_id );
1812
 
1829
 
1830
  add_action( 'before_delete_post', array( $this, 'delete_bookings' ) );
1831
  }
1832
+ }
1833
 
1834
+ private function is_delete_all_action() {
1835
+ return array_key_exists( 'delete_all', $_GET ) && $_GET['delete_all'];
1836
  }
1837
 
1838
  function trash_bookings( $booking_id ) {
2480
 
2481
  if( class_exists( 'WC_Email_Booking_Confirmed' ) && isset( $this->woocommerce->mailer()->emails[ 'WC_Email_Booking_Confirmed' ] ) ){
2482
  $booking = get_wc_booking( $booking_id );
2483
+ if( $booking->get_order() ){
2484
+ $this->translate_email_strings( 'WC_Email_Booking_Confirmed', 'woocommerce_booking_confirmed_settings', $booking->get_order()->get_id() );
2485
+ }
2486
  }
2487
 
2488
  }
2554
  $this->woocommerce->mailer()->emails[$email_class]->subject = $this->woocommerce_wpml->emails->wcml_get_translated_email_string( 'admin_texts_'.$setting_slug, '['.$setting_slug.']subject', $order_id, $user_lang );
2555
  }
2556
 
2557
+ public function maybe_set_booking_language( $booking_id ) {
2558
+
2559
+ if ( 'wc_booking' === get_post_type( $booking_id ) ) {
2560
+ $language_details = $this->sitepress->get_element_language_details( $booking_id, 'post_wc_booking' );
2561
+ if ( ! $language_details ) {
2562
+ $current_language = $this->sitepress->get_current_language();
2563
+ $this->sitepress->set_element_language_details( $booking_id, 'post_wc_booking', false, $current_language );
2564
+ }
2565
+ }
2566
+
2567
+ }
2568
+
2569
  }
compatibility/class-wcml-dynamic-pricing.php CHANGED
@@ -9,6 +9,10 @@ class WCML_Dynamic_Pricing {
9
 
10
  if ( ! is_admin() ) {
11
  add_filter( 'wc_dynamic_pricing_load_modules', array( $this, 'filter_price' ) );
 
 
 
 
12
  add_filter( 'woocommerce_dynamic_pricing_is_applied_to', array(
13
  $this,
14
  'woocommerce_dynamic_pricing_is_applied_to'
@@ -34,15 +38,20 @@ class WCML_Dynamic_Pricing {
34
  foreach ( $modules as $mod_key => $module ) {
35
  if ( isset( $module->available_rulesets ) ) {
36
  $available_rulesets = $module->available_rulesets;
 
37
  foreach ( $available_rulesets as $rule_key => $available_ruleset ) {
38
- $rules = $available_ruleset['rules'];
39
- if ( $rules ) {
 
40
  foreach ( $rules as $r_key => $rule ) {
41
  if ( 'fixed_product' === $rule['type'] ) {
42
  $rules[ $r_key ]['amount'] = apply_filters( 'wcml_raw_price_amount', $rule['amount'] );
43
  }
44
  }
45
  $modules[ $mod_key ]->available_rulesets[ $rule_key ]['rules'] = $rules;
 
 
 
46
  }
47
  }
48
  }
@@ -52,6 +61,22 @@ class WCML_Dynamic_Pricing {
52
  }
53
 
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * @param bool $process_discounts
57
  * @param WC_Product $_product
9
 
10
  if ( ! is_admin() ) {
11
  add_filter( 'wc_dynamic_pricing_load_modules', array( $this, 'filter_price' ) );
12
+ add_action( 'woocommerce_dynamic_pricing_is_object_in_terms', array(
13
+ $this,
14
+ 'is_object_in_translated_terms'
15
+ ), 10, 3 );
16
  add_filter( 'woocommerce_dynamic_pricing_is_applied_to', array(
17
  $this,
18
  'woocommerce_dynamic_pricing_is_applied_to'
38
  foreach ( $modules as $mod_key => $module ) {
39
  if ( isset( $module->available_rulesets ) ) {
40
  $available_rulesets = $module->available_rulesets;
41
+
42
  foreach ( $available_rulesets as $rule_key => $available_ruleset ) {
43
+
44
+ if ( isset( $available_ruleset['rules'] ) && is_array( $available_ruleset['rules'] ) ) {
45
+ $rules = $available_ruleset['rules'];
46
  foreach ( $rules as $r_key => $rule ) {
47
  if ( 'fixed_product' === $rule['type'] ) {
48
  $rules[ $r_key ]['amount'] = apply_filters( 'wcml_raw_price_amount', $rule['amount'] );
49
  }
50
  }
51
  $modules[ $mod_key ]->available_rulesets[ $rule_key ]['rules'] = $rules;
52
+
53
+ } elseif ( isset( $available_ruleset['type'] ) && 'fixed_product' === $available_ruleset['type'] ) {
54
+ $modules[ $mod_key ]->available_rulesets[ $rule_key ]['amount'] = apply_filters( 'wcml_raw_price_amount', $available_ruleset['amount'] );
55
  }
56
  }
57
  }
61
  }
62
 
63
 
64
+ /**
65
+ * @param boolean $result
66
+ * @param int $product_id
67
+ * @param array $categories
68
+ *
69
+ * @return boolean
70
+ */
71
+ function is_object_in_translated_terms( $result, $product_id, $categories ) {
72
+ foreach ($categories as &$cat_id ) {
73
+ $cat_id = apply_filters( 'translate_object_id', $cat_id, 'product_cat', true );
74
+ }
75
+
76
+ return is_object_in_term( $product_id, 'product_cat', $categories );
77
+ }
78
+
79
+
80
  /**
81
  * @param bool $process_discounts
82
  * @param WC_Product $_product
inc/class-wcml-attributes.php CHANGED
@@ -52,6 +52,10 @@ class WCML_Attributes{
52
  $this,
53
  'filter_product_variation_post_meta_attribute_values_in_current_language'
54
  ), 10, 4 );
 
 
 
 
55
  }
56
  }
57
 
@@ -648,6 +652,27 @@ class WCML_Attributes{
648
 
649
  }
650
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651
  /**
652
  *
653
  * @param string $attribute_taxonomy
@@ -667,5 +692,4 @@ class WCML_Attributes{
667
  return $attribute_value;
668
  }
669
 
670
-
671
  }
52
  $this,
53
  'filter_product_variation_post_meta_attribute_values_in_current_language'
54
  ), 10, 4 );
55
+ add_filter( 'woocommerce_product_get_default_attributes', array(
56
+ $this,
57
+ 'filter_product_variation_default_attributes'
58
+ ) );
59
  }
60
  }
61
 
652
 
653
  }
654
 
655
+
656
+ /**
657
+ * @param array $default_attributes
658
+ *
659
+ * @return array
660
+ */
661
+ public function filter_product_variation_default_attributes( $default_attributes ){
662
+
663
+ if( $default_attributes ){
664
+
665
+ foreach( $default_attributes as $attribute_key => $attribute_value ){
666
+
667
+ $default_attributes[ $attribute_key ] = $this->get_attribute_term_translation_in_current_language( $attribute_key, $attribute_value );
668
+
669
+ }
670
+
671
+ }
672
+
673
+ return $default_attributes;
674
+ }
675
+
676
  /**
677
  *
678
  * @param string $attribute_taxonomy
692
  return $attribute_value;
693
  }
694
 
 
695
  }
inc/class-wcml-comments.php CHANGED
@@ -157,7 +157,7 @@ class WCML_Comments {
157
  $ids[] = $translation->element_id;
158
  }
159
 
160
- return implode( ',', $ids );
161
 
162
  }
163
 
157
  $ids[] = $translation->element_id;
158
  }
159
 
160
+ return implode( ',', array_filter( $ids ) );
161
 
162
  }
163
 
inc/class-wcml-emails.php CHANGED
@@ -299,7 +299,7 @@ class WCML_Emails{
299
 
300
  public function new_order_email_heading( $heading ){
301
  $translated_heading = $this->woocommerce->mailer()->emails['WC_Email_New_Order']->heading;
302
- if( !is_null( $translated_heading ) ){
303
  $heading = $this->woocommerce->mailer()->emails['WC_Email_New_Order']->format_string( $translated_heading );
304
  }
305
 
@@ -308,7 +308,7 @@ class WCML_Emails{
308
 
309
  public function new_order_email_subject( $subject ){
310
  $translated_subject = $this->woocommerce->mailer()->emails['WC_Email_New_Order']->subject;
311
- if( !is_null( $translated_subject ) ){
312
  $subject = $this->woocommerce->mailer()->emails['WC_Email_New_Order']->format_string( $translated_subject );
313
  }
314
 
299
 
300
  public function new_order_email_heading( $heading ){
301
  $translated_heading = $this->woocommerce->mailer()->emails['WC_Email_New_Order']->heading;
302
+ if( $translated_heading ){
303
  $heading = $this->woocommerce->mailer()->emails['WC_Email_New_Order']->format_string( $translated_heading );
304
  }
305
 
308
 
309
  public function new_order_email_subject( $subject ){
310
  $translated_subject = $this->woocommerce->mailer()->emails['WC_Email_New_Order']->subject;
311
+ if( $translated_subject ){
312
  $subject = $this->woocommerce->mailer()->emails['WC_Email_New_Order']->format_string( $translated_subject );
313
  }
314
 
inc/class-wcml-media.php CHANGED
@@ -11,6 +11,8 @@ class WCML_Media{
11
 
12
  public $settings = array();
13
 
 
 
14
  public function __construct( $woocommerce_wpml, $sitepress, $wpdb ){
15
  $this->woocommerce_wpml = $woocommerce_wpml;
16
  $this->sitepress = $sitepress;
@@ -95,7 +97,7 @@ class WCML_Media{
95
  if ( get_post( $image_id ) ) {
96
  $duplicated_id = apply_filters( 'translate_object_id', $image_id, 'attachment', false, $translation->language_code );
97
  if ( is_null( $duplicated_id ) && $image_id ) {
98
- $duplicated_id = $this->create_base_media_translation( $image_id, $translation->language_code );
99
  }
100
  $duplicated_ids .= $duplicated_id . ',';
101
  }
@@ -106,24 +108,24 @@ class WCML_Media{
106
  }
107
  }
108
 
109
- public function create_base_media_translation( $attachment_id, $target_lang ) {
110
- $duplicate_id = $this->sitepress->make_duplicate( $attachment_id, $target_lang );
111
- delete_post_meta( $duplicate_id, '_icl_lang_duplicate_of' );
112
 
113
- foreach ( array( '_wp_attachment_metadata', '_wp_attached_file' ) as $attachment_meta_key ) {
114
- update_post_meta( $duplicate_id, $attachment_meta_key, get_post_meta( $attachment_id, $attachment_meta_key, true ) );
115
- }
116
 
117
- return $duplicate_id;
118
  }
119
 
120
  public function sync_product_gallery_duplicate_attachment( $att_id, $dup_att_id ) {
121
  $product_id = wp_get_post_parent_id( $att_id );
122
  $post_type = get_post_type( $product_id );
123
- if ( $post_type != 'product' ) {
124
  return;
125
  }
 
126
  $this->sync_product_gallery( $product_id );
 
127
  }
128
 
129
  }
11
 
12
  public $settings = array();
13
 
14
+ private $products_being_synced = array();
15
+
16
  public function __construct( $woocommerce_wpml, $sitepress, $wpdb ){
17
  $this->woocommerce_wpml = $woocommerce_wpml;
18
  $this->sitepress = $sitepress;
97
  if ( get_post( $image_id ) ) {
98
  $duplicated_id = apply_filters( 'translate_object_id', $image_id, 'attachment', false, $translation->language_code );
99
  if ( is_null( $duplicated_id ) && $image_id ) {
100
+ $duplicated_id = $this->create_base_media_translation( $image_id, $translation->element_id, $translation->language_code );
101
  }
102
  $duplicated_ids .= $duplicated_id . ',';
103
  }
108
  }
109
  }
110
 
111
+ public function create_base_media_translation( $attachment_id, $parent_id, $target_lang ) {
 
 
112
 
113
+ $factory = new WPML_Media_Attachments_Duplication_Factory();
114
+ $media_duplicate = $factory->create();
115
+ $duplicated_id = $media_duplicate->create_duplicate_attachment( $attachment_id, $parent_id, $target_lang );
116
 
117
+ return $duplicated_id;
118
  }
119
 
120
  public function sync_product_gallery_duplicate_attachment( $att_id, $dup_att_id ) {
121
  $product_id = wp_get_post_parent_id( $att_id );
122
  $post_type = get_post_type( $product_id );
123
+ if ( $post_type != 'product' || array_key_exists( $product_id, $this->products_being_synced ) ) {
124
  return;
125
  }
126
+ $this->products_being_synced[ $product_id ] = 1;
127
  $this->sync_product_gallery( $product_id );
128
+ unset( $this->products_being_synced[ $product_id ] );
129
  }
130
 
131
  }
inc/class-wcml-products.php CHANGED
@@ -74,6 +74,8 @@ class WCML_Products{
74
  add_filter( 'wc_product_has_unique_sku', array( $this, 'check_product_sku' ), 10, 3 );
75
 
76
  add_filter( 'get_product_search_form', array( $this->sitepress, 'get_search_form_filter' ) );
 
 
77
  }
78
 
79
  // Check if original product
@@ -670,4 +672,18 @@ class WCML_Products{
670
  return apply_filters( 'wpml_is_display_as_translated_post_type', false, 'product' );
671
  }
672
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
673
  }
74
  add_filter( 'wc_product_has_unique_sku', array( $this, 'check_product_sku' ), 10, 3 );
75
 
76
  add_filter( 'get_product_search_form', array( $this->sitepress, 'get_search_form_filter' ) );
77
+
78
+ add_filter( 'woocommerce_pre_customer_bought_product', array( $this, 'is_customer_bought_product' ), 10, 4 );
79
  }
80
 
81
  // Check if original product
672
  return apply_filters( 'wpml_is_display_as_translated_post_type', false, 'product' );
673
  }
674
 
675
+
676
+ public function is_customer_bought_product( $value, $customer_email, $user_id, $product_id ){
677
+
678
+ if ( !$this->is_original_product( $product_id ) ){
679
+ remove_filter( 'woocommerce_pre_customer_bought_product', array( $this, 'is_customer_bought_product' ), 10, 4 );
680
+
681
+ $value = wc_customer_bought_product( $customer_email, $user_id, $this->get_original_product_id( $product_id ) );
682
+
683
+ add_filter( 'woocommerce_pre_customer_bought_product', array( $this, 'is_customer_bought_product' ), 10, 4 );
684
+ }
685
+
686
+ return $value;
687
+ }
688
+
689
  }
inc/class-wcml-terms.php CHANGED
@@ -740,44 +740,49 @@ class WCML_Terms{
740
 
741
  }
742
 
743
- function get_product_terms_filter( $terms, $product_id, $taxonomy, $args ){
744
 
745
- $language = $this->sitepress->get_language_for_element( $product_id, 'post_'.get_post_type( $product_id ) );
746
 
747
- $is_objects_array = is_object( current ( $terms ) );
748
 
749
- $filtered_terms = array();
750
 
751
- foreach( $terms as $term ){
752
 
753
- if( !$is_objects_array ){
754
- $term_obj = get_term_by( 'name', $term, $taxonomy );
755
- if( !$term_obj ){
756
- $term_obj = get_term_by( 'slug', $term, $taxonomy );
757
- $is_slug = true;
758
- }
759
- }
760
 
761
- if( empty($term_obj) ){
762
- $filtered_terms[] = $term;
763
- continue;
764
- }
 
 
765
 
766
- $trnsl_term_id = apply_filters( 'translate_object_id', $term_obj->term_id, $taxonomy, true, $language );
 
 
 
767
 
768
- if( $is_objects_array ){
769
- $filtered_terms[] = get_term( $trnsl_term_id, $taxonomy );
770
- }else{
771
- if( isset( $is_slug ) ){
772
- $filtered_terms[] = get_term( $trnsl_term_id, $taxonomy )->slug;
773
- }else{
774
- $filtered_terms[] = ( is_ajax() && isset( $_POST['action'] ) && in_array( $_POST['action'], array( 'woocommerce_add_variation', 'woocommerce_link_all_variations') ) ) ? strtolower ( get_term( $trnsl_term_id, $taxonomy )->name ) : get_term( $trnsl_term_id, $taxonomy )->name;
775
- }
776
- }
777
- }
 
 
 
 
 
778
 
779
- return $filtered_terms;
780
- }
781
 
782
  function set_flag_to_sync( $taxonomy, $el_id, $language_code ) {
783
  if ( $el_id ) {
740
 
741
  }
742
 
743
+ function get_product_terms_filter( $terms, $product_id, $taxonomy, $args ) {
744
 
745
+ $language = $this->sitepress->get_language_for_element( $product_id, 'post_' . get_post_type( $product_id ) );
746
 
747
+ $is_objects_array = is_object( current( $terms ) );
748
 
749
+ $filtered_terms = array();
750
 
751
+ foreach ( $terms as $term ) {
752
 
753
+ if ( ! $is_objects_array ) {
754
+ $term_obj = get_term_by( 'name', $term, $taxonomy );
 
 
 
 
 
755
 
756
+ $is_wc_filtering_by_slug = isset( $args['fields'] ) && 'id=>slug' === $args['fields'];
757
+ if ( $is_wc_filtering_by_slug || ! $term_obj ) {
758
+ $term_obj = get_term_by( 'slug', $term, $taxonomy );
759
+ $is_slug = true;
760
+ }
761
+ }
762
 
763
+ if ( empty( $term_obj ) ) {
764
+ $filtered_terms[] = $term;
765
+ continue;
766
+ }
767
 
768
+ $trnsl_term_id = apply_filters( 'translate_object_id', $term_obj->term_id, $taxonomy, true, $language );
769
+
770
+ if ( $is_objects_array ) {
771
+ $filtered_terms[] = get_term( $trnsl_term_id, $taxonomy );
772
+ } else {
773
+ if ( isset( $is_slug ) ) {
774
+ $filtered_terms[] = get_term( $trnsl_term_id, $taxonomy )->slug;
775
+ } else {
776
+ $filtered_terms[] = ( is_ajax() && isset( $_POST['action'] ) && in_array( $_POST['action'], array(
777
+ 'woocommerce_add_variation',
778
+ 'woocommerce_link_all_variations'
779
+ ) ) ) ? strtolower( get_term( $trnsl_term_id, $taxonomy )->name ) : get_term( $trnsl_term_id, $taxonomy )->name;
780
+ }
781
+ }
782
+ }
783
 
784
+ return $filtered_terms;
785
+ }
786
 
787
  function set_flag_to_sync( $taxonomy, $el_id, $language_code ) {
788
  if ( $el_id ) {
inc/class-wcml-upgrade.php CHANGED
@@ -24,7 +24,8 @@ class WCML_Upgrade{
24
  '4.2.7',
25
  '4.2.10',
26
  '4.2.11',
27
- '4.3.0'
 
28
  );
29
 
30
  function __construct(){
@@ -701,4 +702,14 @@ class WCML_Upgrade{
701
  }
702
  }
703
 
 
 
 
 
 
 
 
 
 
 
704
  }
24
  '4.2.7',
25
  '4.2.10',
26
  '4.2.11',
27
+ '4.3.0',
28
+ '4.3.4'
29
  );
30
 
31
  function __construct(){
702
  }
703
  }
704
 
705
+ private function upgrade_4_3_4() {
706
+ global $wpdb;
707
+
708
+ //delete wrong duplicated attachments
709
+ $wpdb->query( "DELETE FROM {$wpdb->prefix}icl_translations WHERE `element_id` IN ( SELECT ID FROM {$wpdb->prefix}posts WHERE `guid` LIKE '%attachment_id%' ) " );
710
+ $wpdb->query( "DELETE FROM {$wpdb->prefix}postmeta WHERE `post_id` IN ( SELECT ID FROM {$wpdb->prefix}posts WHERE `guid` LIKE '%attachment_id%' ) " );
711
+ $wpdb->query( "DELETE FROM {$wpdb->prefix}posts WHERE `guid` LIKE '%attachment_id%'" );
712
+
713
+ }
714
+
715
  }
inc/class-wcml-wc-strings.php CHANGED
@@ -373,19 +373,21 @@ class WCML_WC_Strings{
373
  $i = 0;
374
  foreach ( $breadcrumbs as $key => $breadcrumb ) {
375
 
376
- if ( ! in_array( $breadcrumb, $breadcrumbs_buff ) ) {
377
- $breadcrumbs_buff[ $i ] = $breadcrumb;
378
- }
379
-
380
  if ( $key === 0 && $breadcrumbs[1][1] != get_post_type_archive_link( 'product' ) ) {
381
- $i ++;
382
  $breadcrumbs_buff[ $i ] = array(
383
  $shop_page->post_title,
384
  get_post_type_archive_link( 'product' )
385
  );
 
 
 
 
 
386
  }
387
  $i ++;
388
  }
 
389
  $breadcrumbs = $breadcrumbs_buff;
390
 
391
  $breadcrumbs = array_values( $breadcrumbs );
373
  $i = 0;
374
  foreach ( $breadcrumbs as $key => $breadcrumb ) {
375
 
376
+ //Prepend the shop page to shop breadcrumbs
 
 
 
377
  if ( $key === 0 && $breadcrumbs[1][1] != get_post_type_archive_link( 'product' ) ) {
 
378
  $breadcrumbs_buff[ $i ] = array(
379
  $shop_page->post_title,
380
  get_post_type_archive_link( 'product' )
381
  );
382
+ $i ++;
383
+ }
384
+
385
+ if ( ! in_array( $breadcrumb, $breadcrumbs_buff ) ) {
386
+ $breadcrumbs_buff[ $i ] = $breadcrumb;
387
  }
388
  $i ++;
389
  }
390
+
391
  $breadcrumbs = $breadcrumbs_buff;
392
 
393
  $breadcrumbs = array_values( $breadcrumbs );
inc/currencies/class-wcml-custom-prices.php CHANGED
@@ -17,6 +17,8 @@ class WCML_Custom_Prices{
17
  add_action( 'woocommerce_product_options_pricing', array($this, 'woocommerce_product_options_custom_pricing') );
18
  add_action( 'woocommerce_product_after_variable_attributes', array($this, 'woocommerce_product_after_variable_attributes_custom_pricing'), 10, 3 );
19
 
 
 
20
  }
21
 
22
  add_action( 'woocommerce_variation_is_visible', array( $this, 'filter_product_variations_with_custom_prices' ), 10, 2 );
@@ -32,7 +34,7 @@ class WCML_Custom_Prices{
32
 
33
  }
34
 
35
- public function get_product_custom_prices($product_id, $currency = false){
36
  global $wpdb, $sitepress;
37
 
38
  if( empty( $currency ) ){
@@ -43,7 +45,14 @@ class WCML_Custom_Prices{
43
  return false;
44
  }
45
 
46
- $original_product_id = $product_id;
 
 
 
 
 
 
 
47
  $post_type = get_post_type($product_id);
48
  $product_translations = $sitepress->get_element_translations($sitepress->get_element_trid($product_id, 'post_'.$post_type), 'post_'.$post_type);
49
  foreach($product_translations as $translation){
@@ -232,6 +241,8 @@ class WCML_Custom_Prices{
232
 
233
  $custom_prices = apply_filters( 'wcml_product_custom_prices', $custom_prices, $product_id, $currency );
234
 
 
 
235
  return $custom_prices;
236
  }
237
 
@@ -464,4 +475,29 @@ class WCML_Custom_Prices{
464
  }
465
  }
466
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  }
17
  add_action( 'woocommerce_product_options_pricing', array($this, 'woocommerce_product_options_custom_pricing') );
18
  add_action( 'woocommerce_product_after_variable_attributes', array($this, 'woocommerce_product_after_variable_attributes_custom_pricing'), 10, 3 );
19
 
20
+ }else{
21
+ add_filter( 'woocommerce_product_is_on_sale', array( $this, 'filter_product_is_on_sale' ), 10, 2 );
22
  }
23
 
24
  add_action( 'woocommerce_variation_is_visible', array( $this, 'filter_product_variations_with_custom_prices' ), 10, 2 );
34
 
35
  }
36
 
37
+ public function get_product_custom_prices( $product_id, $currency = false ){
38
  global $wpdb, $sitepress;
39
 
40
  if( empty( $currency ) ){
45
  return false;
46
  }
47
 
48
+ $cache_key = $product_id.'_'.$currency;
49
+ $cache_group = 'product_custom_prices';
50
+ $cache_found = false;
51
+ $cache_custom_prices = wp_cache_get( $cache_key, $cache_group, false, $cache_found );
52
+ if( $cache_found ) return $cache_custom_prices;
53
+
54
+
55
+ $original_product_id = $product_id;
56
  $post_type = get_post_type($product_id);
57
  $product_translations = $sitepress->get_element_translations($sitepress->get_element_trid($product_id, 'post_'.$post_type), 'post_'.$post_type);
58
  foreach($product_translations as $translation){
241
 
242
  $custom_prices = apply_filters( 'wcml_product_custom_prices', $custom_prices, $product_id, $currency );
243
 
244
+ wp_cache_set( $cache_key, $custom_prices, $cache_group );
245
+
246
  return $custom_prices;
247
  }
248
 
475
  }
476
  }
477
 
478
+ /**
479
+ * @param bool $on_sale
480
+ * @param WC_Product $product_object
481
+ *
482
+ * @return bool
483
+ */
484
+ public function filter_product_is_on_sale( $on_sale, $product_object ) {
485
+
486
+ if(
487
+ !$on_sale &&
488
+ $this->woocommerce_wpml->settings[ 'enable_multi_currency' ] === WCML_MULTI_CURRENCIES_INDEPENDENT &&
489
+ get_post_meta( $product_object->get_id(), '_wcml_custom_prices_status', true )
490
+ ){
491
+
492
+ $custom_prices = $this->get_product_custom_prices( $product_object->get_id() );
493
+
494
+ if( $custom_prices[ '_sale_price' ] !== '' && $custom_prices[ '_sale_price' ] != $custom_prices[ '_regular_price' ] ){
495
+ $on_sale = true;
496
+ }
497
+
498
+ }
499
+
500
+ return $on_sale;
501
+ }
502
+
503
  }
inc/currencies/class-wcml-multi-currency-orders.php CHANGED
@@ -282,8 +282,6 @@ class WCML_Multi_Currency_Orders {
282
  $order_currency = $this->get_order_currency_cookie();
283
  }
284
 
285
- $original_product_id = $this->woocommerce_wpml->products->get_original_product_id( sanitize_text_field( $_POST['item_to_add'][0] ) );
286
-
287
  if ( ! isset( $this->multi_currency->prices ) ) {
288
  $this->multi_currency->prices = new WCML_Multi_Currency_Prices( $this->multi_currency );
289
  $this->multi_currency->prices->add_hooks();
@@ -292,6 +290,8 @@ class WCML_Multi_Currency_Orders {
292
 
293
  if ( $item instanceof WC_Order_Item_Product ) {
294
 
 
 
295
  if ( 'line_item' === $item->get_type() ) {
296
 
297
  $converted_price = get_post_meta( $original_product_id, '_price_' . $order_currency, true );
@@ -324,6 +324,8 @@ class WCML_Multi_Currency_Orders {
324
  }
325
  } else {
326
 
 
 
327
  $converted_price = $converted_subtotal_price = $converted_total_price = get_post_meta( $original_product_id, '_price_' . $order_currency, true );
328
 
329
  if ( ! $converted_price ) {
282
  $order_currency = $this->get_order_currency_cookie();
283
  }
284
 
 
 
285
  if ( ! isset( $this->multi_currency->prices ) ) {
286
  $this->multi_currency->prices = new WCML_Multi_Currency_Prices( $this->multi_currency );
287
  $this->multi_currency->prices->add_hooks();
290
 
291
  if ( $item instanceof WC_Order_Item_Product ) {
292
 
293
+ $original_product_id = $this->woocommerce_wpml->products->get_original_product_id( $item->get_product_id() );
294
+
295
  if ( 'line_item' === $item->get_type() ) {
296
 
297
  $converted_price = get_post_meta( $original_product_id, '_price_' . $order_currency, true );
324
  }
325
  } else {
326
 
327
+ $original_product_id = $this->woocommerce_wpml->products->get_original_product_id( $item[ 'product_id' ] );
328
+
329
  $converted_price = $converted_subtotal_price = $converted_total_price = get_post_meta( $original_product_id, '_price_' . $order_currency, true );
330
 
331
  if ( ! $converted_price ) {
inc/missing-php-functions.php CHANGED
@@ -86,73 +86,3 @@ if ( version_compare( $GLOBALS['wp_version'], '4.4.0', '<' ) ) {
86
  }
87
 
88
  }
89
-
90
- // WC function which needs for front ( combination of Dokan + Bookings ) but defined only for admin
91
- if ( !is_admin() && ! function_exists( 'woocommerce_wp_text_input' ) ) {
92
- /**
93
- * Output a text input box.
94
- *
95
- * @param array $field
96
- */
97
- function woocommerce_wp_text_input( $field ) {
98
- global $thepostid, $post;
99
-
100
- $thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
101
- $field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
102
- $field['class'] = isset( $field['class'] ) ? $field['class'] : 'short';
103
- $field['style'] = isset( $field['style'] ) ? $field['style'] : '';
104
- $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
105
- $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true );
106
- $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];
107
- $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text';
108
- $field['desc_tip'] = isset( $field['desc_tip'] ) ? $field['desc_tip'] : false;
109
- $data_type = empty( $field['data_type'] ) ? '' : $field['data_type'];
110
-
111
- switch ( $data_type ) {
112
- case 'price':
113
- $field['class'] .= ' wc_input_price';
114
- $field['value'] = wc_format_localized_price( $field['value'] );
115
- break;
116
- case 'decimal':
117
- $field['class'] .= ' wc_input_decimal';
118
- $field['value'] = wc_format_localized_decimal( $field['value'] );
119
- break;
120
- case 'stock':
121
- $field['class'] .= ' wc_input_stock';
122
- $field['value'] = wc_stock_amount( $field['value'] );
123
- break;
124
- case 'url':
125
- $field['class'] .= ' wc_input_url';
126
- $field['value'] = esc_url( $field['value'] );
127
- break;
128
-
129
- default:
130
- break;
131
- }
132
-
133
- // Custom attribute handling
134
- $custom_attributes = array();
135
-
136
- if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) {
137
-
138
- foreach ( $field['custom_attributes'] as $attribute => $value ) {
139
- $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
140
- }
141
- }
142
-
143
- echo '<p class="form-field ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '">
144
- <label for="' . esc_attr( $field['id'] ) . '">' . wp_kses_post( $field['label'] ) . '</label>';
145
-
146
- if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) {
147
- echo wc_help_tip( $field['description'] );
148
- }
149
-
150
- echo '<input type="' . esc_attr( $field['type'] ) . '" class="' . esc_attr( $field['class'] ) . '" style="' . esc_attr( $field['style'] ) . '" name="' . esc_attr( $field['name'] ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" ' . implode( ' ', $custom_attributes ) . ' /> ';
151
-
152
- if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) {
153
- echo '<span class="description">' . wp_kses_post( $field['description'] ) . '</span>';
154
- }
155
-
156
- echo '</p>';
157
- }
158
- }
86
  }
87
 
88
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/translation-editor/class-wcml-editor-ui-product-job.php CHANGED
@@ -167,11 +167,15 @@ class WCML_Editor_UI_Product_Job extends WPML_Editor_UI_Job {
167
 
168
  $cf_settings = new WPML_Post_Custom_Field_Setting( $this->tm_instance, $custom_field );
169
 
170
- switch( $cf_settings->get_editor_style() ){
 
 
171
  case 'visual':
 
172
  $cf_field = new WPML_Editor_UI_WYSIWYG_Field( $custom_field, $this->get_product_custom_field_label( $custom_field ), $this->data, true );
173
  break;
174
  case 'textarea':
 
175
  $cf_field = new WPML_Editor_UI_TextArea_Field( $custom_field, $this->get_product_custom_field_label( $custom_field ), $this->data, true );
176
  break;
177
  default: //line
@@ -729,7 +733,7 @@ class WCML_Editor_UI_Product_Job extends WPML_Editor_UI_Job {
729
  $trnsl_prod_image = apply_filters( 'translate_object_id', $image_id, 'attachment', false, $this->get_target_language() );
730
 
731
  if ( ! $trnsl_prod_image ) {
732
- $trnsl_prod_image = $this->woocommerce_wpml->media->create_base_media_translation( $image_id, $this->get_target_language() );
733
  }
734
 
735
  //update image texts
167
 
168
  $cf_settings = new WPML_Post_Custom_Field_Setting( $this->tm_instance, $custom_field );
169
 
170
+ $field_style = (string) apply_filters( 'wpml_tm_editor_string_style', $cf_settings->get_editor_style(), 'field-'.$custom_field.'-0', get_post( $this->product_id ) );
171
+
172
+ switch( $field_style ){
173
  case 'visual':
174
+ case '2':
175
  $cf_field = new WPML_Editor_UI_WYSIWYG_Field( $custom_field, $this->get_product_custom_field_label( $custom_field ), $this->data, true );
176
  break;
177
  case 'textarea':
178
+ case '1':
179
  $cf_field = new WPML_Editor_UI_TextArea_Field( $custom_field, $this->get_product_custom_field_label( $custom_field ), $this->data, true );
180
  break;
181
  default: //line
733
  $trnsl_prod_image = apply_filters( 'translate_object_id', $image_id, 'attachment', false, $this->get_target_language() );
734
 
735
  if ( ! $trnsl_prod_image ) {
736
+ $trnsl_prod_image = $this->woocommerce_wpml->media->create_base_media_translation( $image_id, $this->product_id, $this->get_target_language() );
737
  }
738
 
739
  //update image texts
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: http://wpml.org/documentation/related-projects/woocommerce-multilin
4
  Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
5
  License: GPLv2
6
  Requires at least: 3.9
7
- Tested up to: 4.9.6
8
- Stable tag: 4.3.3
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
@@ -140,6 +140,27 @@ WooCommerce Multilingual is compatible with all major WooCommerce extensions. We
140
 
141
  == Changelog ==
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  = 4.3.3 =
144
  * Fixed small issue in WC Bookings where block cost in other currencies is not saved correctly
145
  * Fix compatibility issue with WC Product Addons and not displayed label in secondary language
4
  Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
5
  License: GPLv2
6
  Requires at least: 3.9
7
+ Tested up to: 4.9.8
8
+ Stable tag: 4.3.4
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
140
 
141
  == Changelog ==
142
 
143
+ = 4.3.4 =
144
+ * Fixed error: Cannot redeclare woocommerce_wp_text_input
145
+ * Fixed error when creating booking from admin without creating order
146
+ * Fixed Woocommerce Dynamic Price issue with Advanced category price in second language
147
+ * Fix situation with filtering WC attributes calling by sku
148
+ * Fix a problem that you cannot delete booking from trash
149
+ * Fix prevent letters in multicurrency popup for number of decimals
150
+ * Fix accept only symbols in decimal separator for multi currency
151
+ * Resolved fatal error when a galler shortcode has a leading, trailing or extra comma
152
+ * Fix issue in show comments in all languages functionality
153
+ * Fixed displaying WYSIWYG fields from additional plugins as single line text
154
+ * Fix small issue with order of breadcrumbs in second language
155
+ * Fix default term value in product variation when using display as translated feature
156
+ * Allow users to comment on product that they have bought, but in other languages
157
+ * Fixed WooCommerce Dynamic Pricing compatibility -> filtering by role not applied for secondary currency
158
+ * Added support for translating WooCommerce terms and conditions
159
+ * Fixed totals in order if the product has custom price in second currency
160
+ * Fix displaying email subject when you have 3rd party email notification plugin
161
+ * Fixed product view price when secondary currency have different range of dates for sale price
162
+ * Fix small issue with creations of WooCommerce Booking in backend
163
+
164
  = 4.3.3 =
165
  * Fixed small issue in WC Bookings where block cost in other currencies is not saved correctly
166
  * Fix compatibility issue with WC Product Addons and not displayed label in secondary language
res/js/multi-currency.js CHANGED
@@ -32,6 +32,13 @@ jQuery( function($){
32
  $(document).on('change','.currency_option_decimals', WCML_Multi_Currency.price_preview);
33
  $(document).on('change','.currency_code select', WCML_Multi_Currency.price_preview);
34
 
 
 
 
 
 
 
 
35
  $(document).on('keyup','.wcml-exchange-rate', WCML_Multi_Currency.exchange_rate_check);
36
 
37
  if($('#wcml_mc_options').length){
@@ -148,11 +155,9 @@ jQuery( function($){
148
  save_currency: function(){
149
 
150
  var parent = $(this).closest('.wcml-dialog-container');
151
-
152
- var chk_deci = WCML_Multi_Currency.check_on_numeric(parent,'.currency_option_decimals');
153
  var chk_autosub = WCML_Multi_Currency.check_on_numeric(parent,'.abstract_amount');
154
 
155
- if( chk_deci || chk_autosub ){
156
  return false;
157
  }
158
 
32
  $(document).on('change','.currency_option_decimals', WCML_Multi_Currency.price_preview);
33
  $(document).on('change','.currency_code select', WCML_Multi_Currency.price_preview);
34
 
35
+ $(document).on('keypress', '.currency_option_decimals', function (event) {
36
+ // 8 for backspace, 0 for null values, 48-57 for 0-9 numbers
37
+ if (event.which != 8 && event.which != 0 && event.which < 48 || event.which > 57) {
38
+ event.preventDefault();
39
+ }
40
+ });
41
+
42
  $(document).on('keyup','.wcml-exchange-rate', WCML_Multi_Currency.exchange_rate_check);
43
 
44
  if($('#wcml_mc_options').length){
155
  save_currency: function(){
156
 
157
  var parent = $(this).closest('.wcml-dialog-container');
 
 
158
  var chk_autosub = WCML_Multi_Currency.check_on_numeric(parent,'.abstract_amount');
159
 
160
+ if( chk_autosub ){
161
  return false;
162
  }
163
 
res/js/multi-currency.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function($){WCML_Multi_Currency={_currency_languages_saving:0,init:function(){$(document).ready(function(){WCML_Multi_Currency.setup_multi_currency_toggle();$(document).on("change",".currency_code select",WCML_Multi_Currency.select_currency);$(document).on("click",".delete_currency",WCML_Multi_Currency.delete_currency);$(document).on("click",".wcml_currency_options .currency_options_save",WCML_Multi_Currency.save_currency);$(document).on("click",".js-display-tooltip",WCML_Multi_Currency.tooltip);$(document).on("click",".currency_languages a.otgs-ico-no",WCML_Multi_Currency.enable_currency_for_language);$(document).on("click",".currency_languages a.otgs-ico-yes",WCML_Multi_Currency.disable_currency_for_language);$(document).on("change",".default_currency select",WCML_Multi_Currency.change_default_currency);WCML_Multi_Currency.setup_currencies_sorting();$(document).on("change",".currency_option_position",WCML_Multi_Currency.price_preview);$(document).on("change",".currency_option_thousand_sep",WCML_Multi_Currency.price_preview);$(document).on("change",".currency_option_decimal_sep",WCML_Multi_Currency.price_preview);$(document).on("change",".currency_option_decimals",WCML_Multi_Currency.price_preview);$(document).on("change",".currency_code select",WCML_Multi_Currency.price_preview);$(document).on("keyup",".wcml-exchange-rate",WCML_Multi_Currency.exchange_rate_check);if($("#wcml_mc_options").length){WCML_Multi_Currency.wcml_mc_form_submitted=false;WCML_Multi_Currency.read_form_fields_status();window.onbeforeunload=function(e){if(!WCML_Multi_Currency.wcml_mc_form_submitted&&WCML_Multi_Currency.form_fields_changed()||WCML_Multi_Currency.is_update_currency_lang_in_progress()){return $("#wcml_warn_message").val()}};$("#wcml_mc_options").on("submit",function(){WCML_Multi_Currency.wcml_mc_form_submitted=true})}})},setup_multi_currency_toggle:function(){$("#multi_currency_independent").change(function(){if($(this).attr("checked")=="checked"){$("#currency-switcher, #currency-switcher-widget, #currency-switcher-product, #multi-currency-per-language-details, #online-exchange-rates").fadeIn()}else{$("#currency-switcher, #currency-switcher-widget, #currency-switcher-product, #multi-currency-per-language-details, #online-exchange-rates").fadeOut()}})},select_currency:function(){var parent=$(this).closest(".wcml_currency_options");var close_button=parent.find(".wcml-dialog-close-button");close_button.attr("data-currency",$(this).val());close_button.attr("data-symbol",$(this).find("option:selected").attr("data-symbol"));parent.find(".this-currency").html($(this).val())},delete_currency:function(e){e.preventDefault();var is_return=false;var currency=$(this).data("currency");var currency_name=$(this).data("currency_name");var currency_symbol=$(this).data("currency_symbol");$(".currency_lang_table .wcml-row-currency-lang:first .currency_languages").each(function(){if(!WCML_Multi_Currency.check_currency_language($(this).find("li").data("lang"),currency)){is_return=true;return false}});if(is_return){return}$("#currency_row_"+currency+" .currency_action_update").hide();var ajaxLoader=$('<span class="spinner" style="visibility: visible;margin:0;">');$(this).hide();$(this).parent().append(ajaxLoader).show();$.ajax({type:"post",url:ajaxurl,data:{action:"wcml_delete_currency",wcml_nonce:$("#del_currency_nonce").val(),code:currency},success:function(response){$("#currency_row_"+currency).remove();$("#currency_row_langs_"+currency).remove();$("#currency_row_del_"+currency).remove();$("#wcml_currencies_order .wcml_currencies_order_"+currency).remove();$("#wcml_currency_options_code_").prepend('<option data-symbol="'+currency_symbol+'" value="'+currency+'">'+currency_name+"</option>");$("#wcml_currency_options_code_").val(currency).trigger("change");$("#currency-lang-table").find("tr.default_currency select").each(function(){$(this).find("option[value='"+currency+"']").remove()});$(".wcml-ui-dialog").each(function(){WCML_Currency_Switcher_Settings.currency_switcher_preview($(this))});if($(".wcml-row-currency").length==1){$("#online-exchange-rates-no-currencies").next().hide();$("#online-exchange-rates-no-currencies").show()}},done:function(){ajaxLoader.remove()}});return false},save_currency:function(){var parent=$(this).closest(".wcml-dialog-container");var chk_deci=WCML_Multi_Currency.check_on_numeric(parent,".currency_option_decimals");var chk_autosub=WCML_Multi_Currency.check_on_numeric(parent,".abstract_amount");if(chk_deci||chk_autosub){return false}$(".wcml-currency-options-dialog :submit, .wcml-currency-options-dialog :button").prop("disabled",true);var currency=parent.find('[name="currency_options[code]"]').val();var ajaxLoader=$('<span class="spinner" style="visibility:visible;position:absolute;margin-left:10px;"></span>');ajaxLoader.show();$(this).parent().prepend(ajaxLoader);$.ajax({url:ajaxurl,type:"POST",dataType:"json",data:parent.find('[name^="currency_options"]').serialize()+"&action=wcml_save_currency&wcml_nonce="+jQuery("#wcml_save_currency_nonce").val(),success:function(response){parent.find(".wcml-dialog-close-button").trigger("click");$(".wcml-ui-dialog").each(function(){WCML_Currency_Switcher_Settings.currency_switcher_preview($(this))});if($("#currency_row_"+currency).length==0){var tr=$("#currency-table tr.wcml-row-currency:last").clone();tr.attr("id","currency_row_"+currency);var edit_link=tr.find(".wcml-col-edit a");edit_link.attr("data-content","wcml_currency_options_"+currency);edit_link.attr("data-currency",currency);edit_link.data("dialog","wcml_currency_options_"+currency);edit_link.removeClass("hidden");$("#currency-table").find("tr.default_currency").before(tr);var tr=$(".empty-currency-language-row").clone();tr.attr("id","currency_row_langs_"+currency);$("#currency-lang-table").find("tr.default_currency").before(tr);tr.removeClass("hidden empty-currency-language-row");tr.find(".on a").each(function(){$(this).attr("data-currency",currency);$(this).attr("title",$(this).attr("title").replace("%code%",response.currency_name));$(this).attr("data-title-alt",$(this).attr("data-title-alt").replace("%code%",response.currency_name))});$("#currency-lang-table").find("tr.default_currency select").each(function(){$(this).append('<option value="'+currency+'">'+currency+"</option>")});$("#wcml_currencies_order").append('<li class="wcml_currencies_order_'+currency+' ui-sortable-handle" cur="'+currency+'">'+response.currency_name_formatted+"</li>");var tr=$("#currency-delete-table tr.wcml-row-currency-del:last").clone();tr.attr("id","currency_row_del_"+currency);var del_link=tr.find(".delete_currency");del_link.removeClass("hidden");del_link.attr("data-currency",currency);del_link.attr("data-currency_name",response.currency_name);del_link.attr("data-currency_symbol",response.currency_symbol);$("#currency-delete-table").find("tr.default_currency").before(tr)}$("#currency_row_"+currency+" .wcml-col-currency").html(response.currency_name_formatted);$("#currency_row_"+currency+" .wcml-col-rate").html(response.currency_meta_info);$("#wcml_currency_options_"+currency).remove();$("#wcml_mc_options").before(response.currency_options);$('#wcml_currency_options_code_ option[value="'+currency+'"]').remove();if($("#online-exchange-rates-no-currencies").is(":visible")){$("#online-exchange-rates-no-currencies").hide();$("#online-exchange-rates-no-currencies").next().show()}}});return false},check_on_numeric:function(parent,elem){var messageContainer=$('<span class="wcml-error">');if(!WCML_Multi_Currency.is_number(parent.find(elem).val())){if(parent.find(elem).parent().find(".wcml-error").size()==0){parent.find(elem).parent().append(messageContainer);messageContainer.text(parent.find(elem).data("message"))}return true}else{if(parent.find(elem).parent().find(".wcml-error").size()>0){parent.find(elem).parent().find(".wcml-error").remove()}return false}},tooltip:function(){var $thiz=$(this);$(".wp-pointer").fadeOut(100);$(this).pointer({content:"<h3>"+$thiz.data("header")+"</h3><p>"+$thiz.data("content")+"</p>",position:{edge:"left",align:"center",offset:"15 0"}}).pointer("open")},enable_currency_for_language:function(e){if(WCML_Multi_Currency.is_update_currency_lang_in_progress())return false;e.preventDefault();$(this).addClass("spinner").removeClass("otgs-ico-no").css("visibility","visible");var index=$(this).closest("tr")[0].rowIndex;$('.default_currency select[rel="'+$(this).data("language")+'"]').append('<option value="'+$(this).data("currency")+'">'+$(this).data("currency")+"</option>");WCML_Multi_Currency.update_currency_lang($(this),1,0);var title_alt=$(this).data("title-alt");$(this).data("title-alt",$(this).attr("title"));$(this).attr("title",title_alt)},disable_currency_for_language:function(e){if(WCML_Multi_Currency.is_update_currency_lang_in_progress())return false;e.preventDefault();$(this).addClass("spinner").removeClass("otgs-ico-yes").css("visibility","visible");var lang=$(this).data("language");if(!WCML_Multi_Currency.check_currency_language(lang)){$(this).removeClass("spinner").addClass("otgs-ico-yes");return}var index=$(this).closest("tr")[0].rowIndex;if($('.currency_languages select[rel="'+$(this).data("language")+'"]').val()==$(this).data("currency")){WCML_Multi_Currency.update_currency_lang($(this),0,1)}else{WCML_Multi_Currency.update_currency_lang($(this),0,0)}$('.default_currency select[rel="'+$(this).data("language")+'"] option[value="'+$(this).data("currency")+'"]').remove();var title_alt=$(this).data("title-alt");$(this).data("title-alt",$(this).attr("title"));$(this).attr("title",title_alt)},check_currency_language:function(lang,currency){var elem=$('#currency-lang-table a.otgs-ico-yes[data-language="'+lang+'"]');if(currency){elem=$('#currency-lang-table a.otgs-ico-yes[data-language="'+lang+'"]').not($('[data-currency="'+currency+'"]'))}if(elem.length==0){alert($("#wcml_warn_disable_language_massage").val());return false}return true},is_update_currency_lang_in_progress:function(){var is=typeof WCML_Multi_Currency._update_currency_lang_sync_flag!="undefined"&&WCML_Multi_Currency._update_currency_lang_sync_flag==1;return is},set_update_currency_lang_in_progress:function(val){WCML_Multi_Currency._update_currency_lang_sync_flag=val},update_currency_lang:function(elem,value,upd_def){WCML_Multi_Currency._currency_languages_saving++;$("#wcml_mc_options :submit").attr("disabled","disabled");$('input[name="wcml_mc_options"]').attr("disabled","disabled");var lang=elem.data("language");var code=elem.data("currency");discard=true;WCML_Multi_Currency.set_update_currency_lang_in_progress(1);$.ajax({type:"post",url:ajaxurl,data:{action:"wcml_update_currency_lang",value:value,lang:lang,code:code,wcml_nonce:$("#update_currency_lang_nonce").val()},success:function(){if(upd_def){WCML_Multi_Currency.update_default_currency(lang,0)}},complete:function(){$('input[name="wcml_mc_options"]').removeAttr("disabled");discard=false;elem.removeClass("spinner").css("visibility","visible");if(value){elem.addClass("otgs-ico-yes")}else{elem.addClass("otgs-ico-no")}WCML_Multi_Currency._currency_languages_saving--;if(WCML_Multi_Currency._currency_languages_saving==0){$("#wcml_mc_options :submit").removeAttr("disabled")}WCML_Multi_Currency.set_update_currency_lang_in_progress(0)}})},change_default_currency:function(){WCML_Multi_Currency.update_default_currency($(this).attr("rel"),$(this).val(),$(this))},update_default_currency:function(lang,code,select){$("#wcml_mc_options_submit").attr("disabled","disabled");if(select){var ajaxLoader=$('<span class="spinner" style="visibility: visible;float:none;position: absolute">');select.parent().append(ajaxLoader)}discard=true;$.ajax({type:"post",url:ajaxurl,data:{action:"wcml_update_default_currency",lang:lang,code:code,wcml_nonce:$("#wcml_update_default_currency_nonce").val()},complete:function(){discard=false;$("#wcml_mc_options_submit").removeAttr("disabled");if(select){select.parent().find(".spinner").remove()}}})},is_number:function(n){return!isNaN(parseFloat(n))&&isFinite(n)},setup_currencies_sorting:function(){$("#wcml_currencies_order").sortable({update:function(){var currencies_order=[];$("#wcml_currencies_order").find("li").each(function(){currencies_order.push($(this).attr("cur"))});$.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"wcml_currencies_order",wcml_nonce:$("#wcml_currencies_order_order_nonce").val(),order:currencies_order.join(";")},success:function(resp){if(resp.success){fadeInAjxResp(".wcml_currencies_order_ajx_resp",resp.data.message);$(".wcml-ui-dialog").each(function(){WCML_Currency_Switcher_Settings.currency_switcher_preview($(this))})}}})}})},price_preview:function(){var parent=$(this).closest(".wcml_currency_options");var position=parent.find(".currency_option_position").val();var thousand_sep=parent.find(".currency_option_thousand_sep").val();var thousand_sep=parent.find(".currency_option_thousand_sep").val();var decimal_sep=parent.find(".currency_option_decimal_sep").val();var symbol=$(this).closest(".wcml_currency_options").find(".wcml-dialog-close-button").attr("data-symbol");var decimals="56789".substr(0,parent.find(".currency_option_decimals").val());if(decimals==""){decimal_sep=""}var format="";switch(position){case"left":format="{symbol}1{thousand_sep}234{decimal_sep}{decimals}";break;case"right":format="1{thousand_sep}234{decimal_sep}{decimals}{symbol}";break;case"left_space":format="{symbol}&nbsp;1{thousand_sep}234{decimal_sep}{decimals}";break;case"right_space":format="1{thousand_sep}234{decimal_sep}{decimals}&nbsp;{symbol}";break}var preview=format.replace(/\{symbol\}/,symbol).replace(/\{thousand_sep\}/,thousand_sep).replace(/\{decimal_sep\}/,decimal_sep).replace(/\{decimals\}/,decimals);parent.find(".wcml-co-preview-value").html(preview);return false},read_form_fields_status:function(){this.mc_form_status=$("#wcml_mc_options").serialize()},form_fields_changed:function(){return this.mc_form_status!=$("#wcml_mc_options").serialize()},exchange_rate_check:function(e){if(typeof KeyEvent=="undefined"){var KeyEvent={DOM_SUBTRACT:109,DOM_DASH:189,DOM_E:69}}if($(this).val()<=0||!WCML_Multi_Currency.is_number($(this).val())||e.keyCode==KeyEvent.DOM_SUBTRACT||e.keyCode==KeyEvent.DOM_DASH||e.keyCode==KeyEvent.DOM_E){$(".wcml-co-set-rate .wcml-error").fadeIn();$(".currency_options_save").attr("disabled","disabled")}else{$(".wcml-co-set-rate .wcml-error").fadeOut();$(".currency_options_save").removeAttr("disabled")}}};WCML_Multi_Currency.init()});
1
+ jQuery(function($){WCML_Multi_Currency={_currency_languages_saving:0,init:function(){$(document).ready(function(){WCML_Multi_Currency.setup_multi_currency_toggle();$(document).on("change",".currency_code select",WCML_Multi_Currency.select_currency);$(document).on("click",".delete_currency",WCML_Multi_Currency.delete_currency);$(document).on("click",".wcml_currency_options .currency_options_save",WCML_Multi_Currency.save_currency);$(document).on("click",".js-display-tooltip",WCML_Multi_Currency.tooltip);$(document).on("click",".currency_languages a.otgs-ico-no",WCML_Multi_Currency.enable_currency_for_language);$(document).on("click",".currency_languages a.otgs-ico-yes",WCML_Multi_Currency.disable_currency_for_language);$(document).on("change",".default_currency select",WCML_Multi_Currency.change_default_currency);WCML_Multi_Currency.setup_currencies_sorting();$(document).on("change",".currency_option_position",WCML_Multi_Currency.price_preview);$(document).on("change",".currency_option_thousand_sep",WCML_Multi_Currency.price_preview);$(document).on("change",".currency_option_decimal_sep",WCML_Multi_Currency.price_preview);$(document).on("change",".currency_option_decimals",WCML_Multi_Currency.price_preview);$(document).on("change",".currency_code select",WCML_Multi_Currency.price_preview);$(document).on("keypress",".currency_option_decimals",function(event){if(event.which!=8&&event.which!=0&&event.which<48||event.which>57){event.preventDefault()}});$(document).on("keyup",".wcml-exchange-rate",WCML_Multi_Currency.exchange_rate_check);if($("#wcml_mc_options").length){WCML_Multi_Currency.wcml_mc_form_submitted=false;WCML_Multi_Currency.read_form_fields_status();window.onbeforeunload=function(e){if(!WCML_Multi_Currency.wcml_mc_form_submitted&&WCML_Multi_Currency.form_fields_changed()||WCML_Multi_Currency.is_update_currency_lang_in_progress()){return $("#wcml_warn_message").val()}};$("#wcml_mc_options").on("submit",function(){WCML_Multi_Currency.wcml_mc_form_submitted=true})}})},setup_multi_currency_toggle:function(){$("#multi_currency_independent").change(function(){if($(this).attr("checked")=="checked"){$("#currency-switcher, #currency-switcher-widget, #currency-switcher-product, #multi-currency-per-language-details, #online-exchange-rates").fadeIn()}else{$("#currency-switcher, #currency-switcher-widget, #currency-switcher-product, #multi-currency-per-language-details, #online-exchange-rates").fadeOut()}})},select_currency:function(){var parent=$(this).closest(".wcml_currency_options");var close_button=parent.find(".wcml-dialog-close-button");close_button.attr("data-currency",$(this).val());close_button.attr("data-symbol",$(this).find("option:selected").attr("data-symbol"));parent.find(".this-currency").html($(this).val())},delete_currency:function(e){e.preventDefault();var is_return=false;var currency=$(this).data("currency");var currency_name=$(this).data("currency_name");var currency_symbol=$(this).data("currency_symbol");$(".currency_lang_table .wcml-row-currency-lang:first .currency_languages").each(function(){if(!WCML_Multi_Currency.check_currency_language($(this).find("li").data("lang"),currency)){is_return=true;return false}});if(is_return){return}$("#currency_row_"+currency+" .currency_action_update").hide();var ajaxLoader=$('<span class="spinner" style="visibility: visible;margin:0;">');$(this).hide();$(this).parent().append(ajaxLoader).show();$.ajax({type:"post",url:ajaxurl,data:{action:"wcml_delete_currency",wcml_nonce:$("#del_currency_nonce").val(),code:currency},success:function(response){$("#currency_row_"+currency).remove();$("#currency_row_langs_"+currency).remove();$("#currency_row_del_"+currency).remove();$("#wcml_currencies_order .wcml_currencies_order_"+currency).remove();$("#wcml_currency_options_code_").prepend('<option data-symbol="'+currency_symbol+'" value="'+currency+'">'+currency_name+"</option>");$("#wcml_currency_options_code_").val(currency).trigger("change");$("#currency-lang-table").find("tr.default_currency select").each(function(){$(this).find("option[value='"+currency+"']").remove()});$(".wcml-ui-dialog").each(function(){WCML_Currency_Switcher_Settings.currency_switcher_preview($(this))});if($(".wcml-row-currency").length==1){$("#online-exchange-rates-no-currencies").next().hide();$("#online-exchange-rates-no-currencies").show()}},done:function(){ajaxLoader.remove()}});return false},save_currency:function(){var parent=$(this).closest(".wcml-dialog-container");var chk_autosub=WCML_Multi_Currency.check_on_numeric(parent,".abstract_amount");if(chk_autosub){return false}$(".wcml-currency-options-dialog :submit, .wcml-currency-options-dialog :button").prop("disabled",true);var currency=parent.find('[name="currency_options[code]"]').val();var ajaxLoader=$('<span class="spinner" style="visibility:visible;position:absolute;margin-left:10px;"></span>');ajaxLoader.show();$(this).parent().prepend(ajaxLoader);$.ajax({url:ajaxurl,type:"POST",dataType:"json",data:parent.find('[name^="currency_options"]').serialize()+"&action=wcml_save_currency&wcml_nonce="+jQuery("#wcml_save_currency_nonce").val(),success:function(response){parent.find(".wcml-dialog-close-button").trigger("click");$(".wcml-ui-dialog").each(function(){WCML_Currency_Switcher_Settings.currency_switcher_preview($(this))});if($("#currency_row_"+currency).length==0){var tr=$("#currency-table tr.wcml-row-currency:last").clone();tr.attr("id","currency_row_"+currency);var edit_link=tr.find(".wcml-col-edit a");edit_link.attr("data-content","wcml_currency_options_"+currency);edit_link.attr("data-currency",currency);edit_link.data("dialog","wcml_currency_options_"+currency);edit_link.removeClass("hidden");$("#currency-table").find("tr.default_currency").before(tr);var tr=$(".empty-currency-language-row").clone();tr.attr("id","currency_row_langs_"+currency);$("#currency-lang-table").find("tr.default_currency").before(tr);tr.removeClass("hidden empty-currency-language-row");tr.find(".on a").each(function(){$(this).attr("data-currency",currency);$(this).attr("title",$(this).attr("title").replace("%code%",response.currency_name));$(this).attr("data-title-alt",$(this).attr("data-title-alt").replace("%code%",response.currency_name))});$("#currency-lang-table").find("tr.default_currency select").each(function(){$(this).append('<option value="'+currency+'">'+currency+"</option>")});$("#wcml_currencies_order").append('<li class="wcml_currencies_order_'+currency+' ui-sortable-handle" cur="'+currency+'">'+response.currency_name_formatted+"</li>");var tr=$("#currency-delete-table tr.wcml-row-currency-del:last").clone();tr.attr("id","currency_row_del_"+currency);var del_link=tr.find(".delete_currency");del_link.removeClass("hidden");del_link.attr("data-currency",currency);del_link.attr("data-currency_name",response.currency_name);del_link.attr("data-currency_symbol",response.currency_symbol);$("#currency-delete-table").find("tr.default_currency").before(tr)}$("#currency_row_"+currency+" .wcml-col-currency").html(response.currency_name_formatted);$("#currency_row_"+currency+" .wcml-col-rate").html(response.currency_meta_info);$("#wcml_currency_options_"+currency).remove();$("#wcml_mc_options").before(response.currency_options);$('#wcml_currency_options_code_ option[value="'+currency+'"]').remove();if($("#online-exchange-rates-no-currencies").is(":visible")){$("#online-exchange-rates-no-currencies").hide();$("#online-exchange-rates-no-currencies").next().show()}}});return false},check_on_numeric:function(parent,elem){var messageContainer=$('<span class="wcml-error">');if(!WCML_Multi_Currency.is_number(parent.find(elem).val())){if(parent.find(elem).parent().find(".wcml-error").size()==0){parent.find(elem).parent().append(messageContainer);messageContainer.text(parent.find(elem).data("message"))}return true}else{if(parent.find(elem).parent().find(".wcml-error").size()>0){parent.find(elem).parent().find(".wcml-error").remove()}return false}},tooltip:function(){var $thiz=$(this);$(".wp-pointer").fadeOut(100);$(this).pointer({content:"<h3>"+$thiz.data("header")+"</h3><p>"+$thiz.data("content")+"</p>",position:{edge:"left",align:"center",offset:"15 0"}}).pointer("open")},enable_currency_for_language:function(e){if(WCML_Multi_Currency.is_update_currency_lang_in_progress())return false;e.preventDefault();$(this).addClass("spinner").removeClass("otgs-ico-no").css("visibility","visible");var index=$(this).closest("tr")[0].rowIndex;$('.default_currency select[rel="'+$(this).data("language")+'"]').append('<option value="'+$(this).data("currency")+'">'+$(this).data("currency")+"</option>");WCML_Multi_Currency.update_currency_lang($(this),1,0);var title_alt=$(this).data("title-alt");$(this).data("title-alt",$(this).attr("title"));$(this).attr("title",title_alt)},disable_currency_for_language:function(e){if(WCML_Multi_Currency.is_update_currency_lang_in_progress())return false;e.preventDefault();$(this).addClass("spinner").removeClass("otgs-ico-yes").css("visibility","visible");var lang=$(this).data("language");if(!WCML_Multi_Currency.check_currency_language(lang)){$(this).removeClass("spinner").addClass("otgs-ico-yes");return}var index=$(this).closest("tr")[0].rowIndex;if($('.currency_languages select[rel="'+$(this).data("language")+'"]').val()==$(this).data("currency")){WCML_Multi_Currency.update_currency_lang($(this),0,1)}else{WCML_Multi_Currency.update_currency_lang($(this),0,0)}$('.default_currency select[rel="'+$(this).data("language")+'"] option[value="'+$(this).data("currency")+'"]').remove();var title_alt=$(this).data("title-alt");$(this).data("title-alt",$(this).attr("title"));$(this).attr("title",title_alt)},check_currency_language:function(lang,currency){var elem=$('#currency-lang-table a.otgs-ico-yes[data-language="'+lang+'"]');if(currency){elem=$('#currency-lang-table a.otgs-ico-yes[data-language="'+lang+'"]').not($('[data-currency="'+currency+'"]'))}if(elem.length==0){alert($("#wcml_warn_disable_language_massage").val());return false}return true},is_update_currency_lang_in_progress:function(){var is=typeof WCML_Multi_Currency._update_currency_lang_sync_flag!="undefined"&&WCML_Multi_Currency._update_currency_lang_sync_flag==1;return is},set_update_currency_lang_in_progress:function(val){WCML_Multi_Currency._update_currency_lang_sync_flag=val},update_currency_lang:function(elem,value,upd_def){WCML_Multi_Currency._currency_languages_saving++;$("#wcml_mc_options :submit").attr("disabled","disabled");$('input[name="wcml_mc_options"]').attr("disabled","disabled");var lang=elem.data("language");var code=elem.data("currency");discard=true;WCML_Multi_Currency.set_update_currency_lang_in_progress(1);$.ajax({type:"post",url:ajaxurl,data:{action:"wcml_update_currency_lang",value:value,lang:lang,code:code,wcml_nonce:$("#update_currency_lang_nonce").val()},success:function(){if(upd_def){WCML_Multi_Currency.update_default_currency(lang,0)}},complete:function(){$('input[name="wcml_mc_options"]').removeAttr("disabled");discard=false;elem.removeClass("spinner").css("visibility","visible");if(value){elem.addClass("otgs-ico-yes")}else{elem.addClass("otgs-ico-no")}WCML_Multi_Currency._currency_languages_saving--;if(WCML_Multi_Currency._currency_languages_saving==0){$("#wcml_mc_options :submit").removeAttr("disabled")}WCML_Multi_Currency.set_update_currency_lang_in_progress(0)}})},change_default_currency:function(){WCML_Multi_Currency.update_default_currency($(this).attr("rel"),$(this).val(),$(this))},update_default_currency:function(lang,code,select){$("#wcml_mc_options_submit").attr("disabled","disabled");if(select){var ajaxLoader=$('<span class="spinner" style="visibility: visible;float:none;position: absolute">');select.parent().append(ajaxLoader)}discard=true;$.ajax({type:"post",url:ajaxurl,data:{action:"wcml_update_default_currency",lang:lang,code:code,wcml_nonce:$("#wcml_update_default_currency_nonce").val()},complete:function(){discard=false;$("#wcml_mc_options_submit").removeAttr("disabled");if(select){select.parent().find(".spinner").remove()}}})},is_number:function(n){return!isNaN(parseFloat(n))&&isFinite(n)},setup_currencies_sorting:function(){$("#wcml_currencies_order").sortable({update:function(){var currencies_order=[];$("#wcml_currencies_order").find("li").each(function(){currencies_order.push($(this).attr("cur"))});$.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"wcml_currencies_order",wcml_nonce:$("#wcml_currencies_order_order_nonce").val(),order:currencies_order.join(";")},success:function(resp){if(resp.success){fadeInAjxResp(".wcml_currencies_order_ajx_resp",resp.data.message);$(".wcml-ui-dialog").each(function(){WCML_Currency_Switcher_Settings.currency_switcher_preview($(this))})}}})}})},price_preview:function(){var parent=$(this).closest(".wcml_currency_options");var position=parent.find(".currency_option_position").val();var thousand_sep=parent.find(".currency_option_thousand_sep").val();var thousand_sep=parent.find(".currency_option_thousand_sep").val();var decimal_sep=parent.find(".currency_option_decimal_sep").val();var symbol=$(this).closest(".wcml_currency_options").find(".wcml-dialog-close-button").attr("data-symbol");var decimals="56789".substr(0,parent.find(".currency_option_decimals").val());if(decimals==""){decimal_sep=""}var format="";switch(position){case"left":format="{symbol}1{thousand_sep}234{decimal_sep}{decimals}";break;case"right":format="1{thousand_sep}234{decimal_sep}{decimals}{symbol}";break;case"left_space":format="{symbol}&nbsp;1{thousand_sep}234{decimal_sep}{decimals}";break;case"right_space":format="1{thousand_sep}234{decimal_sep}{decimals}&nbsp;{symbol}";break}var preview=format.replace(/\{symbol\}/,symbol).replace(/\{thousand_sep\}/,thousand_sep).replace(/\{decimal_sep\}/,decimal_sep).replace(/\{decimals\}/,decimals);parent.find(".wcml-co-preview-value").html(preview);return false},read_form_fields_status:function(){this.mc_form_status=$("#wcml_mc_options").serialize()},form_fields_changed:function(){return this.mc_form_status!=$("#wcml_mc_options").serialize()},exchange_rate_check:function(e){if(typeof KeyEvent=="undefined"){var KeyEvent={DOM_SUBTRACT:109,DOM_DASH:189,DOM_E:69}}if($(this).val()<=0||!WCML_Multi_Currency.is_number($(this).val())||e.keyCode==KeyEvent.DOM_SUBTRACT||e.keyCode==KeyEvent.DOM_DASH||e.keyCode==KeyEvent.DOM_E){$(".wcml-co-set-rate .wcml-error").fadeIn();$(".currency_options_save").attr("disabled","disabled")}else{$(".wcml-co-set-rate .wcml-error").fadeOut();$(".currency_options_save").removeAttr("disabled")}}};WCML_Multi_Currency.init()});
templates/multi-currency/custom-currency-options.twig CHANGED
@@ -58,22 +58,24 @@
58
 
59
  <div class="wpml-form-row">
60
  <label for="wcml_currency_options_thousand_{{ args.currency_code }}">{{ form.thousand_sep.label }}</label>
61
- <input name="currency_options[thousand_sep]" type="text"
62
- class="currency_option_input currency_option_thousand_sep" value="{{ args.currency.thousand_sep }}"
63
- id="wcml_currency_options_thousand_{{ args.currency_code }}" />
 
64
  </div>
65
 
66
  <div class="wpml-form-row">
67
  <label for="wcml_currency_options_decimal_{{ args.currency_code }}">{{ form.decimal_sep.label }}</label>
68
- <input name="currency_options[decimal_sep]" type="text"
69
- class="currency_option_input currency_option_decimal_sep" value="{{ args.currency.decimal_sep }}"
70
- id="wcml_currency_options_decimal_{{ args.currency_code }}" />
 
71
  </div>
72
 
73
  <div class="wpml-form-row">
74
- <label for="wcml_currency_options_decimals_{{ args.currency_code }}" id="wcml_currency_options_decimals_{{ args.currency_code }}">{{ form.num_decimals.label }}</label>
75
  <input name="currency_options[num_decimals]" type="number" class="currency_option_decimals"
76
- value="{{ args.currency.num_decimals }}" min="0" step="1" max="5" data-message="{{ form.num_decimals.only_numeric }}" />
77
  </div>
78
 
79
  <hr/>
58
 
59
  <div class="wpml-form-row">
60
  <label for="wcml_currency_options_thousand_{{ args.currency_code }}">{{ form.thousand_sep.label }}</label>
61
+ <select class="currency_option_thousand_sep" name="currency_options[thousand_sep]" id="wcml_currency_options_thousand_{{ args.currency_code }}">
62
+ <option value="." {% if args.currency.thousand_sep == '.' %}selected="selected"{% endif %}>.</option>
63
+ <option value="," {% if args.currency.thousand_sep == ',' %}selected="selected"{% endif %}>,</option>
64
+ </select>
65
  </div>
66
 
67
  <div class="wpml-form-row">
68
  <label for="wcml_currency_options_decimal_{{ args.currency_code }}">{{ form.decimal_sep.label }}</label>
69
+ <select class="currency_option_decimal_sep" name="currency_options[decimal_sep]" id="wcml_currency_options_decimal_{{ args.currency_code }}">
70
+ <option value="." {% if args.currency.decimal_sep == '.' %}selected="selected"{% endif %}>.</option>
71
+ <option value="," {% if args.currency.decimal_sep == ',' %}selected="selected"{% endif %}>,</option>
72
+ </select>
73
  </div>
74
 
75
  <div class="wpml-form-row">
76
+ <label for="wcml_currency_options_decimals_{{ args.currency_code }}">{{ form.num_decimals.label }}</label>
77
  <input name="currency_options[num_decimals]" type="number" class="currency_option_decimals"
78
+ value="{{ args.currency.num_decimals }}" min="0" step="1" max="5" data-message="{{ form.num_decimals.only_numeric }}" id="wcml_currency_options_numbers_of_decimals_{{ args.currency_code }}"/>
79
  </div>
80
 
81
  <hr/>
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitb9a53d5d5db12fb6de70bc70d2bfd455::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit0e676152496e9f3b9d6510bdcac1d959::getLoader();
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInit953a92a3b6852d9006796ec863f6f9d3::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInit0feb850f3953f143979d624e1bc6bbfe::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitb9a53d5d5db12fb6de70bc70d2bfd455
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitb9a53d5d5db12fb6de70bc70d2bfd455
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitb9a53d5d5db12fb6de70bc70d2bfd455', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitb9a53d5d5db12fb6de70bc70d2bfd455', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInitb9a53d5d5db12fb6de70bc70d2bfd455::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit0e676152496e9f3b9d6510bdcac1d959
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit0e676152496e9f3b9d6510bdcac1d959', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit0e676152496e9f3b9d6510bdcac1d959', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit0e676152496e9f3b9d6510bdcac1d959::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInit953a92a3b6852d9006796ec863f6f9d3 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit953a92a3b6852d9006796ec863f6f9d3 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit953a92a3b6852d9006796ec863f6f9d3', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit953a92a3b6852d9006796ec863f6f9d3', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInit0feb850f3953f143979d624e1bc6bbfe {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit0feb850f3953f143979d624e1bc6bbfe', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit0feb850f3953f143979d624e1bc6bbfe', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitb9a53d5d5db12fb6de70bc70d2bfd455
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'C' =>
@@ -515,10 +515,10 @@ class ComposerStaticInitb9a53d5d5db12fb6de70bc70d2bfd455
515
  public static function getInitializer(ClassLoader $loader)
516
  {
517
  return \Closure::bind(function () use ($loader) {
518
- $loader->prefixLengthsPsr4 = ComposerStaticInitb9a53d5d5db12fb6de70bc70d2bfd455::$prefixLengthsPsr4;
519
- $loader->prefixDirsPsr4 = ComposerStaticInitb9a53d5d5db12fb6de70bc70d2bfd455::$prefixDirsPsr4;
520
- $loader->prefixesPsr0 = ComposerStaticInitb9a53d5d5db12fb6de70bc70d2bfd455::$prefixesPsr0;
521
- $loader->classMap = ComposerStaticInitb9a53d5d5db12fb6de70bc70d2bfd455::$classMap;
522
 
523
  }, null, ClassLoader::class);
524
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit0e676152496e9f3b9d6510bdcac1d959
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'C' =>
515
  public static function getInitializer(ClassLoader $loader)
516
  {
517
  return \Closure::bind(function () use ($loader) {
518
+ $loader->prefixLengthsPsr4 = ComposerStaticInit0e676152496e9f3b9d6510bdcac1d959::$prefixLengthsPsr4;
519
+ $loader->prefixDirsPsr4 = ComposerStaticInit0e676152496e9f3b9d6510bdcac1d959::$prefixDirsPsr4;
520
+ $loader->prefixesPsr0 = ComposerStaticInit0e676152496e9f3b9d6510bdcac1d959::$prefixesPsr0;
521
+ $loader->classMap = ComposerStaticInit0e676152496e9f3b9d6510bdcac1d959::$classMap;
522
 
523
  }, null, ClassLoader::class);
524
  }
wpml-config.xml CHANGED
@@ -140,5 +140,6 @@
140
  <key name="woocommerce_email_from_address" />
141
  <key name="woocommerce_registration_privacy_policy_text" />
142
  <key name="woocommerce_checkout_privacy_policy_text" />
 
143
  </admin-texts>
144
  </wpml-config>
140
  <key name="woocommerce_email_from_address" />
141
  <key name="woocommerce_registration_privacy_policy_text" />
142
  <key name="woocommerce_checkout_privacy_policy_text" />
143
+ <key name="woocommerce_checkout_terms_and_conditions_checkbox_text" />
144
  </admin-texts>
145
  </wpml-config>
wpml-woocommerce.php CHANGED
@@ -7,17 +7,17 @@
7
  Author URI: http://www.onthegosystems.com/
8
  Text Domain: woocommerce-multilingual
9
  Requires at least: 3.9
10
- Tested up to: 4.9.6
11
- Version: 4.3.3
12
  WC requires at least: 2.1.0
13
- WC tested up to: 3.4.3
14
  */
15
 
16
  if ( defined( 'WCML_VERSION' ) ) {
17
  return;
18
  }
19
 
20
- define( 'WCML_VERSION', '4.3.3' );
21
  define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
22
  define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
23
  define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );
7
  Author URI: http://www.onthegosystems.com/
8
  Text Domain: woocommerce-multilingual
9
  Requires at least: 3.9
10
+ Tested up to: 4.9.8
11
+ Version: 4.3.4
12
  WC requires at least: 2.1.0
13
+ WC tested up to: 3.4.4
14
  */
15
 
16
  if ( defined( 'WCML_VERSION' ) ) {
17
  return;
18
  }
19
 
20
+ define( 'WCML_VERSION', '4.3.4' );
21
  define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
22
  define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
23
  define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );