Version Description
- Fixed a small issue with the product translations editor (additional toolbar showing)
- Fixed a compatibility issue with Memcached on Siteground: product category archive pages were returning 404
- Bug fix: the price widget was not using the correct values with multi-currency mode on
- Bug fix: in some cases the costs for International Shipping were not calculated correctly in the secondary languages
- Bug fix: When using comma for a decimal separator, for custom prices, the rounded values were not determined correctly
- Bug fix: In some cases, translated product variations were displayed as 'out of stock' on the front end.
- Fixed a fatal error occurring when selecting the WPML admin language to 'All languages' on the WooCommerce settings page
- Compatibility with WooThemes Mix and Match Products
- Fixed a bug preventing a shipping to be set to a variation when the default language of the product was not English
- Fixed a bug that was sometimes preventing the 'incl. vat' suffix to be displayed on prices
- Fixed a compatibility issue with Gravity Forms Product Add-Ons
Download this release
Release Info
Developer | mihaimihai |
Plugin | WooCommerce Multilingual – run WooCommerce with WPML |
Version | 3.7.10 |
Comparing to | |
See all releases |
Code changes from version 3.7.9 to 3.7.10
- compatibility/assets/css/wcml-bookings.css +1 -0
- compatibility/class-wcml-accommodation-bookings.php +171 -0
- compatibility/class-wcml-bookings.php +4 -4
- compatibility/class-wcml-dynamic-pricing.php +17 -3
- compatibility/class-wcml-gravityforms-product-addons.php +0 -20
- compatibility/class-wcml-mix-and-match-products.php +67 -0
- compatibility/class-wcml-wc-name-your-price.php +24 -0
- inc/compatibility.class.php +13 -7
- inc/emails.class.php +3 -0
- inc/multi-currency-support.class.php +1 -13
- inc/multi-currency.class.php +3 -0
- inc/products.class.php +7 -4
- inc/terms.class.php +22 -12
- inc/url-translation.class.php +66 -87
- inc/wc-strings.class.php +14 -17
- menu/sub/products.php +3 -0
- readme.txt +15 -2
- wpml-woocommerce.php +2 -2
compatibility/assets/css/wcml-bookings.css
CHANGED
@@ -9,6 +9,7 @@
|
|
9 |
padding: 5px 0;
|
10 |
display: -webkit-flex;
|
11 |
display: flex;
|
|
|
12 |
-webkit-flex-direction: row;
|
13 |
flex-direction: row;
|
14 |
}
|
9 |
padding: 5px 0;
|
10 |
display: -webkit-flex;
|
11 |
display: flex;
|
12 |
+
display: -moz-box;
|
13 |
-webkit-flex-direction: row;
|
14 |
flex-direction: row;
|
15 |
}
|
compatibility/class-wcml-accommodation-bookings.php
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WCML_Accommodation_Bookings{
|
4 |
+
|
5 |
+
function __construct(){
|
6 |
+
|
7 |
+
add_action( 'woocommerce_accommodation_bookings_after_booking_base_cost' , array( $this, 'wcml_price_field_after_booking_base_cost' ) );
|
8 |
+
add_action( 'woocommerce_accommodation_bookings_after_booking_pricing_override_block_cost' , array( $this, 'wcml_price_field_after_booking_pricing_override_block_cost' ), 10, 2 );
|
9 |
+
add_action( 'woocommerce_accommodation_bookings_after_bookings_pricing' , array( $this , 'after_bookings_pricing' ) );
|
10 |
+
|
11 |
+
add_action( 'save_post', array( $this, 'save_custom_costs' ), 110, 2 );
|
12 |
+
add_filter( 'get_post_metadata', array( $this, 'product_price_filter'), 9, 4 );
|
13 |
+
}
|
14 |
+
|
15 |
+
function wcml_price_field_after_booking_base_cost( $post_id ){
|
16 |
+
|
17 |
+
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_base_cost' );
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
function wcml_price_field_after_booking_pricing_override_block_cost( $pricing, $post_id ){
|
22 |
+
|
23 |
+
$this->echo_wcml_price_field( $post_id, 'wcml_wc_booking_pricing_override_block_cost', $pricing );
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
function after_bookings_pricing( $post_id ){
|
28 |
+
global $woocommerce_wpml;
|
29 |
+
|
30 |
+
if( $woocommerce_wpml->products->is_original_product( $post_id ) && $woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ){
|
31 |
+
|
32 |
+
$custom_costs_status = get_post_meta( $post_id, '_wcml_custom_costs_status', true );
|
33 |
+
|
34 |
+
$checked = !$custom_costs_status ? 'checked="checked"' : ' ';
|
35 |
+
|
36 |
+
echo '<div class="wcml_custom_costs">';
|
37 |
+
|
38 |
+
echo '<input type="radio" name="_wcml_custom_costs" id="wcml_custom_costs_auto" value="0" class="wcml_custom_costs_input" '. $checked .' />';
|
39 |
+
echo '<label for="wcml_custom_costs_auto">'. __('Calculate costs in other currencies automatically', 'woocommerce-multilingual') .'</label>';
|
40 |
+
|
41 |
+
$checked = $custom_costs_status == 1 ? 'checked="checked"' : ' ';
|
42 |
+
|
43 |
+
echo '<input type="radio" name="_wcml_custom_costs" value="1" id="wcml_custom_costs_manually" class="wcml_custom_costs_input" '. $checked .' />';
|
44 |
+
echo '<label for="wcml_custom_costs_manually">'. __('Set costs in other currencies manually', 'woocommerce-multilingual') .'</label>';
|
45 |
+
|
46 |
+
wp_nonce_field( 'wcml_save_accommodation_bookings_custom_costs', '_wcml_custom_costs_nonce' );
|
47 |
+
|
48 |
+
echo '</div>';
|
49 |
+
}
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
function echo_wcml_price_field( $post_id, $field, $pricing = false, $check = true, $resource_id = false ){
|
54 |
+
global $woocommerce_wpml;
|
55 |
+
|
56 |
+
if( ( !$check || $woocommerce_wpml->products->is_original_product( $post_id ) ) && $woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ){
|
57 |
+
|
58 |
+
$currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
|
59 |
+
|
60 |
+
$wc_currencies = get_woocommerce_currencies();
|
61 |
+
|
62 |
+
echo '<div class="wcml_custom_cost_field" >';
|
63 |
+
|
64 |
+
foreach($currencies as $currency_code => $currency){
|
65 |
+
|
66 |
+
switch( $field ){
|
67 |
+
case 'wcml_wc_booking_base_cost':
|
68 |
+
woocommerce_wp_text_input( array( 'id' => 'wcml_wc_booking_base_cost', 'class'=>'wcml_bookings_custom_price', 'name' => 'wcml_wc_accommodation_booking_base_cost['.$currency_code.']', 'label' => get_woocommerce_currency_symbol($currency_code), 'description' => __( 'This is the cost per block booked. All other costs (for resources and persons) are added to this.', 'woocommerce-bookings' ), 'value' => get_post_meta( $post_id, '_wc_booking_base_cost_'.$currency_code, true ), 'type' => 'number', 'desc_tip' => true, 'custom_attributes' => array(
|
69 |
+
'min' => '',
|
70 |
+
'step' => '0.01'
|
71 |
+
) ) );
|
72 |
+
break;
|
73 |
+
|
74 |
+
|
75 |
+
case 'wcml_wc_booking_pricing_override_block_cost':
|
76 |
+
|
77 |
+
if( isset( $pricing[ 'override_block_'.$currency_code ] ) ){
|
78 |
+
$value = $pricing[ 'override_block_'.$currency_code ];
|
79 |
+
}else{
|
80 |
+
$value = '';
|
81 |
+
}
|
82 |
+
|
83 |
+
echo '<div class="wcml_bookings_range_block" >';
|
84 |
+
echo '<label>'. get_woocommerce_currency_symbol($currency_code) .'</label>';
|
85 |
+
echo '<input type="number" step="0.01" name="wcml_wc_accommodation_booking_pricing_override_block_cost['.$currency_code.']" class="wcml_bookings_custom_price" value="'. $value .'" placeholder="0" />';
|
86 |
+
echo '</div>';
|
87 |
+
break;
|
88 |
+
|
89 |
+
default:
|
90 |
+
break;
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
echo '</div>';
|
97 |
+
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
function save_custom_costs( $post_id, $post ){
|
102 |
+
global $woocommerce_wpml;
|
103 |
+
|
104 |
+
$nonce = filter_input( INPUT_POST, '_wcml_custom_costs_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
105 |
+
|
106 |
+
if( isset( $_POST['_wcml_custom_costs'] ) && isset( $nonce ) && wp_verify_nonce( $nonce, 'wcml_save_accommodation_bookings_custom_costs' ) ){
|
107 |
+
|
108 |
+
update_post_meta( $post_id, '_wcml_custom_costs_status', $_POST['_wcml_custom_costs'] );
|
109 |
+
|
110 |
+
if( $_POST['_wcml_custom_costs'] == 1 ){
|
111 |
+
|
112 |
+
$currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
|
113 |
+
|
114 |
+
foreach( $currencies as $code => $currency ){
|
115 |
+
|
116 |
+
$wc_booking_base_cost = $_POST[ 'wcml_wc_accommodation_booking_base_cost' ][ $code ];
|
117 |
+
update_post_meta( $post_id, '_wc_booking_base_cost_'.$code, $wc_booking_base_cost );
|
118 |
+
update_post_meta( $post_id, '_price_'.$code, $wc_booking_base_cost );
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
+
$updated_meta = array();
|
123 |
+
$booking_pricing = get_post_meta( $post_id, '_wc_booking_pricing', true );
|
124 |
+
|
125 |
+
foreach ( maybe_unserialize( $booking_pricing ) as $key => $prices ) {
|
126 |
+
|
127 |
+
$updated_meta[ $key ] = $prices;
|
128 |
+
|
129 |
+
foreach ( $currencies as $code => $currency ) {
|
130 |
+
|
131 |
+
$updated_meta[ $key ][ 'override_block_'.$code ] = $_POST[ 'wcml_wc_accommodation_booking_pricing_override_block_cost' ][ $code ];
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
+
update_post_meta( $post_id, '_wc_booking_pricing', $updated_meta );
|
138 |
+
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
}
|
143 |
+
|
144 |
+
function product_price_filter( $value, $object_id, $meta_key, $single ){
|
145 |
+
global $woocommerce_wpml;
|
146 |
+
|
147 |
+
if(
|
148 |
+
get_post_type( $object_id ) == 'product' &&
|
149 |
+
$meta_key == '_price' &&
|
150 |
+
$woocommerce_wpml->settings[ 'enable_multi_currency' ] == WCML_MULTI_CURRENCIES_INDEPENDENT &&
|
151 |
+
!is_admin() &&
|
152 |
+
( $currency = $woocommerce_wpml->multi_currency_support->get_client_currency() ) != get_option( 'woocommerce_currency' )
|
153 |
+
) {
|
154 |
+
|
155 |
+
remove_filter( 'get_post_metadata', array( $this, 'product_price_filter' ), 9, 4 );
|
156 |
+
|
157 |
+
$original_language = $woocommerce_wpml->products->get_original_product_language( $object_id );
|
158 |
+
$original_product = apply_filters( 'translate_object_id', $object_id, 'product', true, $original_language );
|
159 |
+
|
160 |
+
if ( get_post_meta( $original_product, '_wcml_custom_costs_status' ) ) {
|
161 |
+
|
162 |
+
$price = get_post_meta( $object_id, '_price_' . $currency , true );
|
163 |
+
}
|
164 |
+
|
165 |
+
add_filter( 'get_post_metadata', array( $this, 'product_price_filter' ), 9, 4 );
|
166 |
+
}
|
167 |
+
|
168 |
+
return isset( $price) ? $price : $value;
|
169 |
+
}
|
170 |
+
|
171 |
+
}
|
compatibility/class-wcml-bookings.php
CHANGED
@@ -19,7 +19,7 @@ class WCML_Bookings{
|
|
19 |
|
20 |
add_action( 'admin_footer', array( $this, 'load_assets' ) );
|
21 |
|
22 |
-
add_action( 'save_post', array( $this, 'save_custom_costs' ),
|
23 |
add_action( 'wcml_before_sync_product_data', array( $this, 'sync_bookings' ), 10, 3 );
|
24 |
add_action( 'wcml_before_sync_product', array( $this, 'sync_booking_data' ), 10, 2 );
|
25 |
|
@@ -261,7 +261,7 @@ class WCML_Bookings{
|
|
261 |
function after_bookings_pricing( $post_id ){
|
262 |
global $woocommerce_wpml;
|
263 |
|
264 |
-
if( $woocommerce_wpml->products->is_original_product( $post_id ) && $woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ){
|
265 |
|
266 |
$custom_costs_status = get_post_meta( $post_id, '_wcml_custom_costs_status', true );
|
267 |
|
@@ -290,7 +290,7 @@ class WCML_Bookings{
|
|
290 |
$nonce = filter_input( INPUT_POST, '_wcml_custom_costs_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
291 |
|
292 |
if( isset( $_POST['_wcml_custom_costs'] ) && isset( $nonce ) && wp_verify_nonce( $nonce, 'wcml_save_custom_costs' ) ){
|
293 |
-
|
294 |
update_post_meta( $post_id, '_wcml_custom_costs_status', $_POST['_wcml_custom_costs'] );
|
295 |
|
296 |
if( $_POST['_wcml_custom_costs'] == 1 ){
|
@@ -904,7 +904,7 @@ class WCML_Bookings{
|
|
904 |
}
|
905 |
|
906 |
function wc_bookings_process_cost_rules_override_block_cost( $override_cost, $fields, $key ){
|
907 |
-
return $this->filter_pricing_cost( $override_cost, $fields, '
|
908 |
}
|
909 |
|
910 |
function filter_pricing_cost( $cost, $fields, $name, $key ){
|
19 |
|
20 |
add_action( 'admin_footer', array( $this, 'load_assets' ) );
|
21 |
|
22 |
+
add_action( 'save_post', array( $this, 'save_custom_costs' ), 110, 2 );
|
23 |
add_action( 'wcml_before_sync_product_data', array( $this, 'sync_bookings' ), 10, 3 );
|
24 |
add_action( 'wcml_before_sync_product', array( $this, 'sync_booking_data' ), 10, 2 );
|
25 |
|
261 |
function after_bookings_pricing( $post_id ){
|
262 |
global $woocommerce_wpml;
|
263 |
|
264 |
+
if( in_array( 'booking', wp_get_post_terms( $post_id, 'product_type', array( "fields" => "names" ) ) ) && $woocommerce_wpml->products->is_original_product( $post_id ) && $woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ){
|
265 |
|
266 |
$custom_costs_status = get_post_meta( $post_id, '_wcml_custom_costs_status', true );
|
267 |
|
290 |
$nonce = filter_input( INPUT_POST, '_wcml_custom_costs_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
|
291 |
|
292 |
if( isset( $_POST['_wcml_custom_costs'] ) && isset( $nonce ) && wp_verify_nonce( $nonce, 'wcml_save_custom_costs' ) ){
|
293 |
+
|
294 |
update_post_meta( $post_id, '_wcml_custom_costs_status', $_POST['_wcml_custom_costs'] );
|
295 |
|
296 |
if( $_POST['_wcml_custom_costs'] == 1 ){
|
904 |
}
|
905 |
|
906 |
function wc_bookings_process_cost_rules_override_block_cost( $override_cost, $fields, $key ){
|
907 |
+
return $this->filter_pricing_cost( $override_cost, $fields, 'override_block_', $key );
|
908 |
}
|
909 |
|
910 |
function filter_pricing_cost( $cost, $fields, $name, $key ){
|
compatibility/class-wcml-dynamic-pricing.php
CHANGED
@@ -40,11 +40,25 @@ class WCML_Dynamic_Pricing{
|
|
40 |
|
41 |
|
42 |
function woocommerce_dynamic_pricing_is_applied_to($process_discounts, $_product, $module_id, $obj,$cat_id){
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
global $sitepress;
|
45 |
-
$
|
46 |
-
$process_discounts = is_object_in_term($_product->id, 'product_cat', $
|
|
|
47 |
}
|
|
|
|
|
48 |
|
49 |
return $process_discounts;
|
50 |
}
|
40 |
|
41 |
|
42 |
function woocommerce_dynamic_pricing_is_applied_to($process_discounts, $_product, $module_id, $obj,$cat_id){
|
43 |
+
|
44 |
+
if (is_numeric($cat_id)) {
|
45 |
+
$cat_id = array($cat_id);
|
46 |
+
}
|
47 |
+
|
48 |
+
foreach ($cat_id as $cid) {
|
49 |
+
|
50 |
+
if ($process_discounts) {
|
51 |
+
continue;
|
52 |
+
}
|
53 |
+
|
54 |
+
if($cid && isset($obj->available_rulesets) && count($obj->available_rulesets) > 0){
|
55 |
global $sitepress;
|
56 |
+
$cid = apply_filters( 'translate_object_id',$cid,'product_cat',true,$sitepress->get_current_language());
|
57 |
+
$process_discounts = is_object_in_term($_product->id, 'product_cat', $cid);
|
58 |
+
}
|
59 |
}
|
60 |
+
|
61 |
+
|
62 |
|
63 |
return $process_discounts;
|
64 |
}
|
compatibility/class-wcml-gravityforms-product-addons.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class WCML_Gravityforms_Product_Addons {
|
3 |
-
public function __construct() {
|
4 |
-
add_filter('gform_form_post_get_meta', array($this, 'gform_form_post_get_meta'), 10, 1);
|
5 |
-
}
|
6 |
-
|
7 |
-
public function gform_form_post_get_meta($value) {
|
8 |
-
|
9 |
-
if (isset($value['fields']) && is_array($value['fields'])) {
|
10 |
-
foreach ($value['fields'] as $id => $data) {
|
11 |
-
if (isset($data->label) && isset($data->id)) {
|
12 |
-
$value['fields'][$id]->label = apply_filters( 'wpml_translate_single_string', $data->label, "gravity_form-{$data->id}", "field-{$data->id}-label" );
|
13 |
-
}
|
14 |
-
}
|
15 |
-
}
|
16 |
-
|
17 |
-
return $value;
|
18 |
-
}
|
19 |
-
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compatibility/class-wcml-mix-and-match-products.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WCML_Mix_and_Match_Products{
|
4 |
+
|
5 |
+
function __construct(){
|
6 |
+
add_action( 'updated_post_meta', array( $this, 'sync_mnm_data'), 10, 4 );
|
7 |
+
}
|
8 |
+
|
9 |
+
function sync_mnm_data( $meta_id, $post_id, $meta_key, $meta_value ){
|
10 |
+
|
11 |
+
if( $meta_key != '_mnm_data' )
|
12 |
+
return false;
|
13 |
+
|
14 |
+
global $sitepress, $woocommerce_wpml;
|
15 |
+
|
16 |
+
$post = get_post( $post_id );
|
17 |
+
|
18 |
+
// skip auto-drafts // skip autosave
|
19 |
+
if ( $post->post_status == 'auto-draft' || isset( $_POST[ 'autosave' ] ) ) {
|
20 |
+
return;
|
21 |
+
}
|
22 |
+
|
23 |
+
if( $post->post_type == 'product' ) {
|
24 |
+
|
25 |
+
remove_action( 'updated_post_meta', array( $this, 'sync_mnm_data'), 10, 4 );
|
26 |
+
|
27 |
+
if ( $woocommerce_wpml->products->is_original_product( $post_id ) ) {
|
28 |
+
|
29 |
+
$original_product_id = $post_id;
|
30 |
+
|
31 |
+
} else {
|
32 |
+
|
33 |
+
$original_product_language = $woocommerce_wpml->products->get_original_product_language( $post_id );
|
34 |
+
$original_product_id = apply_filters( 'translate_object_id', $post_id, 'product', true, $original_product_language );
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
$mnm_data = maybe_unserialize( get_post_meta( $original_product_id, '_mnm_data', true ) );
|
39 |
+
$product_trid = $sitepress->get_element_trid( $original_product_id, 'post_product' );
|
40 |
+
$product_translations = $sitepress->get_element_translations( $product_trid, 'post_product' );
|
41 |
+
|
42 |
+
foreach ( $product_translations as $product_translation ) {
|
43 |
+
|
44 |
+
if (empty($product_translation->original)) {
|
45 |
+
|
46 |
+
foreach ($mnm_data as $key => $mnm_element) {
|
47 |
+
|
48 |
+
$trnsl_prod = apply_filters( 'translate_object_id', $key, 'product', true, $product_translation->language_code );
|
49 |
+
$mnm_element['product_id'] = $trnsl_prod;
|
50 |
+
$mnm_data[ $trnsl_prod ] = $mnm_element;
|
51 |
+
unset( $mnm_data[$key]);
|
52 |
+
}
|
53 |
+
|
54 |
+
update_post_meta($product_translation->element_id, '_mnm_data', $mnm_data);
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
add_action( 'updated_post_meta', array( $this, 'sync_mnm_data'), 10, 4 );
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
}
|
compatibility/class-wcml-wc-name-your-price.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WCML_WC_Name_Your_Price{
|
4 |
+
|
5 |
+
function __construct(){
|
6 |
+
|
7 |
+
add_action('init', array($this, 'init'),9);
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
+
function init(){
|
12 |
+
if( !is_admin() ){
|
13 |
+
add_filter('woocommerce_raw_suggested_price', array($this, 'product_price_filter'), 10, 2);
|
14 |
+
add_filter('woocommerce_raw_minimum_price', array($this, 'product_price_filter'), 10, 2);
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
function product_price_filter($price, $product){
|
19 |
+
|
20 |
+
return apply_filters('wcml_raw_price_amount', $price );
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
inc/compatibility.class.php
CHANGED
@@ -30,6 +30,11 @@ class WCML_Compatibility {
|
|
30 |
if(class_exists('WC_Subscriptions')){
|
31 |
$this->wp_subscriptions = new WCML_WC_Subscriptions();
|
32 |
}
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
//Product Bundle
|
35 |
if(class_exists('WC_Product_Bundle')){
|
@@ -78,6 +83,11 @@ class WCML_Compatibility {
|
|
78 |
// WooCommerce Bookings
|
79 |
if(defined( 'WC_BOOKINGS_VERSION' ) && version_compare(WC_BOOKINGS_VERSION, '1.7.8', '>=') ){
|
80 |
$this->bookings = new WCML_Bookings();
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
// WooCommerce Checkout Field Editor
|
@@ -109,14 +119,10 @@ class WCML_Compatibility {
|
|
109 |
if ( wp_get_theme() == 'Flatsome' ) {
|
110 |
$this->flatsome = new WCML_Flatsome();
|
111 |
}
|
112 |
-
|
113 |
-
// WooCommerce - Gravity Forms Product Add-Ons
|
114 |
-
if (class_exists('woocommerce_gravityforms')) {
|
115 |
-
$this->gravityforms_product_addons = new WCML_Gravityforms_Product_Addons();
|
116 |
-
}
|
117 |
-
|
118 |
-
|
119 |
|
|
|
|
|
|
|
120 |
}
|
121 |
|
122 |
function autoload( $class ){
|
30 |
if(class_exists('WC_Subscriptions')){
|
31 |
$this->wp_subscriptions = new WCML_WC_Subscriptions();
|
32 |
}
|
33 |
+
|
34 |
+
//WooCommerce Name Your Price
|
35 |
+
if(class_exists('WC_Name_Your_Price')){
|
36 |
+
$this->name_your_price = new WCML_WC_Name_Your_Price();
|
37 |
+
}
|
38 |
|
39 |
//Product Bundle
|
40 |
if(class_exists('WC_Product_Bundle')){
|
83 |
// WooCommerce Bookings
|
84 |
if(defined( 'WC_BOOKINGS_VERSION' ) && version_compare(WC_BOOKINGS_VERSION, '1.7.8', '>=') ){
|
85 |
$this->bookings = new WCML_Bookings();
|
86 |
+
|
87 |
+
// WooCommerce Accommodation Bookings
|
88 |
+
if( defined( 'WC_ACCOMMODATION_BOOKINGS_VERSION' ) ){
|
89 |
+
$this->bookings = new WCML_Accommodation_Bookings();
|
90 |
+
}
|
91 |
}
|
92 |
|
93 |
// WooCommerce Checkout Field Editor
|
119 |
if ( wp_get_theme() == 'Flatsome' ) {
|
120 |
$this->flatsome = new WCML_Flatsome();
|
121 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
+
if (class_exists('WC_Mix_and_Match')) {
|
124 |
+
$this->mix_and_match_products = new WCML_Mix_and_Match_Products();
|
125 |
+
}
|
126 |
}
|
127 |
|
128 |
function autoload( $class ){
|
inc/emails.class.php
CHANGED
@@ -230,6 +230,9 @@ class WCML_Emails{
|
|
230 |
load_default_textdomain();
|
231 |
global $wp_locale;
|
232 |
$wp_locale = new WP_Locale();
|
|
|
|
|
|
|
233 |
}
|
234 |
|
235 |
|
230 |
load_default_textdomain();
|
231 |
global $wp_locale;
|
232 |
$wp_locale = new WP_Locale();
|
233 |
+
|
234 |
+
unset ($woocommerce->countries );
|
235 |
+
$woocommerce->countries = new WC_Countries();
|
236 |
}
|
237 |
|
238 |
|
inc/multi-currency-support.class.php
CHANGED
@@ -76,7 +76,7 @@ class WCML_Multi_Currency_Support{
|
|
76 |
add_filter('woocommerce_currency', array($this, 'currency_filter'));
|
77 |
//add_filter('option_woocommerce_currency', array($this, 'currency_filter'));
|
78 |
|
79 |
-
add_filter('get_post_metadata', array($this, 'product_price_filter'), 10, 4);
|
80 |
add_filter('get_post_metadata', array($this, 'variation_prices_filter'), 12, 4); // second
|
81 |
|
82 |
add_filter('woocommerce_package_rates', array($this, 'shipping_taxes_filter'));
|
@@ -105,7 +105,6 @@ class WCML_Multi_Currency_Support{
|
|
105 |
|
106 |
|
107 |
add_filter('option_woocommerce_currency_pos', array($this, 'filter_currency_position_option'));
|
108 |
-
add_filter( 'woocommerce_get_formatted_order_total', array( $this, 'filter_get_formatted_order_total' ), 10, 2 );
|
109 |
add_action( 'woocommerce_view_order', array( $this, 'filter_view_order' ), 9 );
|
110 |
|
111 |
add_action('currency_switcher', array($this, 'currency_switcher'));
|
@@ -613,17 +612,6 @@ class WCML_Multi_Currency_Support{
|
|
613 |
return $value;
|
614 |
}
|
615 |
|
616 |
-
function filter_get_formatted_order_total($formatted_total, $object ){
|
617 |
-
$client_currency_buff = $this->client_currency;
|
618 |
-
$this->client_currency = $object->get_order_currency();
|
619 |
-
|
620 |
-
$formatted_total = wc_price( $object->order_total , array('currency' => $object->get_order_currency()));
|
621 |
-
|
622 |
-
$this->client_currency = $client_currency_buff;
|
623 |
-
|
624 |
-
return $formatted_total;
|
625 |
-
}
|
626 |
-
|
627 |
function filter_view_order( $order_id ){
|
628 |
$currency_code = get_post_meta( $order_id, '_order_currency', true );
|
629 |
|
76 |
add_filter('woocommerce_currency', array($this, 'currency_filter'));
|
77 |
//add_filter('option_woocommerce_currency', array($this, 'currency_filter'));
|
78 |
|
79 |
+
add_filter('get_post_metadata', array($this, 'product_price_filter'), 10, 4);
|
80 |
add_filter('get_post_metadata', array($this, 'variation_prices_filter'), 12, 4); // second
|
81 |
|
82 |
add_filter('woocommerce_package_rates', array($this, 'shipping_taxes_filter'));
|
105 |
|
106 |
|
107 |
add_filter('option_woocommerce_currency_pos', array($this, 'filter_currency_position_option'));
|
|
|
108 |
add_action( 'woocommerce_view_order', array( $this, 'filter_view_order' ), 9 );
|
109 |
|
110 |
add_action('currency_switcher', array($this, 'currency_switcher'));
|
612 |
return $value;
|
613 |
}
|
614 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
615 |
function filter_view_order( $order_id ){
|
616 |
$currency_code = get_post_meta( $order_id, '_order_currency', true );
|
617 |
|
inc/multi-currency.class.php
CHANGED
@@ -96,6 +96,9 @@ class WCML_WC_MultiCurrency{
|
|
96 |
add_action( 'woocommerce_product_options_pricing', array( $this, 'woocommerce_product_options_custom_pricing' ) );
|
97 |
add_action( 'woocommerce_product_after_variable_attributes', array( $this, 'woocommerce_product_after_variable_attributes_custom_pricing'), 10, 3 );
|
98 |
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
function raw_price_filter($price, $currency = false) {
|
96 |
add_action( 'woocommerce_product_options_pricing', array( $this, 'woocommerce_product_options_custom_pricing' ) );
|
97 |
add_action( 'woocommerce_product_after_variable_attributes', array( $this, 'woocommerce_product_after_variable_attributes_custom_pricing'), 10, 3 );
|
98 |
|
99 |
+
add_filter('woocommerce_price_filter_widget_max_amount', array($this, 'raw_price_filter'), 99);
|
100 |
+
add_filter('woocommerce_price_filter_widget_min_amount', array($this, 'raw_price_filter'), 99);
|
101 |
+
|
102 |
}
|
103 |
|
104 |
function raw_price_filter($price, $currency = false) {
|
inc/products.class.php
CHANGED
@@ -1154,8 +1154,11 @@ class WCML_Products{
|
|
1154 |
foreach($get_current_post_variations as $k => $post_data){
|
1155 |
$current_post_variation_ids[] = $post_data->ID;
|
1156 |
}
|
1157 |
-
|
1158 |
-
|
|
|
|
|
|
|
1159 |
|
1160 |
$original_product_attr = get_post_meta($product_id,'_product_attributes',true);
|
1161 |
$tr_product_attr = get_post_meta($tr_product_id,'_product_attributes',true);
|
@@ -1717,8 +1720,8 @@ class WCML_Products{
|
|
1717 |
$currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
|
1718 |
|
1719 |
foreach( $currencies as $code => $currency ){
|
1720 |
-
$sale_price = $_POST[ '_custom_sale_price' ][ $code ];
|
1721 |
-
$regular_price = $_POST[ '_custom_regular_price' ][ $code ];
|
1722 |
|
1723 |
$date_from = strtotime( $_POST[ '_custom_sale_price_dates_from' ][ $code ] );
|
1724 |
$date_to = strtotime( $_POST[ '_custom_sale_price_dates_to' ][ $code ] );
|
1154 |
foreach($get_current_post_variations as $k => $post_data){
|
1155 |
$current_post_variation_ids[] = $post_data->ID;
|
1156 |
}
|
1157 |
+
|
1158 |
+
// refresh parent-children transients
|
1159 |
+
delete_transient( 'wc_product_children_' . $tr_product_id );
|
1160 |
+
delete_transient( '_transient_wc_product_children_ids_' . $tr_product_id );
|
1161 |
+
|
1162 |
|
1163 |
$original_product_attr = get_post_meta($product_id,'_product_attributes',true);
|
1164 |
$tr_product_attr = get_post_meta($tr_product_id,'_product_attributes',true);
|
1720 |
$currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
|
1721 |
|
1722 |
foreach( $currencies as $code => $currency ){
|
1723 |
+
$sale_price = wc_format_decimal( $_POST[ '_custom_sale_price' ][ $code ] );
|
1724 |
+
$regular_price = wc_format_decimal( $_POST[ '_custom_regular_price' ][ $code ] );
|
1725 |
|
1726 |
$date_from = strtotime( $_POST[ '_custom_sale_price_dates_from' ][ $code ] );
|
1727 |
$date_to = strtotime( $_POST[ '_custom_sale_price_dates_to' ][ $code ] );
|
inc/terms.class.php
CHANGED
@@ -55,7 +55,8 @@ class WCML_Terms{
|
|
55 |
|
56 |
add_filter( 'woocommerce_get_product_terms', array( $this, 'get_product_terms_filter' ), 10, 4 );
|
57 |
|
58 |
-
add_filter( 'pre_update_option_woocommerce_flat_rate_settings', array( $this, '
|
|
|
59 |
}
|
60 |
|
61 |
function admin_menu_setup(){
|
@@ -80,7 +81,12 @@ class WCML_Terms{
|
|
80 |
|
81 |
$settings = get_option( 'woocommerce_flat_rate_settings' );
|
82 |
if( is_array( $settings ) ){
|
83 |
-
update_option( 'woocommerce_flat_rate_settings', $this->
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
}
|
@@ -333,17 +339,17 @@ class WCML_Terms{
|
|
333 |
|
334 |
$not_translated_count = 0;
|
335 |
foreach($active_languages as $language){
|
336 |
-
|
337 |
$terms = $wpdb->get_results($wpdb->prepare("
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
foreach($terms as $term){
|
343 |
-
if(empty($term->e2)){
|
344 |
$not_translated_count ++;
|
345 |
}
|
346 |
-
|
347 |
}
|
348 |
}
|
349 |
|
@@ -797,12 +803,16 @@ class WCML_Terms{
|
|
797 |
}
|
798 |
|
799 |
function shipping_terms($terms, $post_id, $taxonomy){
|
800 |
-
global $pagenow;
|
|
|
|
|
|
|
|
|
801 |
|
802 |
if( $pagenow != 'post.php' && ( get_post_type($post_id) == 'product' || get_post_type($post_id) == 'product_variation' ) && $taxonomy == 'product_shipping_class'){
|
803 |
global $sitepress;
|
804 |
remove_filter('get_the_terms',array($this,'shipping_terms'), 10, 3);
|
805 |
-
$terms = get_the_terms(apply_filters( 'translate_object_id'
|
806 |
add_filter('get_the_terms',array($this,'shipping_terms'), 10, 3);
|
807 |
return $terms;
|
808 |
}
|
@@ -894,7 +904,7 @@ class WCML_Terms{
|
|
894 |
return $filtered_terms;
|
895 |
}
|
896 |
|
897 |
-
function
|
898 |
|
899 |
foreach( $settings as $setting_key => $value ){
|
900 |
|
55 |
|
56 |
add_filter( 'woocommerce_get_product_terms', array( $this, 'get_product_terms_filter' ), 10, 4 );
|
57 |
|
58 |
+
add_filter( 'pre_update_option_woocommerce_flat_rate_settings', array( $this, 'update_woocommerce_shipping_settings_for_class_costs' ) );
|
59 |
+
add_filter( 'pre_update_option_woocommerce_international_delivery_settings', array( $this, 'update_woocommerce_shipping_settings_for_class_costs' ) );
|
60 |
}
|
61 |
|
62 |
function admin_menu_setup(){
|
81 |
|
82 |
$settings = get_option( 'woocommerce_flat_rate_settings' );
|
83 |
if( is_array( $settings ) ){
|
84 |
+
update_option( 'woocommerce_flat_rate_settings', $this->update_woocommerce_shipping_settings_for_class_costs( $settings ) );
|
85 |
+
}
|
86 |
+
|
87 |
+
$settings = get_option( 'woocommerce_international_delivery_settings' );
|
88 |
+
if( is_array( $settings ) ){
|
89 |
+
update_option( 'woocommerce_international_delivery_settings', $this->update_woocommerce_shipping_settings_for_class_costs( $settings ) );
|
90 |
}
|
91 |
|
92 |
}
|
339 |
|
340 |
$not_translated_count = 0;
|
341 |
foreach($active_languages as $language){
|
342 |
+
|
343 |
$terms = $wpdb->get_results($wpdb->prepare("
|
344 |
+
SELECT t1.element_id AS e1, t2.element_id AS e2 FROM {$wpdb->term_taxonomy} x
|
345 |
+
JOIN {$wpdb->prefix}icl_translations t1 ON x.term_taxonomy_id = t1.element_id AND t1.element_type = %s AND t1.source_language_code IS NULL
|
346 |
+
LEFT JOIN {$wpdb->prefix}icl_translations t2 ON t2.trid = t1.trid AND t2.language_code = %s
|
347 |
+
", 'tax_' . $taxonomy, $language['code']));
|
348 |
foreach($terms as $term){
|
349 |
+
if( empty( $term->e2 ) ){
|
350 |
$not_translated_count ++;
|
351 |
}
|
352 |
+
|
353 |
}
|
354 |
}
|
355 |
|
803 |
}
|
804 |
|
805 |
function shipping_terms($terms, $post_id, $taxonomy){
|
806 |
+
global $pagenow, $woocommerce_wpml;
|
807 |
+
|
808 |
+
if( isset( $_POST['action'] ) && $_POST['action'] == 'woocommerce_load_variations' ){
|
809 |
+
return $terms;
|
810 |
+
}
|
811 |
|
812 |
if( $pagenow != 'post.php' && ( get_post_type($post_id) == 'product' || get_post_type($post_id) == 'product_variation' ) && $taxonomy == 'product_shipping_class'){
|
813 |
global $sitepress;
|
814 |
remove_filter('get_the_terms',array($this,'shipping_terms'), 10, 3);
|
815 |
+
$terms = get_the_terms( apply_filters( 'translate_object_id', $post_id, get_post_type($post_id), true, $woocommerce_wpml->products->get_original_product_language( $post_id ) ),'product_shipping_class');
|
816 |
add_filter('get_the_terms',array($this,'shipping_terms'), 10, 3);
|
817 |
return $terms;
|
818 |
}
|
904 |
return $filtered_terms;
|
905 |
}
|
906 |
|
907 |
+
function update_woocommerce_shipping_settings_for_class_costs( $settings ){
|
908 |
|
909 |
foreach( $settings as $setting_key => $value ){
|
910 |
|
inc/url-translation.class.php
CHANGED
@@ -341,132 +341,111 @@ class WCML_Url_Translation {
|
|
341 |
function translate_bases_in_rewrite_rules( $value ) {
|
342 |
global $sitepress, $sitepress_settings, $woocommerce_wpml;
|
343 |
|
344 |
-
$
|
345 |
|
346 |
-
|
|
|
347 |
|
348 |
-
$
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
$taxonomies = array( 'product_cat', 'product_tag' );
|
353 |
-
|
354 |
-
foreach ( $taxonomies as $taxonomy ) {
|
355 |
-
$slug_details = $this->get_translated_tax_slug( $taxonomy );
|
356 |
-
|
357 |
-
$string_language = $woocommerce_wpml->strings->get_string_language( $slug_details['slug'], $this->url_strings_context(), $this->url_string_name( $taxonomy ) );
|
358 |
-
if ( $sitepress->get_current_language() == $string_language ) {
|
359 |
-
continue;
|
360 |
-
}
|
361 |
-
|
362 |
-
if ( $slug_details ) {
|
363 |
|
364 |
-
|
365 |
-
$slug_translation_match = ltrim($slug_details['translated_slug'], '/');
|
366 |
|
367 |
-
|
368 |
-
|
369 |
|
370 |
-
|
371 |
-
|
372 |
-
}
|
373 |
|
374 |
-
|
|
|
375 |
}
|
376 |
-
$value = $buff_value;
|
377 |
-
unset( $buff_value );
|
378 |
-
}
|
379 |
|
|
|
|
|
|
|
|
|
380 |
}
|
381 |
|
382 |
-
|
383 |
-
$wc_taxonomies = wc_get_attribute_taxonomies();
|
384 |
-
$wc_taxonomies_wc_format = array();
|
385 |
-
foreach ( $wc_taxonomies as $k => $v ) {
|
386 |
-
$wc_taxonomies_wc_format[] = 'pa_' . $v->attribute_name;
|
387 |
-
}
|
388 |
-
|
389 |
-
foreach ( $wc_taxonomies_wc_format as $taxonomy ) {
|
390 |
-
$taxonomy_obj = get_taxonomy( $taxonomy );
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
|
|
|
|
396 |
|
397 |
-
|
398 |
-
|
399 |
|
400 |
-
|
|
|
|
|
|
|
401 |
|
402 |
-
|
403 |
-
|
404 |
|
405 |
-
|
406 |
-
$slug_translation_match = ltrim($slug_translation, '/');
|
407 |
|
408 |
-
|
409 |
-
|
410 |
-
if ($slug != $slug_translation && preg_match('#^' . $slug_match . '/(.*)#', $k)) {
|
411 |
-
$k = preg_replace('#^' . $slug_match . '/(.*)#', $slug_translation_match . '/$1', $k);
|
412 |
-
}
|
413 |
-
$buff_value[$k] = $v;
|
414 |
-
}
|
415 |
|
416 |
-
|
417 |
-
|
418 |
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
}
|
420 |
|
|
|
|
|
|
|
421 |
}
|
422 |
-
}
|
423 |
|
|
|
424 |
}
|
425 |
|
426 |
-
wp_cache_add( $cache_key, $value );
|
427 |
-
|
428 |
}
|
429 |
|
430 |
|
431 |
-
//filter shop page rewrite slug
|
432 |
-
$cache_key = 'wcml_rewrite_shop_slug';
|
433 |
-
|
434 |
-
if ( $val = wp_cache_get( $cache_key ) ) {
|
435 |
-
|
436 |
-
$value = $val;
|
437 |
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
$default_shop_id = apply_filters( 'translate_object_id', $current_shop_id, 'page', true, $sitepress->get_default_language() );
|
442 |
|
443 |
-
|
444 |
-
|
445 |
|
446 |
-
|
447 |
-
|
448 |
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
|
457 |
-
|
458 |
-
}
|
459 |
-
|
460 |
-
$buff_value[$k] = $v;
|
461 |
}
|
462 |
|
463 |
-
$
|
464 |
-
unset( $buff_value );
|
465 |
}
|
466 |
|
467 |
-
|
|
|
468 |
}
|
469 |
|
|
|
470 |
return $value;
|
471 |
}
|
472 |
|
341 |
function translate_bases_in_rewrite_rules( $value ) {
|
342 |
global $sitepress, $sitepress_settings, $woocommerce_wpml;
|
343 |
|
344 |
+
$taxonomies = array( 'product_cat', 'product_tag' );
|
345 |
|
346 |
+
foreach ( $taxonomies as $taxonomy ) {
|
347 |
+
$slug_details = $this->get_translated_tax_slug( $taxonomy );
|
348 |
|
349 |
+
$string_language = $woocommerce_wpml->strings->get_string_language( $slug_details['slug'], $this->url_strings_context(), $this->url_string_name( $taxonomy ) );
|
350 |
+
if ( $sitepress->get_current_language() == $string_language ) {
|
351 |
+
continue;
|
352 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
|
354 |
+
if ( $slug_details ) {
|
|
|
355 |
|
356 |
+
$slug_match = addslashes( ltrim($slug_details['slug'], '/') );
|
357 |
+
$slug_translation_match = ltrim($slug_details['translated_slug'], '/');
|
358 |
|
359 |
+
$buff_value = array();
|
360 |
+
foreach ( (array)$value as $k => $v ) {
|
|
|
361 |
|
362 |
+
if ( $slug_details['slug'] != $slug_details['translated_slug'] && preg_match( '#^[^/]*/?' . $slug_match . '/#', $k ) ) {
|
363 |
+
$k = preg_replace( '#^([^/]*)(/?)' . $slug_match . '/#', '$1$2' . $slug_translation_match . '/', $k );
|
364 |
}
|
|
|
|
|
|
|
365 |
|
366 |
+
$buff_value[$k] = $v;
|
367 |
+
}
|
368 |
+
$value = $buff_value;
|
369 |
+
unset( $buff_value );
|
370 |
}
|
371 |
|
372 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
|
374 |
+
// handle attributes
|
375 |
+
$wc_taxonomies = wc_get_attribute_taxonomies();
|
376 |
+
$wc_taxonomies_wc_format = array();
|
377 |
+
foreach ( $wc_taxonomies as $k => $v ) {
|
378 |
+
$wc_taxonomies_wc_format[] = 'pa_' . $v->attribute_name;
|
379 |
+
}
|
380 |
|
381 |
+
foreach ( $wc_taxonomies_wc_format as $taxonomy ) {
|
382 |
+
$taxonomy_obj = get_taxonomy( $taxonomy );
|
383 |
|
384 |
+
if ( isset( $taxonomy_obj->rewrite['slug'] ) ) {
|
385 |
+
$exp = explode( '/', trim( $taxonomy_obj->rewrite['slug'], '/' ) );
|
386 |
+
$slug = join( '/', array_slice( $exp, 0, count( $exp ) - 1 ) );
|
387 |
+
}
|
388 |
|
389 |
+
if ( isset( $slug ) ) {
|
390 |
+
$string_language = $woocommerce_wpml->strings->get_string_language($slug, $this->url_strings_context(), $this->url_string_name( 'attribute' ) );
|
391 |
|
392 |
+
if ($sitepress->get_current_language() != $string_language) {
|
|
|
393 |
|
394 |
+
$slug_translation = apply_filters('wpml_translate_single_string', $slug, $this->url_strings_context(), $this->url_string_name( 'attribute' ) );
|
395 |
+
if ($slug_translation) {
|
|
|
|
|
|
|
|
|
|
|
396 |
|
397 |
+
$slug_match = addslashes( ltrim($slug, '/') );
|
398 |
+
$slug_translation_match = ltrim($slug_translation, '/');
|
399 |
|
400 |
+
$buff_value = array();
|
401 |
+
foreach ((array)$value as $k => $v) {
|
402 |
+
if ($slug != $slug_translation && preg_match('#^' . $slug_match . '/(.*)#', $k)) {
|
403 |
+
$k = preg_replace('#^' . $slug_match . '/(.*)#', $slug_translation_match . '/$1', $k);
|
404 |
+
}
|
405 |
+
$buff_value[$k] = $v;
|
406 |
}
|
407 |
|
408 |
+
$value = $buff_value;
|
409 |
+
unset($buff_value);
|
410 |
+
|
411 |
}
|
|
|
412 |
|
413 |
+
}
|
414 |
}
|
415 |
|
|
|
|
|
416 |
}
|
417 |
|
418 |
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
|
420 |
+
//filter shop page rewrite slug
|
421 |
+
$current_shop_id = wc_get_page_id( 'shop' );
|
422 |
+
$default_shop_id = apply_filters( 'translate_object_id', $current_shop_id, 'page', true, $sitepress->get_default_language() );
|
|
|
423 |
|
424 |
+
if ( is_null( get_post( $current_shop_id ) ) || is_null( get_post( $default_shop_id ) ) )
|
425 |
+
return $value;
|
426 |
|
427 |
+
$current_slug = get_post( $current_shop_id )->post_name;
|
428 |
+
$default_slug = get_post( $default_shop_id )->post_name;
|
429 |
|
430 |
+
if ( $current_slug != $default_slug ) {
|
431 |
+
$buff_value = array();
|
432 |
+
foreach ( (array)$value as $k => $v ) {
|
433 |
|
434 |
+
if( preg_match( '#^' . $default_slug . '/\?\$$#', $k ) ||
|
435 |
+
preg_match( '#^' . $default_slug . '/\(?feed#', $k ) ||
|
436 |
+
preg_match( '#^' . $default_slug . '/page#', $k )){
|
437 |
|
438 |
+
$k = preg_replace( '#^' . $default_slug . '/#', $current_slug . '/', $k );
|
|
|
|
|
|
|
439 |
}
|
440 |
|
441 |
+
$buff_value[$k] = $v;
|
|
|
442 |
}
|
443 |
|
444 |
+
$value = $buff_value;
|
445 |
+
unset( $buff_value );
|
446 |
}
|
447 |
|
448 |
+
|
449 |
return $value;
|
450 |
}
|
451 |
|
inc/wc-strings.class.php
CHANGED
@@ -4,6 +4,7 @@ class WCML_WC_Strings{
|
|
4 |
|
5 |
private $translations_from_mo_file = array();
|
6 |
private $mo_files = array();
|
|
|
7 |
|
8 |
function __construct(){
|
9 |
|
@@ -65,8 +66,13 @@ class WCML_WC_Strings{
|
|
65 |
}
|
66 |
|
67 |
function init(){
|
68 |
-
global $pagenow;
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
70 |
add_filter('woocommerce_package_rates', array($this, 'translate_shipping_methods_in_package'));
|
71 |
add_action('woocommerce_tax_rate_added', array($this, 'register_tax_rate_label_string'), 10, 2 );
|
72 |
add_filter('woocommerce_rate_label',array($this,'translate_woocommerce_rate_label'));
|
@@ -190,10 +196,9 @@ class WCML_WC_Strings{
|
|
190 |
}
|
191 |
|
192 |
function translated_checkout_product_title($title,$product){
|
193 |
-
global $sitepress;
|
194 |
|
195 |
if(isset($product->id)){
|
196 |
-
$tr_product_id = apply_filters( 'translate_object_id'
|
197 |
$title = get_the_title($tr_product_id);
|
198 |
}
|
199 |
|
@@ -321,9 +326,8 @@ class WCML_WC_Strings{
|
|
321 |
}
|
322 |
|
323 |
function translate_shipping_method_title( $title, $shipping_id ) {
|
324 |
-
global $sitepress;
|
325 |
|
326 |
-
$title = apply_filters( 'wpml_translate_single_string', $title, 'woocommerce', $shipping_id .'_shipping_method_title', $
|
327 |
|
328 |
return $title;
|
329 |
}
|
@@ -396,25 +400,18 @@ class WCML_WC_Strings{
|
|
396 |
}
|
397 |
|
398 |
function translate_gateway_title($title, $gateway_title) {
|
399 |
-
|
400 |
-
|
401 |
-
$title = apply_filters( 'wpml_translate_single_string', $title, 'woocommerce', $gateway_title .'_gateway_title', $sitepress->get_current_language() );
|
402 |
-
|
403 |
return $title;
|
404 |
}
|
405 |
|
406 |
function translate_gateway_description( $description, $gateway_title) {
|
407 |
-
|
408 |
-
$description = apply_filters( 'wpml_translate_single_string', $description, 'woocommerce', $gateway_title .'_gateway_description', $sitepress->get_current_language() );
|
409 |
-
|
410 |
return $description;
|
411 |
}
|
412 |
|
413 |
function translate_gateway_instructions( $id, $instructions){
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
return $instruction;
|
418 |
}
|
419 |
|
420 |
function show_custom_url_base_language_requirement(){
|
4 |
|
5 |
private $translations_from_mo_file = array();
|
6 |
private $mo_files = array();
|
7 |
+
private $current_language;
|
8 |
|
9 |
function __construct(){
|
10 |
|
66 |
}
|
67 |
|
68 |
function init(){
|
69 |
+
global $pagenow, $sitepress;
|
70 |
+
|
71 |
+
$this->current_language = $sitepress->get_current_language();
|
72 |
+
if( $this->current_language == 'all' ){
|
73 |
+
$this->current_language = $sitepress->get_default_language();
|
74 |
+
}
|
75 |
+
|
76 |
add_filter('woocommerce_package_rates', array($this, 'translate_shipping_methods_in_package'));
|
77 |
add_action('woocommerce_tax_rate_added', array($this, 'register_tax_rate_label_string'), 10, 2 );
|
78 |
add_filter('woocommerce_rate_label',array($this,'translate_woocommerce_rate_label'));
|
196 |
}
|
197 |
|
198 |
function translated_checkout_product_title($title,$product){
|
|
|
199 |
|
200 |
if(isset($product->id)){
|
201 |
+
$tr_product_id = apply_filters( 'translate_object_id', $product->id, 'product', true, $this->current_language );
|
202 |
$title = get_the_title($tr_product_id);
|
203 |
}
|
204 |
|
326 |
}
|
327 |
|
328 |
function translate_shipping_method_title( $title, $shipping_id ) {
|
|
|
329 |
|
330 |
+
$title = apply_filters( 'wpml_translate_single_string', $title, 'woocommerce', $shipping_id .'_shipping_method_title', $this->current_language );
|
331 |
|
332 |
return $title;
|
333 |
}
|
400 |
}
|
401 |
|
402 |
function translate_gateway_title($title, $gateway_title) {
|
403 |
+
$title = apply_filters( 'wpml_translate_single_string', $title, 'woocommerce', $gateway_title .'_gateway_title', $this->current_language );
|
|
|
|
|
|
|
404 |
return $title;
|
405 |
}
|
406 |
|
407 |
function translate_gateway_description( $description, $gateway_title) {
|
408 |
+
$description = apply_filters( 'wpml_translate_single_string', $description, 'woocommerce', $gateway_title . '_gateway_description', $this->current_language );
|
|
|
|
|
409 |
return $description;
|
410 |
}
|
411 |
|
412 |
function translate_gateway_instructions( $id, $instructions){
|
413 |
+
$instructions = apply_filters( 'wpml_translate_single_string', $instructions, 'woocommerce', $id . '_gateway_instructions', $this->current_language );
|
414 |
+
return $instructions;
|
|
|
|
|
415 |
}
|
416 |
|
417 |
function show_custom_url_base_language_requirement(){
|
menu/sub/products.php
CHANGED
@@ -248,6 +248,9 @@ if(isset($_GET['prid'])): ?>
|
|
248 |
if( isset( $_GET['prid']) ){
|
249 |
$default_language = $sitepress->get_language_for_element($_GET['prid'],'post_product');
|
250 |
$display_inline = true;
|
|
|
|
|
|
|
251 |
include WCML_PLUGIN_PATH . '/menu/sub/product-data.php';
|
252 |
}
|
253 |
endforeach; ?>
|
248 |
if( isset( $_GET['prid']) ){
|
249 |
$default_language = $sitepress->get_language_for_element($_GET['prid'],'post_product');
|
250 |
$display_inline = true;
|
251 |
+
echo '<div class="hidden">';
|
252 |
+
wp_editor('to_be_removed', 'wcmleditor-to_be_removed');
|
253 |
+
echo '</div>';
|
254 |
include WCML_PLUGIN_PATH . '/menu/sub/product-data.php';
|
255 |
}
|
256 |
endforeach; ?>
|
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.0
|
7 |
-
Tested up to: 4.4.
|
8 |
-
Stable tag: 3.7.
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
@@ -78,6 +78,19 @@ In order for the checkout and store pages to appear translated, you need to crea
|
|
78 |
|
79 |
== Changelog ==
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
= 3.7.9 =
|
82 |
* Fixed an issue prevent the correct plugin activation in some cases
|
83 |
* Fixed an issue potentially causing uncatched errors when using some specific payment gateways
|
4 |
Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
|
5 |
License: GPLv2
|
6 |
Requires at least: 3.0
|
7 |
+
Tested up to: 4.4.2
|
8 |
+
Stable tag: 3.7.10
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
78 |
|
79 |
== Changelog ==
|
80 |
|
81 |
+
= 3.7.10 =
|
82 |
+
* Fixed a small issue with the product translations editor (additional toolbar showing)
|
83 |
+
* Fixed a compatibility issue with Memcached on Siteground: product category archive pages were returning 404
|
84 |
+
* Bug fix: the price widget was not using the correct values with multi-currency mode on
|
85 |
+
* Bug fix: in some cases the costs for International Shipping were not calculated correctly in the secondary languages
|
86 |
+
* Bug fix: When using comma for a decimal separator, for custom prices, the rounded values were not determined correctly
|
87 |
+
* Bug fix: In some cases, translated product variations were displayed as 'out of stock' on the front end.
|
88 |
+
* Fixed a fatal error occurring when selecting the WPML admin language to 'All languages' on the WooCommerce settings page
|
89 |
+
* Compatibility with WooThemes Mix and Match Products
|
90 |
+
* Fixed a bug preventing a shipping to be set to a variation when the default language of the product was not English
|
91 |
+
* Fixed a bug that was sometimes preventing the 'incl. vat' suffix to be displayed on prices
|
92 |
+
* Fixed a compatibility issue with Gravity Forms Product Add-Ons
|
93 |
+
|
94 |
= 3.7.9 =
|
95 |
* Fixed an issue prevent the correct plugin activation in some cases
|
96 |
* Fixed an issue potentially causing uncatched errors when using some specific payment gateways
|
wpml-woocommerce.php
CHANGED
@@ -6,12 +6,12 @@
|
|
6 |
Author: OnTheGoSystems
|
7 |
Author URI: http://www.onthegosystems.com/
|
8 |
Text Domain: woocommerce-multilingual
|
9 |
-
Version: 3.7.
|
10 |
*/
|
11 |
|
12 |
|
13 |
if(defined('WCML_VERSION')) return;
|
14 |
-
define('WCML_VERSION', '3.7.
|
15 |
define('WCML_PLUGIN_PATH', dirname(__FILE__));
|
16 |
define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
|
17 |
define('WCML_LOCALE_PATH',WCML_PLUGIN_PATH.'/locale');
|
6 |
Author: OnTheGoSystems
|
7 |
Author URI: http://www.onthegosystems.com/
|
8 |
Text Domain: woocommerce-multilingual
|
9 |
+
Version: 3.7.10
|
10 |
*/
|
11 |
|
12 |
|
13 |
if(defined('WCML_VERSION')) return;
|
14 |
+
define('WCML_VERSION', '3.7.10');
|
15 |
define('WCML_PLUGIN_PATH', dirname(__FILE__));
|
16 |
define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
|
17 |
define('WCML_LOCALE_PATH',WCML_PLUGIN_PATH.'/locale');
|