[wp-trac] [WordPress Trac] #51035: drop downs are not working
WordPress Trac
noreply at wordpress.org
Sun Aug 16 18:37:56 UTC 2020
#51035: drop downs are not working
------------------------------+----------------------
Reporter: sandyeggodesigns | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: General | Version: 5.5
Severity: normal | Resolution: invalid
Keywords: | Focuses:
------------------------------+----------------------
Description changed by SergeyBiryukov:
Old description:
> I am using WP 5.5
> After update, first I noticed plugin "WooCommerce Shipment Tracking" used
> on Edit Order page was not working anymore. The button for "Add Tracking
> Number" didn't do anything.
>
> After a LOT of digging, I found that plugin uses this CSS:
> #woocommerce-shipment-tracking #shipment-tracking-form{display:none}
>
> And then a Javascript function in admin.js is supposed to change the
> display to show it:
> jQuery( function( $ ) {
>
> var wc_shipment_tracking_items = {
>
> // init Class
> init: function() {
> $( '#woocommerce-shipment-tracking' )
> .on( 'click', 'a.delete-tracking',
> this.delete_tracking )
> .on( 'click', 'button.button-show-form',
> this.show_form )
> .on( 'click', 'button.button-save-form',
> this.save_form );
> },
>
> // When a user enters a new tracking item
> save_form: function () {
>
> if ( !$( 'input#tracking_number' ).val() ) {
> return false;
> }
>
> $( '#shipment-tracking-form' ).block( {
> message: null,
> overlayCSS: {
> background: '#fff',
> opacity: 0.6
> }
> } );
>
> var data = {
> action:
> 'wc_shipment_tracking_save_form',
> order_id:
> woocommerce_admin_meta_boxes.post_id,
> tracking_provider: $(
> '#tracking_provider' ).val(),
> custom_tracking_provider: $(
> '#custom_tracking_provider' ).val(),
> custom_tracking_link: $(
> 'input#custom_tracking_link' ).val(),
> tracking_number: $(
> 'input#tracking_number' ).val(),
> date_shipped: $(
> 'input#date_shipped' ).val(),
> security: $(
> '#wc_shipment_tracking_create_nonce' ).val()
> };
>
> $.post( woocommerce_admin_meta_boxes.ajax_url,
> data, function( response ) {
> $( '#shipment-tracking-form' ).unblock();
> if ( response != '-1' ) {
> $( '#shipment-tracking-form'
> ).hide();
> $( '#woocommerce-shipment-
> tracking #tracking-items' ).append( response );
> $( '#woocommerce-shipment-
> tracking button.button-show-form' ).show();
> $( '#tracking_provider'
> ).selectedIndex = 0;
> $( '#custom_tracking_provider'
> ).val( '' );
> $( 'input#custom_tracking_link'
> ).val( '' );
> $( 'input#tracking_number' ).val(
> '' );
> $( 'input#date_shipped' ).val( ''
> );
> $('p.preview_tracking_link').hide();
> }
> });
>
> return false;
> },
>
> // Show the new tracking item form
> show_form: function () {
> $( '#shipment-tracking-form' ).show();
> $( '#woocommerce-shipment-tracking button.button-
> show-form' ).hide();
> },
>
> // Delete a tracking item
> delete_tracking: function() {
>
> var tracking_id = $( this ).attr( 'rel' );
>
> $( '#tracking-item-' + tracking_id ).block({
> message: null,
> overlayCSS: {
> background: '#fff',
> opacity: 0.6
> }
> });
>
> var data = {
> action:
> 'wc_shipment_tracking_delete_item',
> order_id:
> woocommerce_admin_meta_boxes.post_id,
> tracking_id: tracking_id,
> security: $(
> '#wc_shipment_tracking_delete_nonce' ).val()
> };
>
> $.post( woocommerce_admin_meta_boxes.ajax_url,
> data, function( response ) {
> $( '#tracking-item-' + tracking_id
> ).unblock();
> if ( response != '-1' ) {
> $( '#tracking-item-' +
> tracking_id ).remove();
> }
> });
>
> return false;
> },
>
> refresh_items: function() {
> var data = {
> action:
> 'wc_shipment_tracking_get_items',
> order_id:
> woocommerce_admin_meta_boxes.post_id,
> security: $(
> '#wc_shipment_tracking_get_nonce' ).val()
> };
>
> $( '#woocommerce-shipment-tracking' ).block( {
> message: null,
> overlayCSS: {
> background: '#fff',
> opacity: 0.6
> }
> } );
>
> $.post( woocommerce_admin_meta_boxes.ajax_url,
> data, function( response ) {
> $( '#woocommerce-shipment-tracking'
> ).unblock();
> if ( response != '-1' ) {
> $( '#woocommerce-shipment-
> tracking #tracking-items' ).html( response );
> }
> });
> },
> }
>
> wc_shipment_tracking_items.init();
>
> window.wc_shipment_tracking_refresh =
> wc_shipment_tracking_items.refresh_items;
> } );
>
> BUT, this no longer worked after updating to WP 5.5! I had to change the
> Javascript code to move the "jQuery" (namespace?) to a different location
> in the script:
> ( function( $ ) {
>
> var wc_shipment_tracking_items = {
>
> // init Class
> init: function() {
> $( '#woocommerce-shipment-tracking' )
> .on( 'click', 'a.delete-tracking',
> this.delete_tracking )
> .on( 'click', 'button.button-show-form',
> this.show_form )
> .on( 'click', 'button.button-save-form',
> this.save_form );
> },
>
> // When a user enters a new tracking item
> save_form: function () {
>
> if ( !$( 'input#tracking_number' ).val() ) {
> return false;
> }
>
> $( '#shipment-tracking-form' ).block( {
> message: null,
> overlayCSS: {
> background: '#fff',
> opacity: 0.6
> }
> } );
>
> var data = {
> action:
> 'wc_shipment_tracking_save_form',
> order_id:
> woocommerce_admin_meta_boxes.post_id,
> tracking_provider: $(
> '#tracking_provider' ).val(),
> custom_tracking_provider: $(
> '#custom_tracking_provider' ).val(),
> custom_tracking_link: $(
> 'input#custom_tracking_link' ).val(),
> tracking_number: $(
> 'input#tracking_number' ).val(),
> date_shipped: $(
> 'input#date_shipped' ).val(),
> security: $(
> '#wc_shipment_tracking_create_nonce' ).val()
> };
>
> $.post( woocommerce_admin_meta_boxes.ajax_url,
> data, function( response ) {
> $( '#shipment-tracking-form' ).unblock();
> if ( response != '-1' ) {
> $( '#shipment-tracking-form'
> ).hide();
> $( '#woocommerce-shipment-
> tracking #tracking-items' ).append( response );
> $( '#woocommerce-shipment-
> tracking button.button-show-form' ).show();
> $( '#tracking_provider'
> ).selectedIndex = 0;
> $( '#custom_tracking_provider'
> ).val( '' );
> $( 'input#custom_tracking_link'
> ).val( '' );
> $( 'input#tracking_number' ).val(
> '' );
> $( 'input#date_shipped' ).val( ''
> );
> $('p.preview_tracking_link').hide();
> }
> });
>
> return false;
> },
>
> // Show the new tracking item form
> show_form: function () {
> $( '#shipment-tracking-form' ).show();
> $( '#woocommerce-shipment-tracking button.button-
> show-form' ).hide();
> },
>
> // Delete a tracking item
> delete_tracking: function() {
>
> var tracking_id = $( this ).attr( 'rel' );
>
> $( '#tracking-item-' + tracking_id ).block({
> message: null,
> overlayCSS: {
> background: '#fff',
> opacity: 0.6
> }
> });
>
> var data = {
> action:
> 'wc_shipment_tracking_delete_item',
> order_id:
> woocommerce_admin_meta_boxes.post_id,
> tracking_id: tracking_id,
> security: $(
> '#wc_shipment_tracking_delete_nonce' ).val()
> };
>
> $.post( woocommerce_admin_meta_boxes.ajax_url,
> data, function( response ) {
> $( '#tracking-item-' + tracking_id
> ).unblock();
> if ( response != '-1' ) {
> $( '#tracking-item-' +
> tracking_id ).remove();
> }
> });
>
> return false;
> },
>
> refresh_items: function() {
> var data = {
> action:
> 'wc_shipment_tracking_get_items',
> order_id:
> woocommerce_admin_meta_boxes.post_id,
> security: $(
> '#wc_shipment_tracking_get_nonce' ).val()
> };
>
> $( '#woocommerce-shipment-tracking' ).block( {
> message: null,
> overlayCSS: {
> background: '#fff',
> opacity: 0.6
> }
> } );
>
> $.post( woocommerce_admin_meta_boxes.ajax_url,
> data, function( response ) {
> $( '#woocommerce-shipment-tracking'
> ).unblock();
> if ( response != '-1' ) {
> $( '#woocommerce-shipment-
> tracking #tracking-items' ).html( response );
> }
> });
> },
> }
>
> wc_shipment_tracking_items.init();
>
> window.wc_shipment_tracking_refresh =
> wc_shipment_tracking_items.refresh_items;
> } )(jQuery); //FIXED DAK 8/14/20
>
> Now that plugin works like before on the Edit Order page.
>
> --------------------------
>
> Okay, *now* I see OTHER places where I can't see items also. Like the
> pull down boxes in my theme's Menu editor.
> [https://www.dropbox.com/s/4of47izpnltdvci/ice_screenshot_20200816-110948.jpeg?dl=0]
>
> I guess I will have to roll back my WP to a previous version until this
> is fixed.
>
> Sorry if my report is poorly written..:-)
> Regards,
> Dave K.
New description:
I am using WP 5.5
After update, first I noticed plugin "WooCommerce Shipment Tracking" used
on Edit Order page was not working anymore. The button for "Add Tracking
Number" didn't do anything.
After a LOT of digging, I found that plugin uses this CSS:
{{{
#woocommerce-shipment-tracking #shipment-tracking-form{display:none}
}}}
And then a Javascript function in admin.js is supposed to change the
display to show it:
{{{
jQuery( function( $ ) {
var wc_shipment_tracking_items = {
// init Class
init: function() {
$( '#woocommerce-shipment-tracking' )
.on( 'click', 'a.delete-tracking',
this.delete_tracking )
.on( 'click', 'button.button-show-form',
this.show_form )
.on( 'click', 'button.button-save-form',
this.save_form );
},
// When a user enters a new tracking item
save_form: function () {
if ( !$( 'input#tracking_number' ).val() ) {
return false;
}
$( '#shipment-tracking-form' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
var data = {
action:
'wc_shipment_tracking_save_form',
order_id:
woocommerce_admin_meta_boxes.post_id,
tracking_provider: $(
'#tracking_provider' ).val(),
custom_tracking_provider: $(
'#custom_tracking_provider' ).val(),
custom_tracking_link: $(
'input#custom_tracking_link' ).val(),
tracking_number: $(
'input#tracking_number' ).val(),
date_shipped: $(
'input#date_shipped' ).val(),
security: $(
'#wc_shipment_tracking_create_nonce' ).val()
};
$.post( woocommerce_admin_meta_boxes.ajax_url,
data, function( response ) {
$( '#shipment-tracking-form' ).unblock();
if ( response != '-1' ) {
$( '#shipment-tracking-form'
).hide();
$( '#woocommerce-shipment-tracking
#tracking-items' ).append( response );
$( '#woocommerce-shipment-tracking
button.button-show-form' ).show();
$( '#tracking_provider'
).selectedIndex = 0;
$( '#custom_tracking_provider'
).val( '' );
$( 'input#custom_tracking_link'
).val( '' );
$( 'input#tracking_number' ).val(
'' );
$( 'input#date_shipped' ).val( ''
);
$('p.preview_tracking_link').hide();
}
});
return false;
},
// Show the new tracking item form
show_form: function () {
$( '#shipment-tracking-form' ).show();
$( '#woocommerce-shipment-tracking button.button-
show-form' ).hide();
},
// Delete a tracking item
delete_tracking: function() {
var tracking_id = $( this ).attr( 'rel' );
$( '#tracking-item-' + tracking_id ).block({
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
var data = {
action:
'wc_shipment_tracking_delete_item',
order_id:
woocommerce_admin_meta_boxes.post_id,
tracking_id: tracking_id,
security: $(
'#wc_shipment_tracking_delete_nonce' ).val()
};
$.post( woocommerce_admin_meta_boxes.ajax_url,
data, function( response ) {
$( '#tracking-item-' + tracking_id
).unblock();
if ( response != '-1' ) {
$( '#tracking-item-' + tracking_id
).remove();
}
});
return false;
},
refresh_items: function() {
var data = {
action:
'wc_shipment_tracking_get_items',
order_id:
woocommerce_admin_meta_boxes.post_id,
security: $(
'#wc_shipment_tracking_get_nonce' ).val()
};
$( '#woocommerce-shipment-tracking' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
$.post( woocommerce_admin_meta_boxes.ajax_url,
data, function( response ) {
$( '#woocommerce-shipment-tracking'
).unblock();
if ( response != '-1' ) {
$( '#woocommerce-shipment-tracking
#tracking-items' ).html( response );
}
});
},
}
wc_shipment_tracking_items.init();
window.wc_shipment_tracking_refresh =
wc_shipment_tracking_items.refresh_items;
} );
}}}
BUT, this no longer worked after updating to WP 5.5! I had to change the
Javascript code to move the "jQuery" (namespace?) to a different location
in the script:
{{{
( function( $ ) {
var wc_shipment_tracking_items = {
// init Class
init: function() {
$( '#woocommerce-shipment-tracking' )
.on( 'click', 'a.delete-tracking',
this.delete_tracking )
.on( 'click', 'button.button-show-form',
this.show_form )
.on( 'click', 'button.button-save-form',
this.save_form );
},
// When a user enters a new tracking item
save_form: function () {
if ( !$( 'input#tracking_number' ).val() ) {
return false;
}
$( '#shipment-tracking-form' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
var data = {
action:
'wc_shipment_tracking_save_form',
order_id:
woocommerce_admin_meta_boxes.post_id,
tracking_provider: $(
'#tracking_provider' ).val(),
custom_tracking_provider: $(
'#custom_tracking_provider' ).val(),
custom_tracking_link: $(
'input#custom_tracking_link' ).val(),
tracking_number: $(
'input#tracking_number' ).val(),
date_shipped: $(
'input#date_shipped' ).val(),
security: $(
'#wc_shipment_tracking_create_nonce' ).val()
};
$.post( woocommerce_admin_meta_boxes.ajax_url,
data, function( response ) {
$( '#shipment-tracking-form' ).unblock();
if ( response != '-1' ) {
$( '#shipment-tracking-form'
).hide();
$( '#woocommerce-shipment-tracking
#tracking-items' ).append( response );
$( '#woocommerce-shipment-tracking
button.button-show-form' ).show();
$( '#tracking_provider'
).selectedIndex = 0;
$( '#custom_tracking_provider'
).val( '' );
$( 'input#custom_tracking_link'
).val( '' );
$( 'input#tracking_number' ).val(
'' );
$( 'input#date_shipped' ).val( ''
);
$('p.preview_tracking_link').hide();
}
});
return false;
},
// Show the new tracking item form
show_form: function () {
$( '#shipment-tracking-form' ).show();
$( '#woocommerce-shipment-tracking button.button-
show-form' ).hide();
},
// Delete a tracking item
delete_tracking: function() {
var tracking_id = $( this ).attr( 'rel' );
$( '#tracking-item-' + tracking_id ).block({
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
var data = {
action:
'wc_shipment_tracking_delete_item',
order_id:
woocommerce_admin_meta_boxes.post_id,
tracking_id: tracking_id,
security: $(
'#wc_shipment_tracking_delete_nonce' ).val()
};
$.post( woocommerce_admin_meta_boxes.ajax_url,
data, function( response ) {
$( '#tracking-item-' + tracking_id
).unblock();
if ( response != '-1' ) {
$( '#tracking-item-' + tracking_id
).remove();
}
});
return false;
},
refresh_items: function() {
var data = {
action:
'wc_shipment_tracking_get_items',
order_id:
woocommerce_admin_meta_boxes.post_id,
security: $(
'#wc_shipment_tracking_get_nonce' ).val()
};
$( '#woocommerce-shipment-tracking' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
$.post( woocommerce_admin_meta_boxes.ajax_url,
data, function( response ) {
$( '#woocommerce-shipment-tracking'
).unblock();
if ( response != '-1' ) {
$( '#woocommerce-shipment-tracking
#tracking-items' ).html( response );
}
});
},
}
wc_shipment_tracking_items.init();
window.wc_shipment_tracking_refresh =
wc_shipment_tracking_items.refresh_items;
} )(jQuery); //FIXED DAK 8/14/20
}}}
Now that plugin works like before on the Edit Order page.
--------------------------
Okay, *now* I see OTHER places where I can't see items also. Like the pull
down boxes in my theme's Menu editor.
[https://www.dropbox.com/s/4of47izpnltdvci/ice_screenshot_20200816-110948.jpeg?dl=0]
I guess I will have to roll back my WP to a previous version until this is
fixed.
Sorry if my report is poorly written..:-)
Regards,
Dave K.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51035#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list