Version Description
- Bug fix: When adding a global attribute inline while creating a product in a secondary language, the term was created in the wrong language
- Fixed a compatibility issues with WooCommerce Tab Manager: fatal error when trying to translate a product
- Fixed another compatibility issues with WooCommerce Tab Manager: when a product had only a global tab, the translated tab didn't show up on the translated product
- Improvements for how the gateways strings are registered for translation
- Updated logic for registering and translating Shipping zones and methods according to changes in WooCommerce 2.6
Download this release
Release Info
Developer | mihaimihai |
Plugin | WooCommerce Multilingual – run WooCommerce with WPML |
Version | 3.7.13 |
Comparing to | |
See all releases |
Code changes from version 3.7.12 to 3.7.13
- assets/js/lock_fields.js +1 -1
- compatibility/class-wcml-tab-manager.php +29 -10
- inc/compatibility.class.php +1 -1
- inc/endpoints.class.php +13 -6
- inc/products.class.php +22 -30
- inc/wc-strings.class.php +65 -51
- readme.txt +10 -2
- wpml-woocommerce.php +2 -2
assets/js/lock_fields.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
jQuery(document).ready(function($){
|
2 |
var i;
|
3 |
-
var ids = ['_virtual','_downloadable','product-type','_backorders','_manage_stock','_stock','_sold_individually','comment_status','_tax_status','_tax_class','parent_id','crosssell_ids','upsell_ids'];
|
4 |
|
5 |
$('.wcml_prod_hidden_notice').prependTo('#woocommerce-product-data');
|
6 |
|
1 |
jQuery(document).ready(function($){
|
2 |
var i;
|
3 |
+
var ids = ['_virtual','_downloadable','product-type','_backorders','_manage_stock','_stock','_stock_status','_sold_individually','comment_status','_tax_status','_tax_class','parent_id','crosssell_ids','upsell_ids'];
|
4 |
|
5 |
$('.wcml_prod_hidden_notice').prependTo('#woocommerce-product-data');
|
6 |
|
compatibility/class-wcml-tab-manager.php
CHANGED
@@ -10,6 +10,8 @@ class WCML_Tab_Manager{
|
|
10 |
add_filter( 'wcml_custom_box_html', array( $this, 'custom_box_html'), 10, 3 );
|
11 |
add_filter( 'wpml_duplicate_custom_fields_exceptions', array( $this, 'duplicate_custom_fields_exceptions' ) );
|
12 |
add_action( 'wcml_after_duplicate_product', array( $this, 'duplicate_product_tabs') , 10, 2 );
|
|
|
|
|
13 |
|
14 |
if( version_compare( WCML_VERSION, '3.7.2', '>') ){
|
15 |
add_filter( 'option_wpml_config_files_arr', array($this, 'make__product_tabs_not_translatable_by_default'), 0 );
|
@@ -42,7 +44,7 @@ class WCML_Tab_Manager{
|
|
42 |
}
|
43 |
|
44 |
function sync_tabs( $original_product_id, $trnsl_product_id, $data = false ){
|
45 |
-
global $
|
46 |
|
47 |
$lang = $sitepress->get_language_for_element( $trnsl_product_id, 'post_product' );
|
48 |
|
@@ -51,11 +53,7 @@ class WCML_Tab_Manager{
|
|
51 |
$this->duplicate_tabs( $original_product_id, $trnsl_product_id, $lang );
|
52 |
}
|
53 |
|
54 |
-
|
55 |
-
return;
|
56 |
-
}
|
57 |
-
|
58 |
-
$orig_prod_tabs = $wc_tab_manager->get_product_tabs( $original_product_id );
|
59 |
|
60 |
if( $orig_prod_tabs ){
|
61 |
$trnsl_product_tabs = array();
|
@@ -222,12 +220,10 @@ class WCML_Tab_Manager{
|
|
222 |
function custom_box_html($html, $template_data, $lang){
|
223 |
|
224 |
if( $template_data['product_content'] == '_product_tabs' ){
|
225 |
-
|
226 |
-
|
227 |
-
$orig_prod_tabs = $wc_tab_manager->get_product_tabs($template_data['product_id']);
|
228 |
if(!$orig_prod_tabs) return '';
|
229 |
if($template_data['tr_product_id']){
|
230 |
-
$tr_prod_tabs = $
|
231 |
|
232 |
if(!is_array($tr_prod_tabs)){
|
233 |
return __('Please update original product', 'woocommerce-multilingual');
|
@@ -482,4 +478,27 @@ class WCML_Tab_Manager{
|
|
482 |
}
|
483 |
}
|
484 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
}
|
10 |
add_filter( 'wcml_custom_box_html', array( $this, 'custom_box_html'), 10, 3 );
|
11 |
add_filter( 'wpml_duplicate_custom_fields_exceptions', array( $this, 'duplicate_custom_fields_exceptions' ) );
|
12 |
add_action( 'wcml_after_duplicate_product', array( $this, 'duplicate_product_tabs') , 10, 2 );
|
13 |
+
|
14 |
+
add_filter('wc_tab_manager_tab_id', array($this, 'wc_tab_manager_tab_id'), 10, 1);
|
15 |
|
16 |
if( version_compare( WCML_VERSION, '3.7.2', '>') ){
|
17 |
add_filter( 'option_wpml_config_files_arr', array($this, 'make__product_tabs_not_translatable_by_default'), 0 );
|
44 |
}
|
45 |
|
46 |
function sync_tabs( $original_product_id, $trnsl_product_id, $data = false ){
|
47 |
+
global $sitepress, $woocommerce, $woocommerce_wpml;
|
48 |
|
49 |
$lang = $sitepress->get_language_for_element( $trnsl_product_id, 'post_product' );
|
50 |
|
53 |
$this->duplicate_tabs( $original_product_id, $trnsl_product_id, $lang );
|
54 |
}
|
55 |
|
56 |
+
$orig_prod_tabs = $this->get_product_tabs( $original_product_id );
|
|
|
|
|
|
|
|
|
57 |
|
58 |
if( $orig_prod_tabs ){
|
59 |
$trnsl_product_tabs = array();
|
220 |
function custom_box_html($html, $template_data, $lang){
|
221 |
|
222 |
if( $template_data['product_content'] == '_product_tabs' ){
|
223 |
+
$orig_prod_tabs = $this->get_product_tabs($template_data['product_id']);
|
|
|
|
|
224 |
if(!$orig_prod_tabs) return '';
|
225 |
if($template_data['tr_product_id']){
|
226 |
+
$tr_prod_tabs = $this->get_product_tabs($template_data['tr_product_id']);
|
227 |
|
228 |
if(!is_array($tr_prod_tabs)){
|
229 |
return __('Please update original product', 'woocommerce-multilingual');
|
478 |
}
|
479 |
}
|
480 |
|
481 |
+
public function get_product_tabs( $product_id ) {
|
482 |
+
|
483 |
+
$override_tab_layout = get_post_meta( $product_id, '_override_tab_layout', true );
|
484 |
+
|
485 |
+
if ( 'yes' == $override_tab_layout ) {
|
486 |
+
// product defines its own tab layout?
|
487 |
+
$product_tabs = get_post_meta( $product_id, '_product_tabs', true );
|
488 |
+
} else {
|
489 |
+
// otherwise, get the default layout if any
|
490 |
+
$product_tabs = get_option( 'wc_tab_manager_default_layout', false );
|
491 |
+
}
|
492 |
+
|
493 |
+
|
494 |
+
return $product_tabs;
|
495 |
+
}
|
496 |
+
|
497 |
+
|
498 |
+
function wc_tab_manager_tab_id($tab_id) {
|
499 |
+
$tab_id = apply_filters('wpml_object_id', $tab_id, 'wc_product_tab', true);
|
500 |
+
|
501 |
+
return $tab_id;
|
502 |
+
}
|
503 |
+
|
504 |
}
|
inc/compatibility.class.php
CHANGED
@@ -17,7 +17,7 @@ class WCML_Compatibility {
|
|
17 |
//hardcoded list of extensions and check which ones the user has and then include the corresponding file from the ‘compatibility’ folder
|
18 |
|
19 |
//WooCommerce Tab Manager plugin
|
20 |
-
if(class_exists('WC_Tab_Manager')){
|
21 |
$this->tab_manager = new WCML_Tab_Manager();
|
22 |
}
|
23 |
|
17 |
//hardcoded list of extensions and check which ones the user has and then include the corresponding file from the ‘compatibility’ folder
|
18 |
|
19 |
//WooCommerce Tab Manager plugin
|
20 |
+
if( class_exists('WC_Tab_Manager') ){
|
21 |
$this->tab_manager = new WCML_Tab_Manager();
|
22 |
}
|
23 |
|
inc/endpoints.class.php
CHANGED
@@ -38,13 +38,20 @@ class WCML_Endpoints{
|
|
38 |
'order-received' => $this->get_endpoint_translation( 'order-received', $wc_vars['order-received'] ),
|
39 |
|
40 |
// My account actions
|
41 |
-
'view-order'
|
42 |
-
'edit-account'
|
43 |
-
'edit-address'
|
44 |
-
'lost-password'
|
45 |
-
'customer-logout'
|
46 |
-
'add-payment-method'
|
47 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
$query_vars = array_merge( $wc_vars , $query_vars );
|
49 |
WC()->query->query_vars = $query_vars;
|
50 |
|
38 |
'order-received' => $this->get_endpoint_translation( 'order-received', $wc_vars['order-received'] ),
|
39 |
|
40 |
// My account actions
|
41 |
+
'view-order' => $this->get_endpoint_translation( 'view-order', $wc_vars['view-order'] ),
|
42 |
+
'edit-account' => $this->get_endpoint_translation( 'edit-account', $wc_vars['edit-account'] ),
|
43 |
+
'edit-address' => $this->get_endpoint_translation( 'edit-address', $wc_vars['edit-address'] ),
|
44 |
+
'lost-password' => $this->get_endpoint_translation( 'lost-password', $wc_vars['lost-password'] ),
|
45 |
+
'customer-logout' => $this->get_endpoint_translation( 'customer-logout', $wc_vars['customer-logout'] ),
|
46 |
+
'add-payment-method' => $this->get_endpoint_translation( 'add-payment-method', $wc_vars['add-payment-method'] ),
|
47 |
);
|
48 |
+
|
49 |
+
if( isset( $wc_vars['orders'] ) ) $query_vars[ 'orders' ] = $this->get_endpoint_translation( 'orders', $wc_vars['orders'] );
|
50 |
+
if( isset( $wc_vars['downloads'] ) ) $query_vars[ 'downloads' ] = $this->get_endpoint_translation( 'downloads', $wc_vars['downloads'] );
|
51 |
+
if( isset( $wc_vars['payment-methods'] ) ) $query_vars[ 'payment-methods' ] = $this->get_endpoint_translation( 'payment-methods', $wc_vars['payment-methods'] );
|
52 |
+
if( isset( $wc_vars['delete-payment-method'] ) ) $query_vars[ 'delete-payment-method' ] = $this->get_endpoint_translation( 'delete-payment-method', $wc_vars['delete-payment-method'] );
|
53 |
+
if( isset( $wc_vars['set-default-payment-method'] ) ) $query_vars[ 'set-default-payment-method' ] = $this->get_endpoint_translation( 'set-default-payment-method', $wc_vars['set-default-payment-method'] );
|
54 |
+
|
55 |
$query_vars = array_merge( $wc_vars , $query_vars );
|
56 |
WC()->query->query_vars = $query_vars;
|
57 |
|
inc/products.class.php
CHANGED
@@ -95,8 +95,6 @@ class WCML_Products{
|
|
95 |
//add sitepress filters
|
96 |
add_filter( 'wpml_save_post_trid_value', array( $this, 'wpml_save_post_trid_value' ), 10, 3 );
|
97 |
add_filter( 'wpml_save_post_lang', array( $this, 'wpml_save_post_lang_value' ), 10 );
|
98 |
-
//add filter when add term on product page
|
99 |
-
add_filter( 'wpml_create_term_lang', array( $this, 'product_page_add_language_info_to_term' ) );
|
100 |
|
101 |
//quick & bulk edit
|
102 |
add_action( 'woocommerce_product_quick_edit_save', array( $this, 'woocommerce_product_quick_edit_save' ) );
|
@@ -903,7 +901,7 @@ class WCML_Products{
|
|
903 |
update_post_meta($trnsl_product_id,$key,$meta_value);
|
904 |
}
|
905 |
}else{
|
906 |
-
if( in_array( $key ,array( '_file_paths', '_downloadable_files' )) || ( isset($settings['translation-management']['custom_fields_translation'][$key]) && $settings['translation-management']['custom_fields_translation'][$key] == 1 ) ){
|
907 |
$meta_value = apply_filters('wcml_meta_value_before_add',$meta_value,$key);
|
908 |
update_post_meta($trnsl_product_id, $key, $meta_value);
|
909 |
}
|
@@ -1321,12 +1319,10 @@ class WCML_Products{
|
|
1321 |
|
1322 |
if( empty( $post_id ) && isset( $_GET['post'] ) ){
|
1323 |
$post_id = $_GET['post'];
|
1324 |
-
$is_original_post = $this->is_original_product( $post_id );
|
1325 |
-
}else{
|
1326 |
-
$post_language = wpml_get_language_information($post_id);
|
1327 |
-
$is_original_post = $post_language['language_code'] == $lang;
|
1328 |
}
|
1329 |
|
|
|
|
|
1330 |
if( isset( $_GET[ 'post' ] ) || !$is_original_post ){
|
1331 |
$link = admin_url( 'admin.php?page=wpml-wcml&tab=products&prid='.$post_id );
|
1332 |
}
|
@@ -2456,15 +2452,6 @@ class WCML_Products{
|
|
2456 |
}
|
2457 |
}
|
2458 |
|
2459 |
-
function product_page_add_language_info_to_term($lang){
|
2460 |
-
if(isset($_POST['action']) && $_POST['action'] == 'woocommerce_add_new_attribute'){
|
2461 |
-
global $sitepress;
|
2462 |
-
$lang = $sitepress->get_default_language();
|
2463 |
-
}
|
2464 |
-
return $lang;
|
2465 |
-
|
2466 |
-
}
|
2467 |
-
|
2468 |
function sync_product_gallery_duplicate_attachment($att_id, $dup_att_id){
|
2469 |
|
2470 |
$product_id = wp_get_post_parent_id($att_id);
|
@@ -2736,27 +2723,32 @@ class WCML_Products{
|
|
2736 |
}
|
2737 |
|
2738 |
function get_cart_attribute_translation( $attr_key, $attribute, $variation_id, $current_language, $product_id, $tr_product_id ){
|
2739 |
-
global $woocommerce;
|
2740 |
-
|
2741 |
-
//delete 'attribute_' at the beginning
|
2742 |
-
$taxonomy = substr( $attr_key, 10, strlen( $attr_key ) - 1 );
|
2743 |
|
2744 |
-
|
2745 |
|
2746 |
-
|
2747 |
-
|
2748 |
-
$
|
2749 |
-
return $term->slug;
|
2750 |
-
}else{
|
2751 |
|
2752 |
-
|
2753 |
|
2754 |
-
|
2755 |
-
|
|
|
|
|
2756 |
}else{
|
2757 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2758 |
}
|
2759 |
}
|
|
|
|
|
2760 |
}
|
2761 |
|
2762 |
//get cart_item_data from existing cart array ( from session )
|
95 |
//add sitepress filters
|
96 |
add_filter( 'wpml_save_post_trid_value', array( $this, 'wpml_save_post_trid_value' ), 10, 3 );
|
97 |
add_filter( 'wpml_save_post_lang', array( $this, 'wpml_save_post_lang_value' ), 10 );
|
|
|
|
|
98 |
|
99 |
//quick & bulk edit
|
100 |
add_action( 'woocommerce_product_quick_edit_save', array( $this, 'woocommerce_product_quick_edit_save' ) );
|
901 |
update_post_meta($trnsl_product_id,$key,$meta_value);
|
902 |
}
|
903 |
}else{
|
904 |
+
if( ( $woocommerce_wpml->settings['file_path_sync'] && in_array( $key ,array( '_file_paths', '_downloadable_files' ) ) ) || ( isset($settings['translation-management']['custom_fields_translation'][$key]) && $settings['translation-management']['custom_fields_translation'][$key] == 1 ) ){
|
905 |
$meta_value = apply_filters('wcml_meta_value_before_add',$meta_value,$key);
|
906 |
update_post_meta($trnsl_product_id, $key, $meta_value);
|
907 |
}
|
1319 |
|
1320 |
if( empty( $post_id ) && isset( $_GET['post'] ) ){
|
1321 |
$post_id = $_GET['post'];
|
|
|
|
|
|
|
|
|
1322 |
}
|
1323 |
|
1324 |
+
$is_original_post = $this->is_original_product( $post_id );
|
1325 |
+
|
1326 |
if( isset( $_GET[ 'post' ] ) || !$is_original_post ){
|
1327 |
$link = admin_url( 'admin.php?page=wpml-wcml&tab=products&prid='.$post_id );
|
1328 |
}
|
2452 |
}
|
2453 |
}
|
2454 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2455 |
function sync_product_gallery_duplicate_attachment($att_id, $dup_att_id){
|
2456 |
|
2457 |
$product_id = wp_get_post_parent_id($att_id);
|
2723 |
}
|
2724 |
|
2725 |
function get_cart_attribute_translation( $attr_key, $attribute, $variation_id, $current_language, $product_id, $tr_product_id ){
|
|
|
|
|
|
|
|
|
2726 |
|
2727 |
+
$attr_translation = $attribute;
|
2728 |
|
2729 |
+
if( !empty( $attribute ) ){
|
2730 |
+
//delete 'attribute_' at the beginning
|
2731 |
+
$taxonomy = substr( $attr_key, 10, strlen( $attr_key ) - 1 );
|
|
|
|
|
2732 |
|
2733 |
+
if( taxonomy_exists( $taxonomy ) ){
|
2734 |
|
2735 |
+
$term_id = $this->wcml_get_term_id_by_slug( $taxonomy, $attribute );
|
2736 |
+
$trnsl_term_id = apply_filters( 'translate_object_id',$term_id,$taxonomy,true,$current_language);
|
2737 |
+
$term = $this->wcml_get_term_by_id( $trnsl_term_id, $taxonomy );
|
2738 |
+
$attr_translation = $term->slug;
|
2739 |
}else{
|
2740 |
+
|
2741 |
+
$trnsl_attr = get_post_meta( $variation_id, $attr_key, true );
|
2742 |
+
|
2743 |
+
if( $trnsl_attr ){
|
2744 |
+
$attr_translation = $trnsl_attr;
|
2745 |
+
}else{
|
2746 |
+
$attr_translation = $this->get_custom_attr_translation( $product_id, $tr_product_id, $taxonomy, $attribute );
|
2747 |
+
}
|
2748 |
}
|
2749 |
}
|
2750 |
+
|
2751 |
+
return $attr_translation;
|
2752 |
}
|
2753 |
|
2754 |
//get cart_item_data from existing cart array ( from session )
|
inc/wc-strings.class.php
CHANGED
@@ -13,48 +13,64 @@ class WCML_WC_Strings{
|
|
13 |
add_filter( 'query_vars', array( $this, 'translate_query_var_for_product' ) );
|
14 |
add_filter( 'wp_redirect', array( $this, 'encode_shop_slug' ), 10, 2 );
|
15 |
add_action( 'registered_taxonomy', array ( $this, 'translate_attributes_label_in_wp_taxonomies' ), 100, 3 );
|
16 |
-
|
17 |
-
|
18 |
|
|
|
19 |
}
|
20 |
|
21 |
-
function payment_gateways_filters(
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
}elseif( isset( $gateway->id ) ){
|
28 |
$gateway_id = $gateway->id;
|
29 |
}else{
|
30 |
continue;
|
31 |
}
|
32 |
-
|
33 |
-
|
34 |
add_filter( 'woocommerce_settings_api_sanitized_fields_'.$gateway_id, array( $this, 'register_gateway_strings' ) );
|
35 |
add_filter( 'option_woocommerce_'.$gateway_id.'_settings', array( $this, 'translate_gateway_strings' ), 9, 2 );
|
36 |
}
|
37 |
-
|
38 |
-
return $payment_gateways;
|
39 |
}
|
40 |
|
41 |
-
function shipping_methods_filters(
|
42 |
|
43 |
-
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
}elseif( isset( $shipping_method->id ) ){
|
48 |
$shipping_method_id = $shipping_method->id;
|
49 |
}else{
|
50 |
continue;
|
51 |
}
|
52 |
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
54 |
add_filter( 'option_woocommerce_'.$shipping_method_id.'_settings', array( $this, 'translate_shipping_strings' ), 9, 2 );
|
55 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
-
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
|
60 |
function pre_init(){
|
@@ -294,12 +310,16 @@ class WCML_WC_Strings{
|
|
294 |
}
|
295 |
|
296 |
if( isset( $shipping_method_id ) ){
|
297 |
-
|
298 |
}
|
299 |
|
300 |
return $fields;
|
301 |
}
|
302 |
|
|
|
|
|
|
|
|
|
303 |
function translate_shipping_strings( $value, $option = false ){
|
304 |
|
305 |
if( $option && isset( $value['enabled']) && $value['enabled'] == 'no' ){
|
@@ -433,40 +453,10 @@ class WCML_WC_Strings{
|
|
433 |
|
434 |
function show_custom_url_base_translation_links(){
|
435 |
global $woocommerce_wpml,$sitepress;
|
436 |
-
|
437 |
-
?>
|
438 |
-
<script>
|
439 |
-
var inputs = ['woocommerce_product_category_slug', 'woocommerce_product_tag_slug', 'woocommerce_product_attribute_slug', 'product_permalink_structure'];
|
440 |
-
|
441 |
-
for(i in inputs){
|
442 |
-
var input = jQuery('input[name="' + inputs[i] + '"]');
|
443 |
-
if(input.length){
|
444 |
-
|
445 |
-
if(inputs[i] == 'product_permalink_structure' && jQuery('input[name="product_permalink"]:checked').val() == '' ){
|
446 |
-
input = jQuery('input[name="product_permalink"]:checked').closest('.form-table').find('code').eq(0);
|
447 |
-
}
|
448 |
-
|
449 |
-
input.parent().append('<div class="translation_controls"></div>');
|
450 |
-
|
451 |
-
if(inputs[i] == 'woocommerce_product_attribute_slug' && input.val() == '' ){
|
452 |
-
|
453 |
-
input.parent().find('.translation_controls').append(' ');
|
454 |
-
|
455 |
-
}else{
|
456 |
-
input.parent().find('.translation_controls').append('<a href="<?php
|
457 |
-
echo admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&context='. urlencode($woocommerce_wpml->url_translation->url_strings_context()) )
|
458 |
-
?>"><?php _e('translations', 'woocommerce-multilingual') ?></a>');
|
459 |
-
}
|
460 |
-
|
461 |
-
}
|
462 |
-
}
|
463 |
-
</script>
|
464 |
-
<?php
|
465 |
|
466 |
$lang_selector = new WPML_Simple_Language_Selector( $sitepress );
|
467 |
|
468 |
-
$permalink_options = get_option( 'woocommerce_permalinks' );
|
469 |
-
|
470 |
$bases = array( 'tag_base' => 'product_tag', 'category_base' => 'product_cat', 'attribute_base' => 'attribute', 'product_base' => 'product' );
|
471 |
|
472 |
foreach( $bases as $key => $base ){
|
@@ -486,7 +476,11 @@ class WCML_WC_Strings{
|
|
486 |
break;
|
487 |
case 'product':
|
488 |
$input_name = 'product_permalink_structure';
|
489 |
-
|
|
|
|
|
|
|
|
|
490 |
break;
|
491 |
}
|
492 |
|
@@ -501,6 +495,26 @@ class WCML_WC_Strings{
|
|
501 |
<script>
|
502 |
var input = jQuery('input[name="<?php echo $input_name ?>"]');
|
503 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
504 |
if( '<?php echo $input_name ?>' == 'product_permalink_structure' && jQuery('input[name="product_permalink"]:checked').val() == '' ){
|
505 |
|
506 |
input = jQuery('input[name="product_permalink"]:checked').closest('.form-table').find('code').eq(0);
|
13 |
add_filter( 'query_vars', array( $this, 'translate_query_var_for_product' ) );
|
14 |
add_filter( 'wp_redirect', array( $this, 'encode_shop_slug' ), 10, 2 );
|
15 |
add_action( 'registered_taxonomy', array ( $this, 'translate_attributes_label_in_wp_taxonomies' ), 100, 3 );
|
16 |
+
$this->payment_gateways_filters();
|
17 |
+
$this->shipping_methods_filters();
|
18 |
|
19 |
+
add_action('wp_ajax_woocommerce_shipping_zone_methods_save_settings', array( $this, 'save_shipping_zone_method_from_ajax'), 9);
|
20 |
}
|
21 |
|
22 |
+
function payment_gateways_filters( ){
|
23 |
|
24 |
+
$payment_gateways = WC()->payment_gateways()->payment_gateways;
|
25 |
|
26 |
+
foreach ( $payment_gateways as $gateway ) {
|
27 |
+
if( isset( $gateway->id ) ){
|
|
|
28 |
$gateway_id = $gateway->id;
|
29 |
}else{
|
30 |
continue;
|
31 |
}
|
|
|
|
|
32 |
add_filter( 'woocommerce_settings_api_sanitized_fields_'.$gateway_id, array( $this, 'register_gateway_strings' ) );
|
33 |
add_filter( 'option_woocommerce_'.$gateway_id.'_settings', array( $this, 'translate_gateway_strings' ), 9, 2 );
|
34 |
}
|
|
|
|
|
35 |
}
|
36 |
|
37 |
+
function shipping_methods_filters( ){
|
38 |
|
39 |
+
$shipping_methods = WC()->shipping->get_shipping_methods();
|
40 |
|
41 |
+
foreach ( $shipping_methods as $shipping_method ) {
|
42 |
+
if( isset( $shipping_method->id ) ){
|
|
|
43 |
$shipping_method_id = $shipping_method->id;
|
44 |
}else{
|
45 |
continue;
|
46 |
}
|
47 |
|
48 |
+
if( ( defined('WC_VERSION') && version_compare( WC_VERSION , '2.6', '<' ) ) ){
|
49 |
+
add_filter( 'woocommerce_settings_api_sanitized_fields_'.$shipping_method_id, array( $this, 'register_shipping_strings' ) );
|
50 |
+
}else{
|
51 |
+
add_filter( 'woocommerce_shipping_' . $shipping_method_id . '_instance_settings_values', array( $this, 'register_zone_shipping_strings' ),9,2 );
|
52 |
+
}
|
53 |
+
|
54 |
add_filter( 'option_woocommerce_'.$shipping_method_id.'_settings', array( $this, 'translate_shipping_strings' ), 9, 2 );
|
55 |
}
|
56 |
+
}
|
57 |
+
|
58 |
+
function save_shipping_zone_method_from_ajax(){
|
59 |
+
foreach( $_POST['data'] as $key => $value ){
|
60 |
+
if( strstr( $key, '_title' ) ){
|
61 |
+
$shipping_id = str_replace( 'woocommerce_', '', $key );
|
62 |
+
$shipping_id = str_replace( '_title', '', $shipping_id );
|
63 |
+
$this->register_shipping_title( $shipping_id.$_POST['instance_id'], $value );
|
64 |
+
break;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
|
69 |
+
function register_zone_shipping_strings( $instance_settings, $object ){
|
70 |
+
if( !empty( $instance_settings['title'] ) ){
|
71 |
+
$this->register_shipping_title( $object->id.$object->instance_id, $instance_settings['title'] );
|
72 |
+
}
|
73 |
+
return $instance_settings;
|
74 |
}
|
75 |
|
76 |
function pre_init(){
|
310 |
}
|
311 |
|
312 |
if( isset( $shipping_method_id ) ){
|
313 |
+
$this->register_shipping_title( $shipping_method_id, $fields['title'] );
|
314 |
}
|
315 |
|
316 |
return $fields;
|
317 |
}
|
318 |
|
319 |
+
function register_shipping_title( $shipping_method_id, $title ){
|
320 |
+
do_action( 'wpml_register_single_string', 'woocommerce', $shipping_method_id .'_shipping_method_title', $title );
|
321 |
+
}
|
322 |
+
|
323 |
function translate_shipping_strings( $value, $option = false ){
|
324 |
|
325 |
if( $option && isset( $value['enabled']) && $value['enabled'] == 'no' ){
|
453 |
|
454 |
function show_custom_url_base_translation_links(){
|
455 |
global $woocommerce_wpml,$sitepress;
|
456 |
+
$permalink_options = get_option( 'woocommerce_permalinks' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
|
458 |
$lang_selector = new WPML_Simple_Language_Selector( $sitepress );
|
459 |
|
|
|
|
|
460 |
$bases = array( 'tag_base' => 'product_tag', 'category_base' => 'product_cat', 'attribute_base' => 'attribute', 'product_base' => 'product' );
|
461 |
|
462 |
foreach( $bases as $key => $base ){
|
476 |
break;
|
477 |
case 'product':
|
478 |
$input_name = 'product_permalink_structure';
|
479 |
+
if( empty( $permalink_options['product_base'] ) ){
|
480 |
+
$value = _x( 'product', 'default-slug', 'woocommerce' );
|
481 |
+
}else{
|
482 |
+
$value = trim( $permalink_options['product_base'], '/' );
|
483 |
+
}
|
484 |
break;
|
485 |
}
|
486 |
|
495 |
<script>
|
496 |
var input = jQuery('input[name="<?php echo $input_name ?>"]');
|
497 |
|
498 |
+
if(input.length){
|
499 |
+
|
500 |
+
if( '<?php echo $input_name ?>' == 'product_permalink_structure' && jQuery('input[name="product_permalink"]:checked').val() == '' ){
|
501 |
+
input = jQuery('input[name="product_permalink"]:checked').closest('.form-table').find('code').eq(0);
|
502 |
+
}
|
503 |
+
|
504 |
+
input.parent().append('<div class="translation_controls"></div>');
|
505 |
+
|
506 |
+
if( '<?php echo $input_name ?>' == 'woocommerce_product_attribute_slug' && input.val() == '' ){
|
507 |
+
|
508 |
+
input.parent().find('.translation_controls').append(' ');
|
509 |
+
|
510 |
+
}else{
|
511 |
+
input.parent().find('.translation_controls').append('<a href="<?php
|
512 |
+
echo admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&context='. urlencode($woocommerce_wpml->url_translation->url_strings_context() ).'&search='.$value.'&em=1' )
|
513 |
+
?>"><?php _e('translations', 'woocommerce-multilingual') ?></a>');
|
514 |
+
}
|
515 |
+
|
516 |
+
}
|
517 |
+
|
518 |
if( '<?php echo $input_name ?>' == 'product_permalink_structure' && jQuery('input[name="product_permalink"]:checked').val() == '' ){
|
519 |
|
520 |
input = jQuery('input[name="product_permalink"]:checked').closest('.form-table').find('code').eq(0);
|
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.5
|
8 |
-
Stable tag: 3.7.
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
@@ -78,6 +78,14 @@ In order for the checkout and store pages to appear translated, you need to crea
|
|
78 |
|
79 |
== Changelog ==
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
= 3.7.12 =
|
82 |
* Fixed a bug that made the shop pages return 404 errors on WordPress 4.5
|
83 |
* Fixed warnings caused by terms translated before the WooCommerce Multilingual activation
|
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.5.1
|
8 |
+
Stable tag: 3.7.13
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
78 |
|
79 |
== Changelog ==
|
80 |
|
81 |
+
= 3.7.13 =
|
82 |
+
* Bug fix: When adding a global attribute inline while creating a product in a secondary language, the term was created in the wrong language
|
83 |
+
* Fixed a compatibility issues with WooCommerce Tab Manager: fatal error when trying to translate a product
|
84 |
+
* Fixed another compatibility issues with WooCommerce Tab Manager: when a product had only a global tab, the translated tab didn't show up on the translated product
|
85 |
+
* Improvements for how the gateways strings are registered for translation
|
86 |
+
* Updated logic for registering and translating Shipping zones and methods according to changes in WooCommerce 2.6
|
87 |
+
|
88 |
+
|
89 |
= 3.7.12 =
|
90 |
* Fixed a bug that made the shop pages return 404 errors on WordPress 4.5
|
91 |
* Fixed warnings caused by terms translated before the WooCommerce Multilingual activation
|
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.13
|
10 |
*/
|
11 |
|
12 |
|
13 |
if(defined('WCML_VERSION')) return;
|
14 |
+
define('WCML_VERSION', '3.7.13');
|
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');
|