Loop panels to disable options rather than look at values

This commit is contained in:
Mike Jolley 2019-02-27 14:38:11 +00:00
parent 0469bbe8b0
commit 5a48c41209
1 changed files with 6 additions and 6 deletions

View File

@ -470,13 +470,13 @@ jQuery( function( $ ) {
show_and_hide_panels(); show_and_hide_panels();
// Make sure the dropdown is not disabled for empty value attributes. // Make sure the dropdown is not disabled for empty value attributes.
var nr_elements = original_data.length / 6; $( 'select.attribute_taxonomy' ).find( 'option' ).prop( 'disabled', false );
for ( var i = 0; i < nr_elements; i++ ) {
if ( typeof( original_data ) !== 'undefined' && original_data[ i * 6 + 2 ].value === '' ) { $( '.product_attributes .woocommerce_attribute' ).each( function( index, el ) {
$( 'select.attribute_taxonomy' ) if ( $( el ).css( 'display' ) !== 'none' && $( el ).is( '.taxonomy' ) ) {
.find( 'option[value="' + original_data[ i * 6 ].value + '"]' ).removeAttr( 'disabled' ); $( 'select.attribute_taxonomy' ).find( 'option[value="' + $( el ).data( 'taxonomy' ) + '"]' ).prop( 'disabled', true );
} }
} });
// Reload variations panel. // Reload variations panel.
var this_page = window.location.toString(); var this_page = window.location.toString();