diff --git a/admin/post-types/shop_order.php b/admin/post-types/shop_order.php index 92a31db01bc..f9d148bde01 100644 --- a/admin/post-types/shop_order.php +++ b/admin/post-types/shop_order.php @@ -47,8 +47,6 @@ function woocommerce_custom_order_columns($column) { break; case "order_title" : - echo ''.sprintf( __('Order #%s', 'woothemes'), $post->ID ).' '; - if ($order->user_id) $user_info = get_userdata($order->user_id); if (isset($user_info) && $user_info) : @@ -64,7 +62,7 @@ function woocommerce_custom_order_columns($column) { $user = __('Guest', 'woothemes'); endif; - echo '' . __('Customer:', 'woothemes') . ' ' . $user . ''; + echo ''.sprintf( __('Order #%s', 'woothemes'), $post->ID ).' ' . __('made by', 'woothemes') . ' ' . $user; if ($order->billing_email) : echo ''.__('Email:', 'woothemes') . ' ' . ''.esc_html( $order->billing_email ).''; @@ -75,10 +73,8 @@ function woocommerce_custom_order_columns($column) { break; case "billing_address" : - echo ''.esc_html( $order->billing_first_name . ' ' . $order->billing_last_name ); - if ($order->billing_company) echo ', '.esc_html( $order->billing_company ); - echo '
'; - echo ''.esc_html( $order->formatted_billing_address ).''; + + echo ''. preg_replace('##i', ', ', $order->formatted_billing_address) .''; if ($order->payment_method_title) : echo '' . __('Paid via', 'woothemes') . ' ' . esc_html( $order->payment_method_title ) . ''; @@ -87,10 +83,8 @@ function woocommerce_custom_order_columns($column) { break; case "shipping_address" : if ($order->formatted_shipping_address) : - echo ''.esc_html( $order->shipping_first_name . ' ' . $order->shipping_last_name ); - if ($order->shipping_company) : echo ', '.esc_html( $order->shipping_company ); endif; - echo '
'; - echo ''.esc_html( $order->formatted_shipping_address ).''; + + echo ''. preg_replace('##i', ', ', $order->formatted_shipping_address) .''; else : echo '–'; endif; diff --git a/admin/woocommerce-admin-init.php b/admin/woocommerce-admin-init.php index 1743f327123..0db4060ffa3 100644 --- a/admin/woocommerce-admin-init.php +++ b/admin/woocommerce-admin-init.php @@ -106,7 +106,7 @@ function woocommerce_admin_scripts() { wp_enqueue_script( 'woocommerce_admin' ); wp_enqueue_script('farbtastic'); - wp_enqueue_script('chosen'); + wp_enqueue_script( 'chosen' ); wp_enqueue_script('jquery-ui-sortable'); endif; @@ -126,7 +126,7 @@ function woocommerce_admin_scripts() { wp_enqueue_script( 'jquery-ui-datepicker' ); wp_enqueue_script( 'media-upload' ); wp_enqueue_script( 'thickbox' ); - wp_enqueue_script('chosen'); + wp_enqueue_script( 'chosen' ); $woocommerce_witepanel_params = array( 'remove_item_notice' => __("Remove this item? If you have previously reduced this item's stock, or this order was submitted by a customer, will need to manually restore the item's stock.", 'woothemes'), diff --git a/assets/js/chosen.jquery.js b/assets/js/chosen.jquery.js index 72c0545c4d3..9f33e8a9b85 100755 --- a/assets/js/chosen.jquery.js +++ b/assets/js/chosen.jquery.js @@ -903,7 +903,7 @@ jQuery(function(){ // Frontend Chosen selects jQuery("select.country_select, select.state_select").chosen(); - $('body').bind('country_to_state_changed', function(){ + jQuery('body').bind('country_to_state_changed', function(){ jQuery("select.state_select").chosen().trigger("liszt:updated"); }); diff --git a/assets/js/chosen.jquery.min.js b/assets/js/chosen.jquery.min.js index 118e0dc569f..bbe1733fcd2 100755 --- a/assets/js/chosen.jquery.min.js +++ b/assets/js/chosen.jquery.min.js @@ -1 +1 @@ -(function(){var a;a=(function(){function b(){this.options_index=0;this.parsed=[]}b.prototype.add_node=function(c){if(c.nodeName==="OPTGROUP"){return this.add_group(c)}else{return this.add_option(c)}};b.prototype.add_group=function(i){var h,e,g,d,f,c;h=this.parsed.length;this.parsed.push({array_index:h,group:true,label:i.label,children:0,disabled:i.disabled});f=i.childNodes;c=[];for(g=0,d=f.length;g"+g.html+""}else{return""}};d.prototype.results_update_field=function(){this.result_clear_highlight();this.result_single_selected=null;return this.results_build()};d.prototype.results_toggle=function(){if(this.results_showing){return this.results_hide()}else{return this.results_show()}};d.prototype.results_search=function(e){if(this.results_showing){return this.winnow_results()}else{return this.results_show()}};d.prototype.keyup_checker=function(e){var g,f;g=(f=e.which)!=null?f:e.keyCode;this.search_field_scale();switch(g){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0){return this.keydown_backstroke()}else{if(!this.pending_backstroke){this.result_clear_highlight();return this.results_search()}}break;case 13:e.preventDefault();if(this.results_showing){return this.result_select(e)}break;case 27:if(this.results_showing){return this.results_hide()}break;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}};d.prototype.generate_field_id=function(){var e;e=this.generate_random_id();this.form_field.id=e;return e};d.prototype.generate_random_char=function(){var g,f,e;g="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";e=Math.floor(Math.random()*g.length);return f=g.substring(e,e+1)};return d})();a.AbstractChosen=b}).call(this);(function(){var f,g,e,a;var c=Object.prototype.hasOwnProperty,d=function(k,i){for(var h in i){if(c.call(i,h)){k[h]=i[h]}}function j(){this.constructor=k}j.prototype=i.prototype;k.prototype=new j;k.__super__=i.prototype;return k},b=function(h,i){return function(){return h.apply(i,arguments)}};a=this;f=jQuery;f.fn.extend({chosen:function(h){if(f.browser.msie&&(f.browser.version==="6.0"||f.browser.version==="7.0")){return this}return f(this).each(function(i){if(!(f(this)).hasClass("chzn-done")){return new g(this,h)}})}});g=(function(){d(h,AbstractChosen);function h(){h.__super__.constructor.apply(this,arguments)}h.prototype.setup=function(){this.form_field_jq=f(this.form_field);return this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")};h.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")};h.prototype.set_up_html=function(){var l,k,j,i;this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id();this.container_id+="_chzn";this.f_width=this.form_field_jq.outerWidth();this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default;l=f("
",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"});if(this.is_multiple){l.html('
    ')}else{l.html(''+this.default_text+'
      ')}this.form_field_jq.hide().after(l);this.container=f("#"+this.container_id);this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single"));this.dropdown=this.container.find("div.chzn-drop").first();k=this.container.height();j=this.f_width-e(this.dropdown);this.dropdown.css({width:j+"px",top:k+"px"});this.search_field=this.container.find("input").first();this.search_results=this.container.find("ul.chzn-results").first();this.search_field_scale();this.search_no_results=this.container.find("li.no-results").first();if(this.is_multiple){this.search_choices=this.container.find("ul.chzn-choices").first();this.search_container=this.container.find("li.search-field").first()}else{this.search_container=this.container.find("div.chzn-search").first();this.selected_item=this.container.find(".chzn-single").first();i=j-e(this.search_container)-e(this.search_field);this.search_field.css({width:i+"px"})}this.results_build();this.set_tab_index();return this.form_field_jq.trigger("liszt:ready",{chosen:this})};h.prototype.register_observers=function(){this.container.mousedown(b(function(i){return this.container_mousedown(i)},this));this.container.mouseup(b(function(i){return this.container_mouseup(i)},this));this.container.mouseenter(b(function(i){return this.mouse_enter(i)},this));this.container.mouseleave(b(function(i){return this.mouse_leave(i)},this));this.search_results.mouseup(b(function(i){return this.search_results_mouseup(i)},this));this.search_results.mouseover(b(function(i){return this.search_results_mouseover(i)},this));this.search_results.mouseout(b(function(i){return this.search_results_mouseout(i)},this));this.form_field_jq.bind("liszt:updated",b(function(i){return this.results_update_field(i)},this));this.search_field.blur(b(function(i){return this.input_blur(i)},this));this.search_field.keyup(b(function(i){return this.keyup_checker(i)},this));this.search_field.keydown(b(function(i){return this.keydown_checker(i)},this));if(this.is_multiple){this.search_choices.click(b(function(i){return this.choices_click(i)},this));return this.search_field.focus(b(function(i){return this.input_focus(i)},this))}};h.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled){this.container.addClass("chzn-disabled");this.search_field[0].disabled=true;if(!this.is_multiple){this.selected_item.unbind("focus",this.activate_action)}return this.close_field()}else{this.container.removeClass("chzn-disabled");this.search_field[0].disabled=false;if(!this.is_multiple){return this.selected_item.bind("focus",this.activate_action)}}};h.prototype.container_mousedown=function(i){var j;if(!this.is_disabled){j=i!=null?(f(i.target)).hasClass("search-choice-close"):false;if(i&&i.type==="mousedown"){i.stopPropagation()}if(!this.pending_destroy_click&&!j){if(!this.active_field){if(this.is_multiple){this.search_field.val("")}f(document).click(this.click_test_action);this.results_show()}else{if(!this.is_multiple&&i&&((f(i.target)[0]===this.selected_item[0])||f(i.target).parents("a.chzn-single").length)){i.preventDefault();this.results_toggle()}}return this.activate_field()}else{return this.pending_destroy_click=false}}};h.prototype.container_mouseup=function(i){if(i.target.nodeName==="ABBR"){return this.results_reset(i)}};h.prototype.blur_test=function(i){if(!this.active_field&&this.container.hasClass("chzn-container-active")){return this.close_field()}};h.prototype.close_field=function(){f(document).unbind("click",this.click_test_action);if(!this.is_multiple){this.selected_item.attr("tabindex",this.search_field.attr("tabindex"));this.search_field.attr("tabindex",-1)}this.active_field=false;this.results_hide();this.container.removeClass("chzn-container-active");this.winnow_results_clear();this.clear_backstroke();this.show_search_field_default();return this.search_field_scale()};h.prototype.activate_field=function(){if(!this.is_multiple&&!this.active_field){this.search_field.attr("tabindex",this.selected_item.attr("tabindex"));this.selected_item.attr("tabindex",-1)}this.container.addClass("chzn-container-active");this.active_field=true;this.search_field.val(this.search_field.val());return this.search_field.focus()};h.prototype.test_active_click=function(i){if(f(i.target).parents("#"+this.container_id).length){return this.active_field=true}else{return this.close_field()}};h.prototype.results_build=function(){var j,m,l,i,k;this.parsing=true;this.results_data=a.SelectParser.select_to_array(this.form_field);if(this.is_multiple&&this.choices>0){this.search_choices.find("li.search-choice").remove();this.choices=0}else{if(!this.is_multiple){this.selected_item.find("span").text(this.default_text);if(this.form_field.options.length<=this.disable_search_threshold){this.container.addClass("chzn-container-single-nosearch")}else{this.container.removeClass("chzn-container-single-nosearch")}}}j="";k=this.results_data;for(l=0,i=k.length;l'+f("
      ").text(i.label).html()+""}else{return""}};h.prototype.result_do_highlight=function(j){var n,m,k,l,i;if(j.length){this.result_clear_highlight();this.result_highlight=j;this.result_highlight.addClass("highlighted");k=parseInt(this.search_results.css("maxHeight"),10);i=this.search_results.scrollTop();l=k+i;m=this.result_highlight.position().top+this.search_results.scrollTop();n=m+this.result_highlight.outerHeight();if(n>=l){return this.search_results.scrollTop((n-k)>0?n-k:0)}else{if(m'+k.html+'');j=f("#"+i).find("a").first();return j.click(b(function(l){return this.choice_destroy_link_click(l)},this))};h.prototype.choice_destroy_link_click=function(i){i.preventDefault();if(!this.is_disabled){this.pending_destroy_click=true;return this.choice_destroy(f(i.target))}else{return i.stopPropagation}};h.prototype.choice_destroy=function(i){this.choices-=1;this.show_search_field_default();if(this.is_multiple&&this.choices>0&&this.search_field.val().length<1){this.results_hide()}this.result_deselect(i.attr("rel"));return i.parents("li").first().remove()};h.prototype.results_reset=function(i){this.form_field.options[0].selected=true;this.selected_item.find("span").text(this.default_text);this.show_search_field_default();f(i.target).remove();this.form_field_jq.trigger("change");if(this.active_field){return this.results_hide()}};h.prototype.result_select=function(j){var m,l,k,i;if(this.result_highlight){m=this.result_highlight;l=m.attr("id");this.result_clear_highlight();if(this.is_multiple){this.result_deactivate(m)}else{this.search_results.find(".result-selected").removeClass("result-selected");this.result_single_selected=m}m.addClass("result-selected");i=l.substr(l.lastIndexOf("_")+1);k=this.results_data[i];k.selected=true;this.form_field.options[k.options_index].selected=true;if(this.is_multiple){this.choice_build(k)}else{this.selected_item.find("span").first().text(k.text);if(this.allow_single_deselect){this.single_deselect_control_build()}}if(!(j.metaKey&&this.is_multiple)){this.results_hide()}this.search_field.val("");this.form_field_jq.trigger("change");return this.search_field_scale()}};h.prototype.result_activate=function(i){return i.addClass("active-result")};h.prototype.result_deactivate=function(i){return i.removeClass("active-result")};h.prototype.result_deselect=function(k){var i,j;j=this.results_data[k];j.selected=false;this.form_field.options[j.options_index].selected=false;i=f("#"+this.container_id+"_o_"+k);i.removeClass("result-selected").addClass("active-result").show();this.result_clear_highlight();this.winnow_results();this.form_field_jq.trigger("change");return this.search_field_scale()};h.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1){return this.selected_item.find("span").first().after('')}};h.prototype.winnow_results=function(){var x,q,k,n,u,y,s,p,w,r,v,j,m,l,t,i,o;this.no_results_clear();p=0;w=this.search_field.val()===this.default_text?"":f("
      ").text(f.trim(this.search_field.val())).html();u=new RegExp("^"+w.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i");j=new RegExp(w.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i");o=this.results_data;for(m=0,t=o.length;m=0||q.html.indexOf("[")===0){n=q.html.replace(/\[|\]/g,"").split(" ");if(n.length){for(l=0,i=n.length;l"+q.html.substr(r+w.length);v=v.substr(0,r)+""+v.substr(r)}else{v=q.html}y.html(v);this.result_activate(y);if(q.group_array_index!=null){f("#"+this.results_data[q.group_array_index].dom_id).css("display","list-item")}}else{if(this.result_highlight&&s===this.result_highlight.attr("id")){this.result_clear_highlight()}this.result_deactivate(y)}}}}}if(p<1&&w.length){return this.no_results(w)}else{return this.winnow_results_set_highlight()}};h.prototype.winnow_results_clear=function(){var i,l,m,k,j;this.search_field.val("");l=this.search_results.find("li");j=[];for(m=0,k=l.length;m'+this.results_none_found+' ""');j.find("span").first().html(i);return this.search_results.append(j)};h.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()};h.prototype.keydown_arrow=function(){var j,i;if(!this.result_highlight){j=this.search_results.find("li.active-result").first();if(j){this.result_do_highlight(f(j))}}else{if(this.results_showing){i=this.result_highlight.nextAll("li.active-result").first();if(i){this.result_do_highlight(i)}}}if(!this.results_showing){return this.results_show()}};h.prototype.keyup_arrow=function(){var i;if(!this.results_showing&&!this.is_multiple){return this.results_show()}else{if(this.result_highlight){i=this.result_highlight.prevAll("li.active-result");if(i.length){return this.result_do_highlight(i.first())}else{if(this.choices>0){this.results_hide()}return this.result_clear_highlight()}}}};h.prototype.keydown_backstroke=function(){if(this.pending_backstroke){this.choice_destroy(this.pending_backstroke.find("a").first());return this.clear_backstroke()}else{this.pending_backstroke=this.search_container.siblings("li.search-choice").last();return this.pending_backstroke.addClass("search-choice-focus")}};h.prototype.clear_backstroke=function(){if(this.pending_backstroke){this.pending_backstroke.removeClass("search-choice-focus")}return this.pending_backstroke=null};h.prototype.keydown_checker=function(i){var k,j;k=(j=i.which)!=null?j:i.keyCode;this.search_field_scale();if(k!==8&&this.pending_backstroke){this.clear_backstroke()}switch(k){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:if(this.results_showing&&!this.is_multiple){this.result_select(i)}this.mouse_on_container=false;break;case 13:i.preventDefault();break;case 38:i.preventDefault();this.keyup_arrow();break;case 40:this.keydown_arrow();break}};h.prototype.search_field_scale=function(){var q,i,l,j,o,p,n,k,m;if(this.is_multiple){l=0;n=0;o="position:absolute; left: -1000px; top: -1000px; display:none;";p=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(k=0,m=p.length;k",{style:o});i.text(this.search_field.val());f("body").append(i);n=i.width()+25;i.remove();if(n>this.f_width-10){n=this.f_width-10}this.search_field.css({width:n+"px"});q=this.container.height();return this.dropdown.css({top:q+"px"})}};h.prototype.generate_random_id=function(){var i;i="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(f("#"+i).length>0){i+=this.generate_random_char()}return i};return h})();e=function(h){var i;return i=h.outerWidth()-h.width()};a.get_side_border_padding=e}).call(this);jQuery(function(){jQuery("select.country_select, select.state_select").chosen();$("body").bind("country_to_state_changed",function(){jQuery("select.state_select").chosen().trigger("liszt:updated")})}); \ No newline at end of file +(function(){var a;a=(function(){function b(){this.options_index=0;this.parsed=[]}b.prototype.add_node=function(c){if(c.nodeName==="OPTGROUP"){return this.add_group(c)}else{return this.add_option(c)}};b.prototype.add_group=function(i){var h,e,g,d,f,c;h=this.parsed.length;this.parsed.push({array_index:h,group:true,label:i.label,children:0,disabled:i.disabled});f=i.childNodes;c=[];for(g=0,d=f.length;g"+g.html+""}else{return""}};d.prototype.results_update_field=function(){this.result_clear_highlight();this.result_single_selected=null;return this.results_build()};d.prototype.results_toggle=function(){if(this.results_showing){return this.results_hide()}else{return this.results_show()}};d.prototype.results_search=function(e){if(this.results_showing){return this.winnow_results()}else{return this.results_show()}};d.prototype.keyup_checker=function(e){var g,f;g=(f=e.which)!=null?f:e.keyCode;this.search_field_scale();switch(g){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0){return this.keydown_backstroke()}else{if(!this.pending_backstroke){this.result_clear_highlight();return this.results_search()}}break;case 13:e.preventDefault();if(this.results_showing){return this.result_select(e)}break;case 27:if(this.results_showing){return this.results_hide()}break;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}};d.prototype.generate_field_id=function(){var e;e=this.generate_random_id();this.form_field.id=e;return e};d.prototype.generate_random_char=function(){var g,f,e;g="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";e=Math.floor(Math.random()*g.length);return f=g.substring(e,e+1)};return d})();a.AbstractChosen=b}).call(this);(function(){var f,g,e,a;var c=Object.prototype.hasOwnProperty,d=function(k,i){for(var h in i){if(c.call(i,h)){k[h]=i[h]}}function j(){this.constructor=k}j.prototype=i.prototype;k.prototype=new j;k.__super__=i.prototype;return k},b=function(h,i){return function(){return h.apply(i,arguments)}};a=this;f=jQuery;f.fn.extend({chosen:function(h){if(f.browser.msie&&(f.browser.version==="6.0"||f.browser.version==="7.0")){return this}return f(this).each(function(i){if(!(f(this)).hasClass("chzn-done")){return new g(this,h)}})}});g=(function(){d(h,AbstractChosen);function h(){h.__super__.constructor.apply(this,arguments)}h.prototype.setup=function(){this.form_field_jq=f(this.form_field);return this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")};h.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")};h.prototype.set_up_html=function(){var l,k,j,i;this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id();this.container_id+="_chzn";this.f_width=this.form_field_jq.outerWidth();this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default;l=f("
      ",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"});if(this.is_multiple){l.html('
        ')}else{l.html(''+this.default_text+'
          ')}this.form_field_jq.hide().after(l);this.container=f("#"+this.container_id);this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single"));this.dropdown=this.container.find("div.chzn-drop").first();k=this.container.height();j=this.f_width-e(this.dropdown);this.dropdown.css({width:j+"px",top:k+"px"});this.search_field=this.container.find("input").first();this.search_results=this.container.find("ul.chzn-results").first();this.search_field_scale();this.search_no_results=this.container.find("li.no-results").first();if(this.is_multiple){this.search_choices=this.container.find("ul.chzn-choices").first();this.search_container=this.container.find("li.search-field").first()}else{this.search_container=this.container.find("div.chzn-search").first();this.selected_item=this.container.find(".chzn-single").first();i=j-e(this.search_container)-e(this.search_field);this.search_field.css({width:i+"px"})}this.results_build();this.set_tab_index();return this.form_field_jq.trigger("liszt:ready",{chosen:this})};h.prototype.register_observers=function(){this.container.mousedown(b(function(i){return this.container_mousedown(i)},this));this.container.mouseup(b(function(i){return this.container_mouseup(i)},this));this.container.mouseenter(b(function(i){return this.mouse_enter(i)},this));this.container.mouseleave(b(function(i){return this.mouse_leave(i)},this));this.search_results.mouseup(b(function(i){return this.search_results_mouseup(i)},this));this.search_results.mouseover(b(function(i){return this.search_results_mouseover(i)},this));this.search_results.mouseout(b(function(i){return this.search_results_mouseout(i)},this));this.form_field_jq.bind("liszt:updated",b(function(i){return this.results_update_field(i)},this));this.search_field.blur(b(function(i){return this.input_blur(i)},this));this.search_field.keyup(b(function(i){return this.keyup_checker(i)},this));this.search_field.keydown(b(function(i){return this.keydown_checker(i)},this));if(this.is_multiple){this.search_choices.click(b(function(i){return this.choices_click(i)},this));return this.search_field.focus(b(function(i){return this.input_focus(i)},this))}};h.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled){this.container.addClass("chzn-disabled");this.search_field[0].disabled=true;if(!this.is_multiple){this.selected_item.unbind("focus",this.activate_action)}return this.close_field()}else{this.container.removeClass("chzn-disabled");this.search_field[0].disabled=false;if(!this.is_multiple){return this.selected_item.bind("focus",this.activate_action)}}};h.prototype.container_mousedown=function(i){var j;if(!this.is_disabled){j=i!=null?(f(i.target)).hasClass("search-choice-close"):false;if(i&&i.type==="mousedown"){i.stopPropagation()}if(!this.pending_destroy_click&&!j){if(!this.active_field){if(this.is_multiple){this.search_field.val("")}f(document).click(this.click_test_action);this.results_show()}else{if(!this.is_multiple&&i&&((f(i.target)[0]===this.selected_item[0])||f(i.target).parents("a.chzn-single").length)){i.preventDefault();this.results_toggle()}}return this.activate_field()}else{return this.pending_destroy_click=false}}};h.prototype.container_mouseup=function(i){if(i.target.nodeName==="ABBR"){return this.results_reset(i)}};h.prototype.blur_test=function(i){if(!this.active_field&&this.container.hasClass("chzn-container-active")){return this.close_field()}};h.prototype.close_field=function(){f(document).unbind("click",this.click_test_action);if(!this.is_multiple){this.selected_item.attr("tabindex",this.search_field.attr("tabindex"));this.search_field.attr("tabindex",-1)}this.active_field=false;this.results_hide();this.container.removeClass("chzn-container-active");this.winnow_results_clear();this.clear_backstroke();this.show_search_field_default();return this.search_field_scale()};h.prototype.activate_field=function(){if(!this.is_multiple&&!this.active_field){this.search_field.attr("tabindex",this.selected_item.attr("tabindex"));this.selected_item.attr("tabindex",-1)}this.container.addClass("chzn-container-active");this.active_field=true;this.search_field.val(this.search_field.val());return this.search_field.focus()};h.prototype.test_active_click=function(i){if(f(i.target).parents("#"+this.container_id).length){return this.active_field=true}else{return this.close_field()}};h.prototype.results_build=function(){var j,m,l,i,k;this.parsing=true;this.results_data=a.SelectParser.select_to_array(this.form_field);if(this.is_multiple&&this.choices>0){this.search_choices.find("li.search-choice").remove();this.choices=0}else{if(!this.is_multiple){this.selected_item.find("span").text(this.default_text);if(this.form_field.options.length<=this.disable_search_threshold){this.container.addClass("chzn-container-single-nosearch")}else{this.container.removeClass("chzn-container-single-nosearch")}}}j="";k=this.results_data;for(l=0,i=k.length;l'+f("
          ").text(i.label).html()+""}else{return""}};h.prototype.result_do_highlight=function(j){var n,m,k,l,i;if(j.length){this.result_clear_highlight();this.result_highlight=j;this.result_highlight.addClass("highlighted");k=parseInt(this.search_results.css("maxHeight"),10);i=this.search_results.scrollTop();l=k+i;m=this.result_highlight.position().top+this.search_results.scrollTop();n=m+this.result_highlight.outerHeight();if(n>=l){return this.search_results.scrollTop((n-k)>0?n-k:0)}else{if(m'+k.html+'');j=f("#"+i).find("a").first();return j.click(b(function(l){return this.choice_destroy_link_click(l)},this))};h.prototype.choice_destroy_link_click=function(i){i.preventDefault();if(!this.is_disabled){this.pending_destroy_click=true;return this.choice_destroy(f(i.target))}else{return i.stopPropagation}};h.prototype.choice_destroy=function(i){this.choices-=1;this.show_search_field_default();if(this.is_multiple&&this.choices>0&&this.search_field.val().length<1){this.results_hide()}this.result_deselect(i.attr("rel"));return i.parents("li").first().remove()};h.prototype.results_reset=function(i){this.form_field.options[0].selected=true;this.selected_item.find("span").text(this.default_text);this.show_search_field_default();f(i.target).remove();this.form_field_jq.trigger("change");if(this.active_field){return this.results_hide()}};h.prototype.result_select=function(j){var m,l,k,i;if(this.result_highlight){m=this.result_highlight;l=m.attr("id");this.result_clear_highlight();if(this.is_multiple){this.result_deactivate(m)}else{this.search_results.find(".result-selected").removeClass("result-selected");this.result_single_selected=m}m.addClass("result-selected");i=l.substr(l.lastIndexOf("_")+1);k=this.results_data[i];k.selected=true;this.form_field.options[k.options_index].selected=true;if(this.is_multiple){this.choice_build(k)}else{this.selected_item.find("span").first().text(k.text);if(this.allow_single_deselect){this.single_deselect_control_build()}}if(!(j.metaKey&&this.is_multiple)){this.results_hide()}this.search_field.val("");this.form_field_jq.trigger("change");return this.search_field_scale()}};h.prototype.result_activate=function(i){return i.addClass("active-result")};h.prototype.result_deactivate=function(i){return i.removeClass("active-result")};h.prototype.result_deselect=function(k){var i,j;j=this.results_data[k];j.selected=false;this.form_field.options[j.options_index].selected=false;i=f("#"+this.container_id+"_o_"+k);i.removeClass("result-selected").addClass("active-result").show();this.result_clear_highlight();this.winnow_results();this.form_field_jq.trigger("change");return this.search_field_scale()};h.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1){return this.selected_item.find("span").first().after('')}};h.prototype.winnow_results=function(){var x,q,k,n,u,y,s,p,w,r,v,j,m,l,t,i,o;this.no_results_clear();p=0;w=this.search_field.val()===this.default_text?"":f("
          ").text(f.trim(this.search_field.val())).html();u=new RegExp("^"+w.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i");j=new RegExp(w.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i");o=this.results_data;for(m=0,t=o.length;m=0||q.html.indexOf("[")===0){n=q.html.replace(/\[|\]/g,"").split(" ");if(n.length){for(l=0,i=n.length;l"+q.html.substr(r+w.length);v=v.substr(0,r)+""+v.substr(r)}else{v=q.html}y.html(v);this.result_activate(y);if(q.group_array_index!=null){f("#"+this.results_data[q.group_array_index].dom_id).css("display","list-item")}}else{if(this.result_highlight&&s===this.result_highlight.attr("id")){this.result_clear_highlight()}this.result_deactivate(y)}}}}}if(p<1&&w.length){return this.no_results(w)}else{return this.winnow_results_set_highlight()}};h.prototype.winnow_results_clear=function(){var i,l,m,k,j;this.search_field.val("");l=this.search_results.find("li");j=[];for(m=0,k=l.length;m'+this.results_none_found+' ""');j.find("span").first().html(i);return this.search_results.append(j)};h.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()};h.prototype.keydown_arrow=function(){var j,i;if(!this.result_highlight){j=this.search_results.find("li.active-result").first();if(j){this.result_do_highlight(f(j))}}else{if(this.results_showing){i=this.result_highlight.nextAll("li.active-result").first();if(i){this.result_do_highlight(i)}}}if(!this.results_showing){return this.results_show()}};h.prototype.keyup_arrow=function(){var i;if(!this.results_showing&&!this.is_multiple){return this.results_show()}else{if(this.result_highlight){i=this.result_highlight.prevAll("li.active-result");if(i.length){return this.result_do_highlight(i.first())}else{if(this.choices>0){this.results_hide()}return this.result_clear_highlight()}}}};h.prototype.keydown_backstroke=function(){if(this.pending_backstroke){this.choice_destroy(this.pending_backstroke.find("a").first());return this.clear_backstroke()}else{this.pending_backstroke=this.search_container.siblings("li.search-choice").last();return this.pending_backstroke.addClass("search-choice-focus")}};h.prototype.clear_backstroke=function(){if(this.pending_backstroke){this.pending_backstroke.removeClass("search-choice-focus")}return this.pending_backstroke=null};h.prototype.keydown_checker=function(i){var k,j;k=(j=i.which)!=null?j:i.keyCode;this.search_field_scale();if(k!==8&&this.pending_backstroke){this.clear_backstroke()}switch(k){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:if(this.results_showing&&!this.is_multiple){this.result_select(i)}this.mouse_on_container=false;break;case 13:i.preventDefault();break;case 38:i.preventDefault();this.keyup_arrow();break;case 40:this.keydown_arrow();break}};h.prototype.search_field_scale=function(){var q,i,l,j,o,p,n,k,m;if(this.is_multiple){l=0;n=0;o="position:absolute; left: -1000px; top: -1000px; display:none;";p=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(k=0,m=p.length;k",{style:o});i.text(this.search_field.val());f("body").append(i);n=i.width()+25;i.remove();if(n>this.f_width-10){n=this.f_width-10}this.search_field.css({width:n+"px"});q=this.container.height();return this.dropdown.css({top:q+"px"})}};h.prototype.generate_random_id=function(){var i;i="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(f("#"+i).length>0){i+=this.generate_random_char()}return i};return h})();e=function(h){var i;return i=h.outerWidth()-h.width()};a.get_side_border_padding=e}).call(this);jQuery(function(){jQuery("select.country_select, select.state_select").chosen();jQuery("body").bind("country_to_state_changed",function(){jQuery("select.state_select").chosen().trigger("liszt:updated")})}); \ No newline at end of file diff --git a/classes/countries.class.php b/classes/countries.class.php index 8b17a87c755..a5b17c30770 100644 --- a/classes/countries.class.php +++ b/classes/countries.class.php @@ -614,13 +614,16 @@ class woocommerce_countries { extract( $args ); // Get all formats - $formats = $this->get_address_formats(); + $formats = $this->get_address_formats(); // Get format for the address' country - $format = ($country && isset($formats[$country])) ? $formats[$country] : $formats['default']; + $format = ($country && isset($formats[$country])) ? $formats[$country] : $formats['default']; // Handle full country name - $full_country = (isset($this->countries[$country])) ? $this->countries[$country] : $country; + $full_country = (isset($this->countries[$country])) ? $this->countries[$country] : $country; + + // Handle full state name + $full_state = ($country && $state && isset($this->states[$country][$state])) ? $this->states[$country][$state] : $state; // Substitute address parts into the string $search = array( @@ -654,7 +657,7 @@ class woocommerce_countries { $address_1, $address_2, $city, - $state, + $full_state, $postcode, $full_country, strtoupper($first_name), @@ -664,7 +667,7 @@ class woocommerce_countries { strtoupper($address_1), strtoupper($address_2), strtoupper($city), - strtoupper($state), + strtoupper($full_state), strtoupper($postcode), strtoupper($full_country), ); diff --git a/classes/order.class.php b/classes/order.class.php index 3be892e9ab1..7175225407e 100644 --- a/classes/order.class.php +++ b/classes/order.class.php @@ -106,40 +106,46 @@ class woocommerce_order { endforeach; // Formatted Addresses - $formatted_address = array(); + $address = array( + 'first_name' => $this->billing_first_name, + 'last_name' => $this->billing_last_name, + 'company' => $this->billing_company, + 'address_1' => $this->billing_address_1, + 'address_2' => $this->billing_address_2, + 'city' => $this->billing_city, + 'state' => $this->billing_state, + 'postcode' => $this->billing_postcode, + 'country' => $this->billing_country + ); + + $this->formatted_billing_address = $woocommerce->countries->get_formatted_address( $address ); - $country = ($this->billing_country && isset($woocommerce->countries->countries[$this->billing_country])) ? $woocommerce->countries->countries[$this->billing_country] : $this->billing_country; - - $state = ($this->billing_country && $this->billing_state && isset($woocommerce->countries->states[$this->billing_country][$this->billing_state])) ? $woocommerce->countries->states[$this->billing_country][$this->billing_state] : $this->billing_state; - - $address = array_map('trim', array( - $this->billing_address_1, - $this->billing_address_2, - $this->billing_city, - $state, - $this->billing_postcode, - $country - )); - foreach ($address as $part) if (!empty($part)) $formatted_address[] = $part; - $this->formatted_billing_address = implode(', ', $formatted_address); + unset($address['first_name']); + unset($address['last_name']); + unset($address['company']); + foreach ($address as $part) if (!empty($part)) $joined_address[] = $part; + $this->billing_address_only = implode(', ', $joined_address); if ($this->shipping_address_1) : - $formatted_address = array(); + $address = array( + 'first_name' => $this->shipping_first_name, + 'last_name' => $this->shipping_last_name, + 'company' => $this->shipping_company, + 'address_1' => $this->shipping_address_1, + 'address_2' => $this->shipping_address_2, + 'city' => $this->shipping_city, + 'state' => $this->shipping_state, + 'postcode' => $this->shipping_postcode, + 'country' => $this->shipping_country + ); + + $this->formatted_shipping_address = $woocommerce->countries->get_formatted_address( $address ); - $country = ($this->shipping_country && isset($woocommerce->countries->countries[$this->shipping_country])) ? $woocommerce->countries->countries[$this->shipping_country] : $this->shipping_country; - - $state = ($this->shipping_country && $this->shipping_state && isset($woocommerce->countries->states[$this->shipping_country][$this->shipping_state])) ? $woocommerce->countries->states[$this->shipping_country][$this->shipping_state] : $this->shipping_state; - - $address = array_map('trim', array( - $this->shipping_address_1, - $this->shipping_address_2, - $this->shipping_city, - $state, - $this->shipping_postcode, - $country - )); - foreach ($address as $part) if (!empty($part)) $formatted_address[] = $part; - $this->formatted_shipping_address = implode(', ', $formatted_address); + unset($address['first_name']); + unset($address['last_name']); + unset($address['company']); + foreach ($address as $part) if (!empty($part)) $joined_address[] = $part; + $this->shipping_address_only = implode(', ', $joined_address); endif; // Taxonomy data