I want to alert you to an error that is caused in the javascript admin when this plugin is active. The site is using WordPress 5.0.3 and WooCommerce 3.5.4. Both are the latest versions as of this post. When you try and access the variations of a product on the product admin page the are not displayed and there is the following javascript error:
Uncaught TypeError: Cannot read property 'replace' of undefined
at CMB2ConditionalsFindDependants (cmb2-conditionals.js?ver=1.0.4:formatted:209)
at HTMLSelectElement.<anonymous> (cmb2-conditionals.js?ver=1.0.4:formatted:41)
at HTMLFormElement.dispatch (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:3)
at HTMLFormElement.r.handle (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:3)
at Object.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:3)
at Object.a.event.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:9)
at HTMLSelectElement.<anonymous> (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:3)
at Function.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:2)
at a.fn.init.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:2)
at a.fn.init.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:3)
I was able to resolve this by editing the plugin function CMB2ConditionalsFindDependants in file /includes/CMB2-conditionals/cmb2-conditionals.js to:
function CMB2ConditionalsFindDependants( fieldName, elm, context ) {
var inGroup, iterator;
var dependants = [];
if( typeof( fileName ) != "undefined" ) {
// Remove the empty [] at the end of a multi-check field.
fieldName = fieldName.replace( /\[\]$/, '' );
// Is there an element which is conditional on this element ?
// If a group element, within the group.
inGroup = elm.closest( '.cmb-repeatable-grouping' );
if ( 1 === inGroup.length ) {
iterator = elm.closest( '[data-iterator]' ).data( 'iterator' );
dependants = $( '[data-conditional-id]', inGroup ).filter( function() {
var conditionalId = $( this ).data( 'conditional-id' );
return ( Array.isArray( conditionalId ) && ( fieldName === conditionalId[0] + '[' + iterator + '][' + conditionalId[1] + ']' ) );
});
}
// Else within the whole form.
else {
dependants = $( '[data-conditional-id="' + fieldName + '"]', context );
}
}
return dependants;
}
]]>
Just now when updating to the latest version of the plugin my site went down with the following error message:
PHP Fatal error occurred: Uncaught Error: Class 'Smart_Overlay_Custom_Fields' not found in /my/path/public_html/wp-content/plugins/smart-overlay/classes/class-smart-overlay.php:105 Stack trace: #0 /my/path/public_html/wp-content/plugins/smart-overlay/classes/class-smart-overlay.php(57): Smart_Overlay->load_dependencies() #1 /my/path/public_html/wp-content/plugins/smart-overlay/smart-overlay.php(28): Smart_Overlay->__construct() #2 /my/path/public_html/wp-includes/class-wp-hook.php(286): run_smart_overlay('') #3 /my/path/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #4 /my/path/public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #5 /my/path/public_html/wp-settings.php(327): do_action('plugins_loaded') #6 /my/path/public_html/wp-config.php(98): require_once('/my/path/p...') #7 /my/path/public_html/wp-load.php(37): require_once('/my/path/p...') #8 /my/path/public_html/wp-blog-header.php(13): require_once('/my/path/p...') in /my/path/public_html/wp-content/plugins/smart-overlay/classes/class-smart-overlay.php on line 105.
After disabling the plugin my site works. The plugin was working perfectly until this update.
]]>Is there any way to creat an option for Display Popover On (Page x) id maybe. I am good enough with PHP to insert a post_id if this is all it needs.
]]>