WPML
状态
已解决
报告针对
WPML Multilingual CMS 3.2.7
解决于
WPML 3.3

问题概述

当为 WooCommerce 产品启用 Visual Composer 时,您无法在 WPML 3.2.7 WCML 3.6.11 中切换变体选项卡

临时解决方法

解决方案 1

1. 下载此文件 post-edit_fix_for_WPML_3.2.7

2. 解压此下载文件。您将看到一个名为 post-edit.js 的文件。

3. 使用 FTP 连接到您的站点,并使用第 2 步中解压的文件覆盖当前文件 plugins/sitepress-multilingual-cms/res/js/post-edit.js。

4. 清除您的浏览器缓存。

解决方案 2

1. 打开文件 plugins/sitepress-multilingual-cms/res/js/post-edit.js

2. 查找(第 240 行):
/**
* HOTFIX DIALOG BOX
* Remove when WooCommerce does not include jquery-ui smoothness anymore
**/
var jQueryUI = $( '#jquery-ui-style-css[href*="smoothness"]' ),
jQuerySmoothnessHref;

// if jquery ui smoothness css is loaded
if( jQueryUI.length ) {
// event listener for hide
$.each( ['hide'], function ( i, ev ) {
var el = $.fn[ev];
if( $( this.hidden ) ) {
$.fn[ev] = function () {
this.trigger( ev );
return el.apply( this, arguments );
};
}
});

// click on Connect with translations
$( 'body' ).on( 'click', '#icl_document_connect_translations_dropdown .js-set-post-as-source', function() {
var connectDialog = $( '[aria-describedby="connect_translations_dialog"]' );

jQuerySmoothnessHref = jQueryUI.attr( 'href' );
jQueryUI.attr( 'href', '' );

connectDialog.on( 'hide', function() {
if( $( '.ui-widget-overlay' ).length == 0 ) {
jQueryUI.attr( 'href', jQuerySmoothnessHref );
connectDialog.off( 'hide' );
}
} );
} );
}
/* HOTFIX END */
3. 替换为:
/**
* HOTFIX DIALOG BOX
* Remove when WooCommerce does not include jquery-ui smoothness anymore
**/
var jQueryUI = $( '#jquery-ui-style-css[href*="smoothness"]' ),
jQuerySmoothnessHref;

// if jquery ui smoothness css is loaded
if( jQueryUI.length ) {
// click on Connect with translations
$( 'body' ).on( 'click', '#icl_document_connect_translations_dropdown .js-set-post-as-source', function() {
var connectDialog = $( '[aria-describedby="connect_translations_dialog"]'), intervalCheckDialog;

// abort if dialog does not exists
if( ! connectDialog.length ) return false;

// backup href of jquery ui smoothness
jQuerySmoothnessHref = jQueryUI.attr( 'href' );

// remove jquery ui smoothness css
jQueryUI.attr( 'href', '' );

// check every 250ms if connect translations dialog is still open
intervalCheckDialog = setInterval( function() {
// if dialog is not open anymore
if( ! connectDialog.is(':visible') ) {
if( $( '.ui-widget-overlay' ).length == 0 ) {
// reapply jquery ui smoothness css again
jQueryUI.attr( 'href', jQuerySmoothnessHref );
// stop interval
clearInterval( intervalCheckDialog );
}
}
}, 250 );
} );
}
/* HOTFIX END */
4. 保存并关闭。

所有已知问题 →