diff --git a/assets/css/admin.css b/assets/css/admin.css index 7bc11ffba3d..1980bda0cbc 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -137,6 +137,7 @@ div.multi_select_products_wrapper{float:left;width:49%;padding:0;} div.multi_select_products_wrapper-alt{float:right;} .multi_select_products,div.multi_select_countries{border:1px solid #ececec;height:200px;overflow:auto;width:100%;float:left;} .multi_select_products{background:#fff;} +.multi_select_products.loading{background:#ffffff url(../images/ajax-loader.gif) no-repeat center;} .multi_select_products li{padding:7px 9px;line-height:2em;border-bottom:1px dotted #ececec;} .multi_select_countries li{padding:3px 9px;margin:0;line-height:2em;border-bottom:1px dotted #ececec;} .multi_select_countries li label{display:block;} diff --git a/assets/css/admin.less b/assets/css/admin.less index deabf3470f9..06101e73a29 100644 --- a/assets/css/admin.less +++ b/assets/css/admin.less @@ -715,6 +715,9 @@ div.multi_select_products_wrapper-alt { .multi_select_products { background: #fff; } +.multi_select_products.loading { + background: #fff url(../images/ajax-loader.gif) no-repeat center; +} .multi_select_products li { padding: 7px 9px; line-height: 2em; diff --git a/assets/images/ajax-loader.gif b/assets/images/ajax-loader.gif index d93974ffab9..58c802efb1f 100644 Binary files a/assets/images/ajax-loader.gif and b/assets/images/ajax-loader.gif differ diff --git a/assets/js/admin/write-panels.js b/assets/js/admin/write-panels.js index dcb5b124cb7..43ea17a64e5 100644 --- a/assets/js/admin/write-panels.js +++ b/assets/js/admin/write-panels.js @@ -1,5 +1,10 @@ jQuery( function($){ - + + // Prevent enter submitting post form + jQuery("form#post").bind("keypress", function(e) { + if (e.keyCode == 34 || e.keyCode == 13) return false; + }); + // TABS jQuery('ul.tabs').show(); jQuery('div.panel-wrap').each(function(){ @@ -268,7 +273,7 @@ jQuery( function($){ if (product_type!='variable') enable_variation = 'style="display:none;"'; else enable_variation = ''; // Add custom attribute row - jQuery('table.woocommerce_attributes tbody').append(''); + jQuery('table.woocommerce_attributes tbody').append(''); } else { @@ -303,19 +308,29 @@ jQuery( function($){ return false; }); - jQuery('button.move_up').live('click', function(){ - var row = jQuery(this).parent().parent(); - var prev_row = jQuery(row).prev('tr'); - jQuery(row).after(prev_row); - row_indexes(); - }); - jQuery('button.move_down').live('click', function(){ - var row = jQuery(this).parent().parent(); - var next_row = jQuery(row).next('tr'); - jQuery(row).before(next_row); - row_indexes(); + // Attribute ordering + jQuery('table.woocommerce_attributes tbody').sortable({ + items:'tr', + cursor:'move', + axis:'y', + scrollSensitivity:40, + helper:function(e,ui){ + ui.children().each(function(){ + jQuery(this).width(jQuery(this).width()); + }); + return ui; + }, + start:function(event,ui){ + ui.item.css('background-color','#f6f6f6'); + }, + stop:function(event,ui){ + ui.item.removeAttr('style'); + row_indexes(); + } }); + + // Cross sells/Up sells jQuery('.multi_select_products button').live('click', function(){ var wrapper = jQuery(this).parent().parent().parent().parent(); @@ -333,29 +348,43 @@ jQuery( function($){ } }); + var xhr; + jQuery('.multi_select_products #product_search').bind('keyup click', function(){ + jQuery('.multi_select_products_source').addClass('loading'); jQuery('.multi_select_products_source li:not(.product_search)').remove(); - var search = encodeURI( jQuery(this).val() ); + if (xhr) xhr.abort(); + + var search = jQuery(this).val(); var input = this; var name = jQuery(this).attr('rel'); - if (search.length<3) return; + if (search.length<3) { + jQuery('.multi_select_products_source').removeClass('loading'); + return; + } var data = { name: name, - search: search, + search: encodeURI(search), action: 'woocommerce_upsell_crosssell_search_products', security: woocommerce_writepanel_params.upsell_crosssell_search_products_nonce }; - jQuery.post( woocommerce_writepanel_params.ajax_url, data, function( response ) { + xhr = jQuery.ajax({ + url: woocommerce_writepanel_params.ajax_url, + data: data, + type: 'POST', + success: function( response ) { - jQuery('.multi_select_products_source li:not(.product_search)').remove(); - jQuery(input).parent().parent().append( response ); - - } ); + jQuery('.multi_select_products_source').removeClass('loading'); + jQuery('.multi_select_products_source li:not(.product_search)').remove(); + jQuery(input).parent().parent().append( response ); + + } + }); }); diff --git a/assets/js/admin/write-panels.min.js b/assets/js/admin/write-panels.min.js index 328f257b4e7..9053cfa2ddb 100644 --- a/assets/js/admin/write-panels.min.js +++ b/assets/js/admin/write-panels.min.js @@ -1,372 +1 @@ -jQuery( function($){ - - // TABS - jQuery('ul.tabs').show(); - jQuery('div.panel-wrap').each(function(){ - jQuery('div.panel:not(div.panel:first)', this).hide(); - }); - jQuery('ul.tabs a').click(function(){ - var panel_wrap = jQuery(this).closest('div.panel-wrap'); - jQuery('ul.tabs li', panel_wrap).removeClass('active'); - jQuery(this).parent().addClass('active'); - jQuery('div.panel', panel_wrap).hide(); - jQuery( jQuery(this).attr('href') ).show(); - return false; - }); - - // ORDERS - - jQuery('#order_items_list button.remove_row').live('click', function(){ - var answer = confirm(woocommerce_writepanel_params.remove_item_notice); - if (answer){ - jQuery(this).closest('tr.item').hide(); - jQuery('input', jQuery(this).closest('tr.item')).val(''); - } - return false; - }); - - jQuery('button.calc_totals').live('click', function(){ - var answer = confirm(woocommerce_writepanel_params.cart_total); - if (answer){ - - var item_count = jQuery('#order_items_list tr.item').size(); - var subtotal = 0; - var discount = jQuery('input#order_discount').val(); - var shipping = jQuery('input#order_shipping').val(); - var shipping_tax = parseFloat(jQuery('input#order_shipping_tax').val()); - var tax = 0; - var itemTotal = 0; - var total = 0; - - if (!discount) discount = 0; - if (!shipping) shipping = 0; - if (!shipping_tax) shipping_tax = 0; - - // Items - if (item_count>0) { - for (i=0; i0) { - - taxRate = itemTax/100; - - itemTaxAmount = ((itemCost * taxRate) * 100 ); - - itemTaxAmount = itemTaxAmount.toFixed(2); - - totalItemTax = Math.round( itemTaxAmount ) / 100; - - totalItemTax = totalItemTax * itemQty; - - } - - itemTotal = itemTotal + totalItemCost; - - tax = tax + totalItemTax; - } - } - - subtotal = itemTotal; - - total = parseFloat(subtotal) + parseFloat(tax) - parseFloat(discount) + parseFloat(shipping) + parseFloat(shipping_tax); - - if (total < 0 ) total = 0; - - jQuery('input#order_subtotal').val( subtotal.toFixed(2) ); - jQuery('input#order_tax').val( tax.toFixed(2) ); - jQuery('input#order_shipping_tax').val( shipping_tax.toFixed(2) ); - jQuery('input#order_total').val( total.toFixed(2) ); - - } - return false; - }); - - jQuery('button.add_shop_order_item').click(function(){ - - var add_item_id = jQuery('select.add_item_id').val(); - - if (add_item_id) { - - jQuery('table.woocommerce_order_items').block({ message: null, overlayCSS: { background: '#fff url(' + woocommerce_writepanel_params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } }); - - var size = jQuery('table.woocommerce_order_items tbody tr.item').size(); - - var data = { - action: 'woocommerce_add_order_item', - item_to_add: jQuery('select.add_item_id').val(), - index: size, - security: woocommerce_writepanel_params.add_order_item_nonce - }; - - jQuery.post( woocommerce_writepanel_params.ajax_url, data, function(response) { - - jQuery('table.woocommerce_order_items tbody#order_items_list').append( response ); - jQuery('table.woocommerce_order_items').unblock(); - jQuery('select.add_item_id').css('border-color', '').val(''); - jQuery(".tips").easyTooltip(); - - }); - - } else { - jQuery('select.add_item_id').css('border-color', 'red'); - } - - }); - - jQuery('button.add_meta').live('click', function(){ - - var index = jQuery(this).closest('tr.item').attr('rel'); - - jQuery(this).closest('table.meta').find('.meta_items').append(''); - - return false; - - }); - - jQuery('button.remove_meta').live('click', function(){ - var answer = confirm("Remove this meta key?") - if (answer){ - jQuery(this).closest('tr').remove(); - } - return false; - }); - - jQuery('button.billing-same-as-shipping').live('click', function(){ - var answer = confirm(woocommerce_writepanel_params.copy_billing); - if (answer){ - jQuery('input#shipping_first_name').val( jQuery('input#billing_first_name').val() ); - jQuery('input#shipping_last_name').val( jQuery('input#billing_last_name').val() ); - jQuery('input#shipping_company').val( jQuery('input#billing_company').val() ); - jQuery('input#shipping_address_1').val( jQuery('input#billing_address_1').val() ); - jQuery('input#shipping_address_2').val( jQuery('input#billing_address_2').val() ); - jQuery('input#shipping_city').val( jQuery('input#billing_city').val() ); - jQuery('input#shipping_postcode').val( jQuery('input#billing_postcode').val() ); - jQuery('input#shipping_country').val( jQuery('input#billing_country').val() ); - jQuery('input#shipping_state').val( jQuery('input#billing_state').val() ); - } - return false; - }); - - // PRODUCT TYPE SPECIFIC OPTIONS - $('select#product-type').change(function(){ - - // Get value - var select_val = jQuery(this).val(); - - // Hide options - $('#woocommerce-product-type-options .inside > div').hide(); - $('#'+select_val+'_product_options').show(); - - // Show option - if (select_val=='variable') { - jQuery('.stock_fields, .manage_stock_field, .tax_tab, .options_group.pricing').show(); - jQuery('.options_group.grouping').val('').hide(); - jQuery('td.enable_variation, th.enable_variation').show(); - } else if (select_val=='simple') { - jQuery('.stock_fields, .manage_stock_field, .tax_tab, .options_group.pricing').show(); - jQuery('.options_group.grouping').show(); - jQuery('td.enable_variation, th.enable_variation').hide(); - } else if (select_val=='grouped') { - jQuery('.stock_fields, .manage_stock_field, .tax_tab, .options_group.pricing').hide(); - jQuery('.options_group.grouping').val('').hide(); - jQuery('td.enable_variation, th.enable_variation').hide(); - } else if (select_val=='downloadable') { - jQuery('.stock_fields, .manage_stock_field, .tax_tab, .options_group.pricing').show(); - jQuery('.options_group.grouping').show(); - jQuery('td.enable_variation, th.enable_variation').hide(); - } else if (select_val=='virtual') { - jQuery('.stock_fields, .manage_stock_field, .tax_tab, .options_group.pricing').show(); - jQuery('.options_group.grouping').show(); - jQuery('td.enable_variation, th.enable_variation').hide(); - } - - $('body').trigger('woocommerce-product-type-change', select_val, $(this) ); - - }).change(); - - // STOCK OPTIONS - jQuery('input#manage_stock').change(function(){ - if (jQuery(this).is(':checked')) jQuery('div.stock_fields').show(); - else jQuery('div.stock_fields').hide(); - }).change(); - - - // DATE PICKER FIELDS - var dates = jQuery( "#sale_price_dates_from, #sale_price_dates_to" ).datepicker({ - defaultDate: "", - dateFormat: "yy-mm-dd", - numberOfMonths: 1, - showButtonPanel: true, - showOn: "button", - buttonImage: woocommerce_writepanel_params.calendar_image, - buttonImageOnly: true, - onSelect: function( selectedDate ) { - var option = this.id == "sale_price_dates_from" ? "minDate" : "maxDate", - instance = jQuery( this ).data( "datepicker" ), - date = jQuery.datepicker.parseDate( - instance.settings.dateFormat || - jQuery.datepicker._defaults.dateFormat, - selectedDate, instance.settings ); - dates.not( this ).datepicker( "option", option, date ); - } - }); - - - // ATTRIBUTE TABLES - - // Multiselect attributes - jQuery("#attributes_list select.multiselect").multiselect({ - noneSelectedText: woocommerce_writepanel_params.select_terms, - selectedList: 4 - }); - - // Initial order - var woocommerce_attributes_table_items = jQuery('#attributes_list').children('tr').get(); - woocommerce_attributes_table_items.sort(function(a, b) { - var compA = jQuery(a).attr('rel'); - var compB = jQuery(b).attr('rel'); - return (compA < compB) ? -1 : (compA > compB) ? 1 : 0; - }) - jQuery(woocommerce_attributes_table_items).each( function(idx, itm) { jQuery('#attributes_list').append(itm); } ); - - // Show - function show_attribute_table() { - jQuery('table.woocommerce_attributes, table.woocommerce_variable_attributes').each(function(){ - if (jQuery('tbody tr', this).size()==0) - jQuery(this).parent().hide(); - else - jQuery(this).parent().show(); - }); - } - show_attribute_table(); - - function row_indexes() { - jQuery('#attributes_list tr').each(function(index, el){ jQuery('.attribute_position', el).val( parseInt( jQuery(el).index('#attributes_list tr') ) ); }); - }; - - // Add rows - jQuery('button.add_attribute').click(function(){ - - var size = jQuery('table.woocommerce_attributes tbody tr').size(); - - var attribute_type = jQuery('select.attribute_taxonomy').val(); - - if (!attribute_type) { - - var product_type = jQuery('select#product-type').val(); - if (product_type!='variable') enable_variation = 'style="display:none;"'; else enable_variation = ''; - - // Add custom attribute row - jQuery('table.woocommerce_attributes tbody').append(''); - - } else { - - // Reveal taxonomy row - var thisrow = jQuery('table.woocommerce_attributes tbody tr.' + attribute_type); - jQuery('table.woocommerce_attributes tbody').append( jQuery(thisrow) ); - jQuery(thisrow).show(); - row_indexes(); - - } - - show_attribute_table(); - }); - - jQuery('button.hide_row').live('click', function(){ - var answer = confirm("Remove this attribute?") - if (answer){ - jQuery(this).parent().parent().find('select, input[type=text]').val(''); - jQuery(this).parent().parent().hide(); - show_attribute_table(); - } - return false; - }); - - jQuery('#attributes_list button.remove_row').live('click', function(){ - var answer = confirm("Remove this attribute?") - if (answer){ - jQuery(this).parent().parent().remove(); - show_attribute_table(); - row_indexes(); - } - return false; - }); - - // Attribute ordering - jQuery('table.woocommerce_attributes tbody').sortable({ - items:'tr', - cursor:'move', - axis:'y', - scrollSensitivity:40, - helper:function(e,ui){ - ui.children().each(function(){ - jQuery(this).width(jQuery(this).width()); - }); - return ui; - }, - start:function(event,ui){ - ui.item.css('background-color','#f6f6f6'); - }, - stop:function(event,ui){ - ui.item.removeAttr('style'); - row_indexes(); - } - }); - - - - // Cross sells/Up sells - jQuery('.multi_select_products button').live('click', function(){ - var wrapper = jQuery(this).parent().parent().parent().parent(); - - if (jQuery(this).parent().parent().is('.multi_select_products_target')) { - jQuery(this).parent().remove(); - } else { - var target = jQuery('.multi_select_products_target', jQuery(wrapper)); - - var exists = jQuery('li[rel=' + jQuery(this).parent().attr('rel') + ']', target); - - if (jQuery(exists).size()>0) return false; - - jQuery(this).parent().clone().appendTo(target).find('button').html('X').parent().find('input').val( jQuery(this).parent().attr('rel') ); - } - }); - - jQuery('.multi_select_products #product_search').bind('keyup click', function(){ - - jQuery('.multi_select_products_source li:not(.product_search)').remove(); - - var search = encodeURI( jQuery(this).val() ); - var input = this; - var name = jQuery(this).attr('rel'); - - if (search.length<3) return; - - var data = { - name: name, - search: search, - action: 'woocommerce_upsell_crosssell_search_products', - security: woocommerce_writepanel_params.upsell_crosssell_search_products_nonce - }; - - jQuery.post( woocommerce_writepanel_params.ajax_url, data, function( response ) { - - jQuery('.multi_select_products_source li:not(.product_search)').remove(); - jQuery(input).parent().parent().append( response ); - - } ); - - }); - -}); \ No newline at end of file +jQuery(function(d){jQuery("form#post").bind("keypress",function(g){if(g.keyCode==34||g.keyCode==13){return false}});jQuery("ul.tabs").show();jQuery("div.panel-wrap").each(function(){jQuery("div.panel:not(div.panel:first)",this).hide()});jQuery("ul.tabs a").click(function(){var g=jQuery(this).closest("div.panel-wrap");jQuery("ul.tabs li",g).removeClass("active");jQuery(this).parent().addClass("active");jQuery("div.panel",g).hide();jQuery(jQuery(this).attr("href")).show();return false});jQuery("#order_items_list button.remove_row").live("click",function(){var g=confirm(woocommerce_writepanel_params.remove_item_notice);if(g){jQuery(this).closest("tr.item").hide();jQuery("input",jQuery(this).closest("tr.item")).val("")}return false});jQuery("button.calc_totals").live("click",function(){var p=confirm(woocommerce_writepanel_params.cart_total);if(p){var h=jQuery("#order_items_list tr.item").size();var n=0;var o=jQuery("input#order_discount").val();var g=jQuery("input#order_shipping").val();var k=parseFloat(jQuery("input#order_shipping_tax").val());var l=0;var j=0;var m=0;if(!o){o=0}if(!g){g=0}if(!k){k=0}if(h>0){for(i=0;i0){taxRate=itemTax/100;itemTaxAmount=((itemCost*taxRate)*100);itemTaxAmount=itemTaxAmount.toFixed(2);totalItemTax=Math.round(itemTaxAmount)/100;totalItemTax=totalItemTax*itemQty}j=j+totalItemCost;l=l+totalItemTax}}n=j;m=parseFloat(n)+parseFloat(l)-parseFloat(o)+parseFloat(g)+parseFloat(k);if(m<0){m=0}jQuery("input#order_subtotal").val(n.toFixed(2));jQuery("input#order_tax").val(l.toFixed(2));jQuery("input#order_shipping_tax").val(k.toFixed(2));jQuery("input#order_total").val(m.toFixed(2))}return false});jQuery("button.add_shop_order_item").click(function(){var j=jQuery("select.add_item_id").val();if(j){jQuery("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_writepanel_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:0.6}});var g=jQuery("table.woocommerce_order_items tbody tr.item").size();var h={action:"woocommerce_add_order_item",item_to_add:jQuery("select.add_item_id").val(),index:g,security:woocommerce_writepanel_params.add_order_item_nonce};jQuery.post(woocommerce_writepanel_params.ajax_url,h,function(k){jQuery("table.woocommerce_order_items tbody#order_items_list").append(k);jQuery("table.woocommerce_order_items").unblock();jQuery("select.add_item_id").css("border-color","").val("");jQuery(".tips").easyTooltip()})}else{jQuery("select.add_item_id").css("border-color","red")}});jQuery("button.add_meta").live("click",function(){var g=jQuery(this).closest("tr.item").attr("rel");jQuery(this).closest("table.meta").find(".meta_items").append('');return false});jQuery("button.remove_meta").live("click",function(){var g=confirm("Remove this meta key?");if(g){jQuery(this).closest("tr").remove()}return false});jQuery("button.billing-same-as-shipping").live("click",function(){var g=confirm(woocommerce_writepanel_params.copy_billing);if(g){jQuery("input#shipping_first_name").val(jQuery("input#billing_first_name").val());jQuery("input#shipping_last_name").val(jQuery("input#billing_last_name").val());jQuery("input#shipping_company").val(jQuery("input#billing_company").val());jQuery("input#shipping_address_1").val(jQuery("input#billing_address_1").val());jQuery("input#shipping_address_2").val(jQuery("input#billing_address_2").val());jQuery("input#shipping_city").val(jQuery("input#billing_city").val());jQuery("input#shipping_postcode").val(jQuery("input#billing_postcode").val());jQuery("input#shipping_country").val(jQuery("input#billing_country").val());jQuery("input#shipping_state").val(jQuery("input#billing_state").val())}return false});d("select#product-type").change(function(){var g=jQuery(this).val();d("#woocommerce-product-type-options .inside > div").hide();d("#"+g+"_product_options").show();if(g=="variable"){jQuery(".stock_fields, .manage_stock_field, .tax_tab, .options_group.pricing").show();jQuery(".options_group.grouping").val("").hide();jQuery("td.enable_variation, th.enable_variation").show()}else{if(g=="simple"){jQuery(".stock_fields, .manage_stock_field, .tax_tab, .options_group.pricing").show();jQuery(".options_group.grouping").show();jQuery("td.enable_variation, th.enable_variation").hide()}else{if(g=="grouped"){jQuery(".stock_fields, .manage_stock_field, .tax_tab, .options_group.pricing").hide();jQuery(".options_group.grouping").val("").hide();jQuery("td.enable_variation, th.enable_variation").hide()}else{if(g=="downloadable"){jQuery(".stock_fields, .manage_stock_field, .tax_tab, .options_group.pricing").show();jQuery(".options_group.grouping").show();jQuery("td.enable_variation, th.enable_variation").hide()}else{if(g=="virtual"){jQuery(".stock_fields, .manage_stock_field, .tax_tab, .options_group.pricing").show();jQuery(".options_group.grouping").show();jQuery("td.enable_variation, th.enable_variation").hide()}}}}}d("body").trigger("woocommerce-product-type-change",g,d(this))}).change();jQuery("input#manage_stock").change(function(){if(jQuery(this).is(":checked")){jQuery("div.stock_fields").show()}else{jQuery("div.stock_fields").hide()}}).change();var e=jQuery("#sale_price_dates_from, #sale_price_dates_to").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:true,showOn:"button",buttonImage:woocommerce_writepanel_params.calendar_image,buttonImageOnly:true,onSelect:function(j){var k=this.id=="sale_price_dates_from"?"minDate":"maxDate",g=jQuery(this).data("datepicker"),h=jQuery.datepicker.parseDate(g.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,j,g.settings);e.not(this).datepicker("option",k,h)}});jQuery("#attributes_list select.multiselect").multiselect({noneSelectedText:woocommerce_writepanel_params.select_terms,selectedList:4});var c=jQuery("#attributes_list").children("tr").get();c.sort(function(h,g){var k=jQuery(h).attr("rel");var j=jQuery(g).attr("rel");return(kj)?1:0});jQuery(c).each(function(g,h){jQuery("#attributes_list").append(h)});function a(){jQuery("table.woocommerce_attributes, table.woocommerce_variable_attributes").each(function(){if(jQuery("tbody tr",this).size()==0){jQuery(this).parent().hide()}else{jQuery(this).parent().show()}})}a();function b(){jQuery("#attributes_list tr").each(function(g,h){jQuery(".attribute_position",h).val(parseInt(jQuery(h).index("#attributes_list tr")))})}jQuery("button.add_attribute").click(function(){var h=jQuery("table.woocommerce_attributes tbody tr").size();var j=jQuery("select.attribute_taxonomy").val();if(!j){var k=jQuery("select#product-type").val();if(k!="variable"){enable_variation='style="display:none;"'}else{enable_variation=""}jQuery("table.woocommerce_attributes tbody").append('')}else{var g=jQuery("table.woocommerce_attributes tbody tr."+j);jQuery("table.woocommerce_attributes tbody").append(jQuery(g));jQuery(g).show();b()}a()});jQuery("button.hide_row").live("click",function(){var g=confirm("Remove this attribute?");if(g){jQuery(this).parent().parent().find("select, input[type=text]").val("");jQuery(this).parent().parent().hide();a()}return false});jQuery("#attributes_list button.remove_row").live("click",function(){var g=confirm("Remove this attribute?");if(g){jQuery(this).parent().parent().remove();a();b()}return false});jQuery("table.woocommerce_attributes tbody").sortable({items:"tr",cursor:"move",axis:"y",scrollSensitivity:40,helper:function(h,g){g.children().each(function(){jQuery(this).width(jQuery(this).width())});return g},start:function(g,h){h.item.css("background-color","#f6f6f6")},stop:function(g,h){h.item.removeAttr("style");b()}});jQuery(".multi_select_products button").live("click",function(){var j=jQuery(this).parent().parent().parent().parent();if(jQuery(this).parent().parent().is(".multi_select_products_target")){jQuery(this).parent().remove()}else{var h=jQuery(".multi_select_products_target",jQuery(j));var g=jQuery("li[rel="+jQuery(this).parent().attr("rel")+"]",h);if(jQuery(g).size()>0){return false}jQuery(this).parent().clone().appendTo(h).find("button").html("X").parent().find("input").val(jQuery(this).parent().attr("rel"))}});var f;jQuery(".multi_select_products #product_search").bind("keyup click",function(){jQuery(".multi_select_products_source").addClass("loading");jQuery(".multi_select_products_source li:not(.product_search)").remove();if(f){f.abort()}var j=jQuery(this).val();var g=this;var h=jQuery(this).attr("rel");if(j.length<3){jQuery(".multi_select_products_source").removeClass("loading");return}var k={name:h,search:encodeURI(j),action:"woocommerce_upsell_crosssell_search_products",security:woocommerce_writepanel_params.upsell_crosssell_search_products_nonce};f=jQuery.ajax({url:woocommerce_writepanel_params.ajax_url,data:k,type:"POST",success:function(l){jQuery(".multi_select_products_source").removeClass("loading");jQuery(".multi_select_products_source li:not(.product_search)").remove();jQuery(g).parent().parent().append(l)}})})}); \ No newline at end of file diff --git a/woocommerce_actions.php b/woocommerce_actions.php index efd2cc39382..1e6d40955a4 100644 --- a/woocommerce_actions.php +++ b/woocommerce_actions.php @@ -255,7 +255,7 @@ function woocommerce_upsell_crosssell_search_products() { $args = array( 'post_type' => 'product', 'post_status' => 'publish', - 'posts_per_page' => 20, + 'posts_per_page' => 15, 'post__in' => array(0, $search) ); @@ -264,7 +264,7 @@ function woocommerce_upsell_crosssell_search_products() { $args = array( 'post_type' => 'product', 'post_status' => 'publish', - 'posts_per_page' => 20, + 'posts_per_page' => 15, 's' => $search );