/** * list_shipping_zones function. * * @access public * @return void */ function list_shipping_zones() { global $woocommerce; if (!class_exists('WC_Shipping_Zones_Table')) { require_once 'class-wc-shipping-zones-table.php'; } echo '<form method="post">'; $WC_Shipping_Zones_Table = new WC_Shipping_Zones_Table(); $WC_Shipping_Zones_Table->prepare_items(); $WC_Shipping_Zones_Table->display(); echo '</form>'; $woocommerce->add_inline_js("\n\t\t\t// Sorting\n\t\t\tjQuery('table.shippingzones tbody').sortable({\n\t\t\t\titems:'tr:not(:last-child)',\n\t\t\t\tcursor:'move',\n\t\t\t\taxis:'y',\n\t\t\t\thandle: 'td',\n\t\t\t\tscrollSensitivity:40,\n\t\t\t\thelper:function(e,ui){\n\t\t\t\t\tui.children().each(function(){\n\t\t\t\t\t\tjQuery(this).width(jQuery(this).width());\n\t\t\t\t\t});\n\t\t\t\t\tui.css('left', '0');\n\t\t\t\t\treturn ui;\n\t\t\t\t},\n\t\t\t\tstart:function(event,ui){\n\t\t\t\t\tui.item.css('background-color','#f6f6f6');\n\t\t\t\t},\n\t\t\t\tstop:function(event,ui){\n\t\t\t\t\tui.item.removeAttr('style');\n\t\t\t\t},\n\t\t\t\tupdate: function(event, ui) {\t\n\t\t\t\t\tjQuery('table.shippingzones tbody td').css('cursor','default');\n\t\t\t\t\tjQuery('table.shippingzones tbody').sortable('disable');\n\t\t\t\t\t\t\t\n\t\t\t\t\t// show spinner\n\t\t\t\t\tui.item.find('.check-column input').hide();\n\t\t\t\t\tui.item.find('.check-column').append('<img alt=\"processing\" src=\"images/wpspin_light.gif\" class=\"waiting\" style=\"margin-left: 6px;\" />');\n\t\t\t\t\t\n\t\t\t\t\t// Parent\n\t\t\t\t\tvar zone_ids = [];\n\t\t\t\t\t\n\t\t\t\t\tjQuery(this).closest('form').find('input.zone_id').each(function(){\n\t\t\t\t\t\tvar zone_id = jQuery(this).val();\n\t\t\t\t\t\tzone_ids.push(zone_id);\n\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t// go do the sorting stuff via ajax\n\t\t\t\t\tjQuery.post( ajaxurl, { action: 'woocommerce_zone_ordering', zone_ids: zone_ids }, function(response) {\n\t\t\t\t\t\tui.item.find('.check-column input').show();\n\t\t\t\t\t\tui.item.find('.check-column').find('img').remove();\n\t\t\t\t\t\tjQuery('table.shippingzones tbody td').css('cursor','move');\n\t\t\t\t\t\tjQuery('table.shippingzones tbody').sortable('enable');\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t// fix cell colors\n\t\t\t\t\tjQuery('table.shippingzones tbody tr').each(function(){\n\t\t\t\t\t\tvar i = jQuery('table.shippingzones tbody tr').index(this);\n\t\t\t\t\t\tif ( i%2 == 0 ) jQuery(this).addClass('alternate');\n\t\t\t\t\t\telse jQuery(this).removeClass('alternate');\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t"); }
/** * list_shipping_zones function. * * @access public * @return void */ public static function list_shipping_zones() { if (!class_exists('WC_Shipping_Zones_Table')) { require_once 'list-tables/class-wc-shipping-zones-table.php'; } echo '<form method="post">'; $WC_Shipping_Zones_Table = new WC_Shipping_Zones_Table(); $WC_Shipping_Zones_Table->prepare_items(); $WC_Shipping_Zones_Table->display(); echo '</form>'; }