Untitled
unknown
plain_text
a year ago
1.3 kB
2
Indexable
Never
add_action('salesking_dashboard_head', function(){ ?> <script> jQuery(document).ready(function(){ jQuery('body').off('click', '.salesking_shop_as_customer'); jQuery('body').on('click', '.salesking_shop_as_customer', function(){ // Usa window.open per aprire un nuovo tab o finestra window.open("http://b2bkingworkmac.local/wp-admin/post-new.php?post_type=shop_order&customer_user="+jQuery(this).val()+'&agent=<?php echo get_current_user_id();?>', '_blank'); }); }); </script> <?php }); add_action('admin_head', function(){ if(isset($_GET['customer_user'])){ $userid = $_GET['customer_user']; } $agent= ''; if(isset($_GET['agent'])){ $agent = $_GET['agent']; } ?> <script> jQuery(document).ready(function(){ jQuery('#customer_user option').val(<?php echo $userid;?>); jQuery('#customer_user').trigger('change'); jQuery('#salesking_agent_order option[value="'+<?php echo esc_html($agent);?>+'"]').prop('selected', true); jQuery('#salesking_agent_order option[value="'+<?php echo esc_html($agent);?>+'"]').attr('selected', true); jQuery('#salesking_agent_order').trigger('change'); }); </script> <?php });