diff --git a/admin/includes/cssmin.inc.php b/admin/includes/cssmin.inc.php index 9c4444d9e77..7bc14c5e350 100644 --- a/admin/includes/cssmin.inc.php +++ b/admin/includes/cssmin.inc.php @@ -1,4 +1,4 @@ - \ No newline at end of file diff --git a/admin/post-types/shop_order.php b/admin/post-types/shop_order.php index f3274edc48a..a03571b934d 100644 --- a/admin/post-types/shop_order.php +++ b/admin/post-types/shop_order.php @@ -77,7 +77,7 @@ function woocommerce_custom_order_columns($column) { $user = __('Guest', 'woocommerce'); endif; - echo ''.sprintf( __('Order #%s', 'woocommerce'), $post->ID ).' ' . __('made by', 'woocommerce') . ' ' . $user; + echo ''.sprintf( __('Order %s', 'woocommerce'), $order->get_order_number() ).' ' . __('made by', 'woocommerce') . ' ' . $user; if ($order->billing_email) : echo ''.__('Email:', 'woocommerce') . ' ' . ''.esc_html( $order->billing_email ).''; @@ -330,7 +330,7 @@ function woocommerce_shop_order_search_custom_fields( $wp ) { if( !isset( $wp->query_vars['s'] ) || !$wp->query_vars['s'] ) return $wp; if ($wp->query_vars['post_type']!='shop_order') return $wp; - $search_fields = array( + $search_fields = apply_filters( 'woocommerce_shop_order_search_fields', array( '_order_key', '_billing_first_name', '_billing_last_name', @@ -344,7 +344,7 @@ function woocommerce_shop_order_search_custom_fields( $wp ) { '_billing_email', '_order_items', '_billing_phone' - ); + ) ); // Query matching custom fields - this seems faster than meta_query $post_ids = $wpdb->get_col($wpdb->prepare('SELECT post_id FROM '.$wpdb->postmeta.' WHERE meta_key IN ('.'"'.implode('","', $search_fields).'"'.') AND meta_value LIKE "%%%s%%"', esc_attr($_GET['s']) )); diff --git a/admin/post-types/writepanels/writepanel-order_data.php b/admin/post-types/writepanels/writepanel-order_data.php index 16306399534..d934e668655 100644 --- a/admin/post-types/writepanels/writepanel-order_data.php +++ b/admin/post-types/writepanels/writepanel-order_data.php @@ -52,7 +52,7 @@ function woocommerce_order_data_meta_box($post) {
-

— #

+

get_order_number(); ?>

').prepend('');a(".shop_table.cart").css("opacity","1").unblock();a("body").trigger("cart_page_refreshed")});a(".cart_totals").load(window.location+" .cart_totals:eq(0) > *",function(){a(".cart_totals").css("opacity","1").unblock()});a("body").trigger("added_to_cart")});return!1}return!0});a("select.orderby").change(function(){a(this).closest("form").submit()});a("#rating").hide().before('

12345

');a("p.stars a").click(function(){var b=a(this);a("#rating").val(b.text());a("p.stars a").removeClass("active");b.addClass("active");return!1});a("#review_form #submit").live("click",function(){var b=a("#rating").val();if(a("#rating").size()>0&&!b&&woocommerce_params.review_rating_required=="yes"){alert(woocommerce_params.required_rating_text);return!1}});a("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('').prepend('');a("input.qty:not(.product-quantity input.qty)").each(function(){var b=parseInt(a(this).attr("data-min"));b&&b>1&&parseInt(a(this).val())c)?$qty.val(c):$qty.val(b+1);$qty.trigger("change")});a(".minus").live("click",function(){var b=parseInt(a(this).next(".qty").val());if(!b||b==""||b=="NaN")b=0;$qty=a(this).next(".qty");var c=parseInt($qty.attr("data-min"));if(c==""||c=="NaN")c=0;c&&(c==b||b0&&$qty.val(b-1);$qty.trigger("change")});var b=woocommerce_params.countries.replace(/"/g,'"'),c=a.parseJSON(b);a("select.country_to_state").change(function(){var b=a(this).val(),d=a(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state"),e=d.parent(),f=d.attr("name"),g=d.attr("id"),h=d.val();if(c[b])c[b].length==0?e.fadeOut(200,function(){d.parent().find(".chzn-container").remove();d.replaceWith('');a("body").trigger("country_to_state_changed",[b,a(this).closest("div")])}):e.fadeOut(200,function(){var i="",j=c[b];for(var k in j)i=i+'";if(d.is("input")){d.replaceWith('');d=a(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state")}d.html('"+i);d.val(h);a("body").trigger("country_to_state_changed",[b,a(this).closest("div")]);e.fadeIn(500)});else if(d.is("select"))e.fadeOut(200,function(){e.find(".chzn-container").remove();d.replaceWith('');a("body").trigger("country_to_state_changed",[b,a(this).closest("div")]);e.fadeIn(500)});else if(d.is(".hidden")){e.find(".chzn-container").remove();d.replaceWith('');a("body").trigger("country_to_state_changed",[b,a(this).closest("div")]);e.delay(200).fadeIn(500)}a("body").delay(200).trigger("country_to_state_changing",[b,a(this).closest("div")])});a("div.woocommerce_tabs .panel").hide();a("div.woocommerce_tabs ul.tabs li a").click(function(){var b=a(this),c=b.closest("div.woocommerce_tabs");a("ul.tabs li",c).removeClass("active");a("div.panel",c).hide();a("div"+b.attr("href")).show();b.parent().addClass("active");return!1});a("div.woocommerce_tabs").each(function(){var b=window.location.hash;b.toLowerCase().indexOf("comment-")>=0?a("ul.tabs li.reviews_tab a",a(this)).click():a("ul.tabs li:first a",a(this)).click()});a(".shipping-calculator-form").hide();a(".shipping-calculator-button").click(function(){a(".shipping-calculator-form").slideToggle("slow");return!1});a(".reset_variations").click(function(){a(".variations select").val("").change();return!1}).css("visibility","hidden");a(".variations select").change(function(){var b=a("div.images img:eq(0)"),c=a("div.images a.zoom:eq(0)"),d=a(b).attr("data-o_src"),e=a(c).attr("data-o_href");if(d&&e){a(b).attr("src",d);a(c).attr("href",e)}a("form input[name=variation_id]").val("").change();a(".single_variation_wrap").hide();a(".single_variation").text("");h();a(this).blur();a().uniform&&a.isFunction(a.uniform.update)&&a.uniform.update()}).bind("focusin",function(){h(a(this).attr("name"))}).change();woocommerce_params.is_cart==1&&a("select#shipping_method, input[name=shipping_method]").live("change",function(){var b=a(this).val();a("div.cart_totals").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var c={action:"woocommerce_update_shipping_method",security:woocommerce_params.update_shipping_method_nonce,shipping_method:b};a.post(woocommerce_params.ajax_url,c,function(b){a("div.cart_totals").replaceWith(b);a("body").trigger("updated_shipping_method")})});if(woocommerce_params.is_checkout==1||woocommerce_params.is_pay_page==1){var i,j;function k(){j&&j.abort();if(a("select#shipping_method").size()>0)var b=a("select#shipping_method").val();else var b=a("input[name=shipping_method]:checked").val();var c=a("#order_review input[name=payment_method]:checked").val(),d=a("#billing_country").val(),e=a("#billing_state").val(),f=a("input#billing_postcode").val();if(a("#shiptobilling input").is(":checked")||a("#shiptobilling input").size()==0)var g=d,h=e,i=f;else var g=a("#shipping_country").val(),h=a("#shipping_state").val(),i=a("input#shipping_postcode").val();a("#order_methods, #order_review").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var k={action:"woocommerce_update_order_review",security:woocommerce_params.update_order_review_nonce,shipping_method:b,payment_method:c,country:d,state:e,postcode:f,s_country:g,s_state:h,s_postcode:i,post_data:a("form.checkout").serialize()};j=a.ajax({type:"POST",url:woocommerce_params.ajax_url,data:k,success:function(b){a("#order_review").after(b).remove();a("#order_review input[name=payment_method]:checked").click();a("body").trigger("updated_checkout")}})}a("body").bind("update_checkout",function(){clearTimeout(i);k()});a("p.password, form.login, form.checkout_coupon, div.shipping_address").hide();a("input.show_password").change(function(){a("p.password").slideToggle()});a("a.showlogin").click(function(){a("form.login").slideToggle();return!1});a("a.showcoupon").click(function(){a("form.checkout_coupon").slideToggle();return!1});a("#shiptobilling input").change(function(){a("div.shipping_address").hide();a(this).is(":checked")||a("div.shipping_address").slideDown()}).change();if(woocommerce_params.option_guest_checkout=="yes"){a("div.create-account").hide();a("input#createaccount").change(function(){a("div.create-account").hide();a(this).is(":checked")&&a("div.create-account").slideDown()}).change()}a(".payment_methods input.input-radio").live("click",function(){a("div.payment_box").filter(":visible").slideUp(250);a(this).is(":checked")&&a("div.payment_box."+a(this).attr("ID")).slideDown(250)});a("#order_review input[name=payment_method]:checked").click();a("select#shipping_method, input[name=shipping_method]").live("change",function(){a("body").trigger("update_checkout")});a("input#billing_country, input#billing_state, #billing_postcode, input#shipping_country, input#shipping_state, #shipping_postcode").live("keydown",function(){clearTimeout(i);i=setTimeout(k,"1000")});a("select#billing_country, select#billing_state, select#shipping_country, select#shipping_state, #shiptobilling input, .update_totals_on_change").live("change",function(){a("body").trigger("update_checkout")});woocommerce_params.is_checkout==1&&a("body").trigger("update_checkout");a("form.checkout").submit(function(){var b=a(this);if(b.is(".processing"))return!1;b.addClass("processing").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});a.ajax({type:"POST",url:woocommerce_params.checkout_url,data:b.serialize(),success:function(c){a(".woocommerce_error, .woocommerce_message").remove();try{result=a.parseJSON(c);if(result.result=="success")window.location=decodeURI(result.redirect);else{if(result.result!="failure")throw"Invalid response";b.prepend(result.messages);b.removeClass("processing").unblock();result.refresh=="true"&&a("body").trigger("update_checkout");a("html, body").animate({scrollTop:a("form.checkout").offset().top-100},1e3)}}catch(d){b.prepend(c);b.removeClass("processing").unblock();a("html, body").animate({scrollTop:a("form.checkout").offset().top-100},1e3)}},dataType:"html"});return!1});var l=woocommerce_params.locale.replace(/"/g,'"'),m=a.parseJSON(l),n=' *';a("body").bind("country_to_state_changing",function(b,c,d){var e=d;if(m[c])var f=m[c];else var f=m["default"];var g={address_1:"#billing_address_1_field, #shipping_address_1_field",address_2:"#billing_address_2_field, #shipping_address_2_field",state:"#billing_state_field, #shipping_state_field",postcode:"#billing_postcode_field, #shipping_postcode_field",city:"#billing_city_field, #shipping_city_field"};a.each(g,function(a,b){var c=e.find(b);if(f[a]){f[a].label&&c.find("label").html(f[a].label);f[a].placeholder&&c.find("input").attr("placeholder",f[a].placeholder);c.find("label abbr").remove();(typeof f[a]["required"]=="undefined"||f[a]["required"]==1)&&c.find("label").append(n);a!=="state"&&(f[a]["hidden"]==1?c.fadeOut(200).find("input").val(""):c.fadeIn(500))}else if(m["default"][a]){m["default"][a]["required"]==1&&c.find("label abbr").size()==0&&c.find("label").append(n);a!=="state"&&(typeof m["default"][a]["hidden"]=="undefined"||m["default"][a]["hidden"]==0)&&c.fadeIn(500)}});var h=e.find("#billing_postcode_field, #shipping_postcode_field"),i=e.find("#billing_city_field, #shipping_city_field");if(f.postcode_before_city){if(i.is(".form-row-first")){i.fadeOut(200,function(){i.removeClass("form-row-first").addClass("form-row-last").insertAfter(h).fadeIn(500)});h.fadeOut(200,function(){h.removeClass("form-row-last").addClass("form-row-first").fadeIn(500)})}}else if(i.is(".form-row-last")){i.fadeOut(200,function(){i.removeClass("form-row-last").addClass("form-row-first").insertBefore(h).fadeIn(500)});h.fadeOut(200,function(){h.removeClass("form-row-first").addClass("form-row-last").fadeIn(500)})}})}a("select.country_to_state").change()}); \ No newline at end of file + */(function(a){function h(c,h){var j=c==window,l=h&&h.message!==undefined?h.message:undefined;h=a.extend({},a.blockUI.defaults,h||{});h.overlayCSS=a.extend({},a.blockUI.defaults.overlayCSS,h.overlayCSS||{});var p=a.extend({},a.blockUI.defaults.css,h.css||{}),q=a.extend({},a.blockUI.defaults.themedCSS,h.themedCSS||{});l=l===undefined?h.message:l;j&&f&&i(window,{fadeOut:0});if(l&&typeof l!="string"&&(l.parentNode||l.jquery)){var r=l.jquery?l[0]:l,s={};a(c).data("blockUI.history",s);s.el=r;s.parent=r.parentNode;s.display=r.style.display;s.position=r.style.position;s.parent&&s.parent.removeChild(r)}a(c).data("blockUI.onUnblock",h.onUnblock);var t=h.baseZ,u=a.browser.msie||h.forceIframe?a(''):a(''),v=h.theme?a(''):a(''),w,x;h.theme&&j?x='":h.theme?x='":j?x='':x='';w=a(x);if(l)if(h.theme){w.css(q);w.addClass("ui-widget-content")}else w.css(p);!h.theme&&(!h.applyPlatformOpacityRules||!a.browser.mozilla||!/Linux/.test(navigator.platform))&&v.css(h.overlayCSS);v.css("position",j?"fixed":"absolute");(a.browser.msie||h.forceIframe)&&u.css("opacity",0);var y=[u,v,w],z=j?a("body"):a(c);a.each(y,function(){this.appendTo(z)});h.theme&&h.draggable&&a.fn.draggable&&w.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var A=d&&(!a.boxModel||a("object,embed",j?null:c).length>0);if(e||A){j&&h.allowBodyStretch&&a.boxModel&&a("html,body").css("height","100%");if((e||!a.boxModel)&&!j)var B=o(c,"borderTopWidth"),C=o(c,"borderLeftWidth"),D=B?"(0 - "+B+")":0,E=C?"(0 - "+C+")":0;a.each([u,v,w],function(a,b){var c=b[0].style;c.position="absolute";if(a<2){j?c.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+h.quirksmodeOffsetHack+') + "px"'):c.setExpression("height",'this.parentNode.offsetHeight + "px"');j?c.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):c.setExpression("width",'this.parentNode.offsetWidth + "px"');E&&c.setExpression("left",E);D&&c.setExpression("top",D)}else if(h.centerY){j&&c.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');c.marginTop=0}else if(!h.centerY&&j){var d=h.css&&h.css.top?parseInt(h.css.top):0,e="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+d+') + "px"';c.setExpression("top",e)}})}if(l){h.theme?w.find(".ui-widget-content").append(l):w.append(l);(l.jquery||l.nodeType)&&a(l).show()}(a.browser.msie||h.forceIframe)&&h.showOverlay&&u.show();if(h.fadeIn){var F=h.onBlock?h.onBlock:b,G=h.showOverlay&&!l?F:b,H=l?F:b;h.showOverlay&&v._fadeIn(h.fadeIn,G);l&&w._fadeIn(h.fadeIn,H)}else{h.showOverlay&&v.show();l&&w.show();h.onBlock&&h.onBlock()}k(1,c,h);if(j){f=w[0];g=a(":input:enabled:visible",f);h.focusInput&&setTimeout(m,20)}else n(w[0],h.centerX,h.centerY);if(h.timeout){var I=setTimeout(function(){j?a.unblockUI(h):a(c).unblock(h)},h.timeout);a(c).data("blockUI.timeout",I)}}function i(b,c){var d=b==window,e=a(b),h=e.data("blockUI.history"),i=e.data("blockUI.timeout");if(i){clearTimeout(i);e.removeData("blockUI.timeout")}c=a.extend({},a.blockUI.defaults,c||{});k(0,b,c);if(c.onUnblock===null){c.onUnblock=e.data("blockUI.onUnblock");e.removeData("blockUI.onUnblock")}var l;d?l=a("body").children().filter(".blockUI").add("body > .blockUI"):l=a(".blockUI",b);d&&(f=g=null);if(c.fadeOut){l.fadeOut(c.fadeOut);setTimeout(function(){j(l,h,c,b)},c.fadeOut)}else j(l,h,c,b)}function j(b,c,d,e){b.each(function(a,b){this.parentNode&&this.parentNode.removeChild(this)});if(c&&c.el){c.el.style.display=c.display;c.el.style.position=c.position;c.parent&&c.parent.appendChild(c.el);a(e).removeData("blockUI.history")}typeof d.onUnblock=="function"&&d.onUnblock(e,d)}function k(b,c,d){var e=c==window,g=a(c);if(!b&&(e&&!f||!e&&!g.data("blockUI.isBlocked")))return;e||g.data("blockUI.isBlocked",b);if(!d.bindEvents||b&&!d.showOverlay)return;var h="mousedown mouseup keydown keypress";b?a(document).bind(h,d,l):a(document).unbind(h,l)}function l(b){if(b.keyCode&&b.keyCode==9&&f&&b.data.constrainTabKey){var c=g,d=!b.shiftKey&&b.target===c[c.length-1],e=b.shiftKey&&b.target===c[0];if(d||e){setTimeout(function(){m(e)},10);return!1}}var h=b.data;return a(b.target).parents("div."+h.blockMsgClass).length>0?!0:a(b.target).parents().children().filter("div.blockUI").length==0}function m(a){if(!g)return;var b=g[a===!0?g.length-1:0];b&&b.focus()}function n(a,b,c){var d=a.parentNode,e=a.style,f=(d.offsetWidth-a.offsetWidth)/2-o(d,"borderLeftWidth"),g=(d.offsetHeight-a.offsetHeight)/2-o(d,"borderTopWidth");b&&(e.left=f>0?f+"px":"0");c&&(e.top=g>0?g+"px":"0")}function o(b,c){return parseInt(a.css(b,c))||0}if(/1\.(0|1|2)\.(0|1|2)/.test(a.fn.jquery)||/^1.1/.test(a.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later! You are using v"+a.fn.jquery);return}a.fn._fadeIn=a.fn.fadeIn;var b=function(){},c=document.documentMode||0,d=a.browser.msie&&(a.browser.version<8&&!c||c<8),e=a.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!c;a.blockUI=function(a){h(window,a)};a.unblockUI=function(a){i(window,a)};a.growlUI=function(b,c,d,e){var f=a('
');b&&f.append("

"+b+"

");c&&f.append("

"+c+"

");d==undefined&&(d=3e3);a.blockUI({message:f,fadeIn:700,fadeOut:1e3,centerY:!1,timeout:d,showOverlay:!1,onUnblock:e,css:a.blockUI.defaults.growlCSS})};a.fn.block=function(b){return this.unblock({fadeOut:0}).each(function(){a.css(this,"position")=="static"&&(this.style.position="relative");a.browser.msie&&(this.style.zoom=1);h(this,b)})};a.fn.unblock=function(a){return this.each(function(){i(this,a)})};a.blockUI.version=2.39;a.blockUI.defaults={message:"

Please wait...

",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,applyPlatformOpacityRules:!0,onBlock:null,onUnblock:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg"};var f=null,g=[]})(jQuery);(function(a){function b(b){this.input=b;b.attr("type")=="password"&&this.handlePassword();a(b[0].form).submit(function(){b.hasClass("placeholder")&&b[0].value==b.attr("placeholder")&&(b[0].value="")})}b.prototype={show:function(a){if(this.input[0].value===""||a&&this.valueIsPlaceholder()){if(this.isPassword)try{this.input[0].setAttribute("type","text")}catch(b){this.input.before(this.fakePassword.show()).hide()}this.input.addClass("placeholder");this.input[0].value=this.input.attr("placeholder")}},hide:function(){if(this.valueIsPlaceholder()&&this.input.hasClass("placeholder")&&(this.input.removeClass("placeholder"),this.input[0].value="",this.isPassword)){try{this.input[0].setAttribute("type","password")}catch(a){}this.input.show();this.input[0].focus()}},valueIsPlaceholder:function(){return this.input[0].value==this.input.attr("placeholder")},handlePassword:function(){var b=this.input;b.attr("realType","password");this.isPassword=!0;if(a.browser.msie&&b[0].outerHTML){var c=a(b[0].outerHTML.replace(/type=(['"])?password\1/gi,"type=$1text$1"));this.fakePassword=c.val(b.attr("placeholder")).addClass("placeholder").focus(function(){b.trigger("focus");a(this).hide()});a(b[0].form).submit(function(){c.remove();b.show()})}}};var c="placeholder"in document.createElement("input");a.fn.placeholder=function(){return c?this:this.each(function(){var c=a(this),e=new b(c);e.show(!0);c.focus(function(){e.hide()});c.blur(function(){e.show(!1)});a.browser.msie&&(a(window).load(function(){c.val()&&c.removeClass("placeholder");e.show(!0)}),c.focus(function(){if(this.value==""){var a=this.createTextRange();a.collapse(!0);a.moveStart("character",0);a.select()}}))})}})(jQuery);jQuery("input[placeholder], textarea[placeholder]").placeholder();jQuery(document).ready(function(a){function d(a,b){var c=!0;for(name in a){var d=a[name],e=b[name];d.length!=0&&e.length!=0&&d!=e&&(c=!1)}return c}function e(a){var b=[];for(var c=0;c").html(g).text();g=g.replace(/'/g,"\\'");g=g.replace(/"/g,'\\"');current_attr_select.find('option[value="'+g+'"]').removeAttr("disabled")}else current_attr_select.find("option").removeAttr("disabled")}}});a(document).trigger("woocommerce_update_variation_values")}function g(b){var c=a("div.images img:eq(0)"),d=a("div.images a.zoom:eq(0)"),e=a(c).attr("data-o_src"),f=a(d).attr("data-o_href"),g=b.image_src,h=b.image_link;a(".variations_button").show();a(".single_variation").html(b.price_html+b.availability_html);e||a(c).attr("data-o_src",a(c).attr("src"));f||a(d).attr("data-o_href",a(d).attr("href"));if(g&&g.length>1){a(c).attr("src",g);a(d).attr("href",h)}else{a(c).attr("src",e);a(d).attr("href",f)}b.sku?a(".product_meta").find(".sku").text(b.sku):a(".product_meta").find(".sku").text("");a(".single_variation_wrap").find(".quantity").show();b.min_qty?a(".single_variation_wrap").find("input[name=quantity]").attr("data-min",b.min_qty).val(b.min_qty):a(".single_variation_wrap").find("input[name=quantity]").removeAttr("data-min");b.max_qty?a(".single_variation_wrap").find("input[name=quantity]").attr("data-max",b.max_qty):a(".single_variation_wrap").find("input[name=quantity]").removeAttr("data-max");if(b.is_sold_individually=="yes"){a(".single_variation_wrap").find("input[name=quantity]").val("1");a(".single_variation_wrap").find(".quantity").hide()}a(".single_variation_wrap").slideDown("200").trigger("variationWrapShown").trigger("show_variation")}function h(b){var c=!0,d=!1,h={};a(".variations select").each(function(){if(b&&a(this).attr("name")==b){c=!1;h[a(this).attr("name")]=""}else{a(this).val().length==0?c=!1:d=!0;value=a(this).val().replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">");h[a(this).attr("name")]=value}});var i=e(h);if(c){var j=i.pop();if(j){a("form input[name=variation_id]").val(j.variation_id).change();g(j)}else a(".variations select").val("")}else f(i);d?a(".reset_variations").css("visibility")=="hidden"&&a(".reset_variations").css("visibility","visible").hide().fadeIn():a(".reset_variations").css("visibility","hidden")}woocommerce_params.option_ajax_add_to_cart=="yes"&&a(".add_to_cart_button").live("click",function(){var b=a(this);if(b.is(".product_type_simple, .product_type_downloadable, .product_type_virtual")){if(!b.attr("data-product_id"))return!0;b.removeClass("added");b.addClass("loading");var c={action:"woocommerce_add_to_cart",product_id:b.attr("data-product_id"),security:woocommerce_params.add_to_cart_nonce};a("body").trigger("adding_to_cart");a.post(woocommerce_params.ajax_url,c,function(d){b.removeClass("loading");c=a.parseJSON(d);if(c.error&&c.product_url){window.location=c.product_url;return}fragments=c;fragments&&a.each(fragments,function(b,c){a(b).addClass("updating")});a(".widget_shopping_cart, .shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{background:"transparent url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});b.addClass("added");if(a(".widget_shopping_cart").size()>0)a(".widget_shopping_cart:eq(0)").load(window.location+" .widget_shopping_cart:eq(0) > *",function(){fragments&&a.each(fragments,function(b,c){a(b).replaceWith(c)});a(".widget_shopping_cart, .updating").css("opacity","1").unblock();a("body").trigger("cart_widget_refreshed")});else{fragments&&a.each(fragments,function(b,c){a(b).replaceWith(c)});a(".widget_shopping_cart, .updating").css("opacity","1").unblock()}a(".shop_table.cart").load(window.location+" .shop_table.cart:eq(0) > *",function(){a("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('').prepend('');a(".shop_table.cart").css("opacity","1").unblock();a("body").trigger("cart_page_refreshed")});a(".cart_totals").load(window.location+" .cart_totals:eq(0) > *",function(){a(".cart_totals").css("opacity","1").unblock()});a("body").trigger("added_to_cart")});return!1}return!0});a("select.orderby").change(function(){a(this).closest("form").submit()});a("#rating").hide().before('

12345

');a("p.stars a").click(function(){var b=a(this);a("#rating").val(b.text());a("p.stars a").removeClass("active");b.addClass("active");return!1});a("#review_form #submit").live("click",function(){var b=a("#rating").val();if(a("#rating").size()>0&&!b&&woocommerce_params.review_rating_required=="yes"){alert(woocommerce_params.required_rating_text);return!1}});a("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('').prepend('');a("input.qty:not(.product-quantity input.qty)").each(function(){var b=parseInt(a(this).attr("data-min"));b&&b>1&&parseInt(a(this).val())c)?$qty.val(c):$qty.val(b+1);$qty.trigger("change")});a(".minus").live("click",function(){var b=parseInt(a(this).next(".qty").val());if(!b||b==""||b=="NaN")b=0;$qty=a(this).next(".qty");var c=parseInt($qty.attr("data-min"));if(c==""||c=="NaN")c=0;c&&(c==b||b0&&$qty.val(b-1);$qty.trigger("change")});var b=woocommerce_params.countries.replace(/"/g,'"'),c=a.parseJSON(b);a("select.country_to_state").change(function(){var b=a(this).val(),d=a(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state"),e=d.parent(),f=d.attr("name"),g=d.attr("id"),h=d.val();if(c[b])c[b].length==0?e.fadeOut(200,function(){d.parent().find(".chzn-container").remove();d.replaceWith('');a("body").trigger("country_to_state_changed",[b,a(this).closest("div")])}):e.fadeOut(200,function(){var i="",j=c[b];for(var k in j)i=i+'";if(d.is("input")){d.replaceWith('');d=a(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state")}d.html('"+i);d.val(h);a("body").trigger("country_to_state_changed",[b,a(this).closest("div")]);e.fadeIn(500)});else if(d.is("select"))e.fadeOut(200,function(){e.find(".chzn-container").remove();d.replaceWith('');a("body").trigger("country_to_state_changed",[b,a(this).closest("div")]);e.fadeIn(500)});else if(d.is(".hidden")){e.find(".chzn-container").remove();d.replaceWith('');a("body").trigger("country_to_state_changed",[b,a(this).closest("div")]);e.delay(200).fadeIn(500)}a("body").delay(200).trigger("country_to_state_changing",[b,a(this).closest("div")])});a(".woocommerce_tabs .panel").hide();a(".woocommerce_tabs ul.tabs li a").click(function(){var b=a(this),c=b.closest(".woocommerce_tabs");a("ul.tabs li",c).removeClass("active");a("div.panel",c).hide();a("div"+b.attr("href")).show();b.parent().addClass("active");return!1});a(".woocommerce_tabs").each(function(){var b=window.location.hash;b.toLowerCase().indexOf("comment-")>=0?a("ul.tabs li.reviews_tab a",a(this)).click():a("ul.tabs li:first a",a(this)).click()});a(".shipping-calculator-form").hide();a(".shipping-calculator-button").click(function(){a(".shipping-calculator-form").slideToggle("slow");return!1});a(".reset_variations").click(function(){a(".variations select").val("").change();return!1}).css("visibility","hidden");a(".variations select").change(function(){var b=a("div.images img:eq(0)"),c=a("div.images a.zoom:eq(0)"),d=a(b).attr("data-o_src"),e=a(c).attr("data-o_href");if(d&&e){a(b).attr("src",d);a(c).attr("href",e)}a("form input[name=variation_id]").val("").change();a(".single_variation_wrap").hide();a(".single_variation").text("");h();a(this).blur();a().uniform&&a.isFunction(a.uniform.update)&&a.uniform.update()}).bind("focusin",function(){h(a(this).attr("name"))}).change();woocommerce_params.is_cart==1&&a("select#shipping_method, input[name=shipping_method]").live("change",function(){var b=a(this).val();a("div.cart_totals").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var c={action:"woocommerce_update_shipping_method",security:woocommerce_params.update_shipping_method_nonce,shipping_method:b};a.post(woocommerce_params.ajax_url,c,function(b){a("div.cart_totals").replaceWith(b);a("body").trigger("updated_shipping_method")})});if(woocommerce_params.is_checkout==1||woocommerce_params.is_pay_page==1){var i,j;function k(){j&&j.abort();if(a("select#shipping_method").size()>0)var b=a("select#shipping_method").val();else var b=a("input[name=shipping_method]:checked").val();var c=a("#order_review input[name=payment_method]:checked").val(),d=a("#billing_country").val(),e=a("#billing_state").val(),f=a("input#billing_postcode").val();if(a("#shiptobilling input").is(":checked")||a("#shiptobilling input").size()==0)var g=d,h=e,i=f;else var g=a("#shipping_country").val(),h=a("#shipping_state").val(),i=a("input#shipping_postcode").val();a("#order_methods, #order_review").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var k={action:"woocommerce_update_order_review",security:woocommerce_params.update_order_review_nonce,shipping_method:b,payment_method:c,country:d,state:e,postcode:f,s_country:g,s_state:h,s_postcode:i,post_data:a("form.checkout").serialize()};j=a.ajax({type:"POST",url:woocommerce_params.ajax_url,data:k,success:function(b){a("#order_review").after(b).remove();a("#order_review input[name=payment_method]:checked").click();a("body").trigger("updated_checkout")}})}a("body").bind("update_checkout",function(){clearTimeout(i);k()});a("p.password, form.login, form.checkout_coupon, div.shipping_address").hide();a("input.show_password").change(function(){a("p.password").slideToggle()});a("a.showlogin").click(function(){a("form.login").slideToggle();return!1});a("a.showcoupon").click(function(){a("form.checkout_coupon").slideToggle();return!1});a("#shiptobilling input").change(function(){a("div.shipping_address").hide();a(this).is(":checked")||a("div.shipping_address").slideDown()}).change();if(woocommerce_params.option_guest_checkout=="yes"){a("div.create-account").hide();a("input#createaccount").change(function(){a("div.create-account").hide();a(this).is(":checked")&&a("div.create-account").slideDown()}).change()}a(".payment_methods input.input-radio").live("click",function(){a("div.payment_box").filter(":visible").slideUp(250);a(this).is(":checked")&&a("div.payment_box."+a(this).attr("ID")).slideDown(250)});a("#order_review input[name=payment_method]:checked").click();a("select#shipping_method, input[name=shipping_method]").live("change",function(){a("body").trigger("update_checkout")});a("input#billing_country, input#billing_state, #billing_postcode, input#shipping_country, input#shipping_state, #shipping_postcode").live("keydown",function(){clearTimeout(i);i=setTimeout(k,"1000")});a("select#billing_country, select#billing_state, select#shipping_country, select#shipping_state, #shiptobilling input, .update_totals_on_change").live("change",function(){a("body").trigger("update_checkout")});woocommerce_params.is_checkout==1&&a("body").trigger("update_checkout");a("form.checkout").submit(function(){var b=a(this);if(b.is(".processing"))return!1;b.addClass("processing").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});a.ajax({type:"POST",url:woocommerce_params.checkout_url,data:b.serialize(),success:function(c){a(".woocommerce_error, .woocommerce_message").remove();try{result=a.parseJSON(c);if(result.result=="success")window.location=decodeURI(result.redirect);else{if(result.result!="failure")throw"Invalid response";b.prepend(result.messages);b.removeClass("processing").unblock();result.refresh=="true"&&a("body").trigger("update_checkout");a("html, body").animate({scrollTop:a("form.checkout").offset().top-100},1e3)}}catch(d){b.prepend(c);b.removeClass("processing").unblock();a("html, body").animate({scrollTop:a("form.checkout").offset().top-100},1e3)}},dataType:"html"});return!1});var l=woocommerce_params.locale.replace(/"/g,'"'),m=a.parseJSON(l),n=' *';a("body").bind("country_to_state_changing",function(b,c,d){var e=d;if(m[c])var f=m[c];else var f=m["default"];var g={address_1:"#billing_address_1_field, #shipping_address_1_field",address_2:"#billing_address_2_field, #shipping_address_2_field",state:"#billing_state_field, #shipping_state_field",postcode:"#billing_postcode_field, #shipping_postcode_field",city:"#billing_city_field, #shipping_city_field"};a.each(g,function(a,b){var c=e.find(b);if(f[a]){f[a].label&&c.find("label").html(f[a].label);f[a].placeholder&&c.find("input").attr("placeholder",f[a].placeholder);c.find("label abbr").remove();(typeof f[a]["required"]=="undefined"||f[a]["required"]==1)&&c.find("label").append(n);a!=="state"&&(f[a]["hidden"]==1?c.fadeOut(200).find("input").val(""):c.fadeIn(500))}else if(m["default"][a]){m["default"][a]["required"]==1&&c.find("label abbr").size()==0&&c.find("label").append(n);a!=="state"&&(typeof m["default"][a]["hidden"]=="undefined"||m["default"][a]["hidden"]==0)&&c.fadeIn(500)}});var h=e.find("#billing_postcode_field, #shipping_postcode_field"),i=e.find("#billing_city_field, #shipping_city_field");if(f.postcode_before_city){if(i.is(".form-row-first")){i.fadeOut(200,function(){i.removeClass("form-row-first").addClass("form-row-last").insertAfter(h).fadeIn(500)});h.fadeOut(200,function(){h.removeClass("form-row-last").addClass("form-row-first").fadeIn(500)})}}else if(i.is(".form-row-last")){i.fadeOut(200,function(){i.removeClass("form-row-last").addClass("form-row-first").insertBefore(h).fadeIn(500)});h.fadeOut(200,function(){h.removeClass("form-row-first").addClass("form-row-last").fadeIn(500)})}})}a("select.country_to_state").change()}); \ No newline at end of file diff --git a/classes/class-wc-email.php b/classes/class-wc-email.php index fe7174bfe1d..e13cf3cc770 100644 --- a/classes/class-wc-email.php +++ b/classes/class-wc-email.php @@ -121,7 +121,7 @@ class WC_Email { $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); - $subject = apply_filters( 'woocommerce_email_subject_new_order', sprintf( __( '[%s] New Customer Order (# %s)', 'woocommerce' ), $blogname, $order_id ), $order ); + $subject = apply_filters( 'woocommerce_email_subject_new_order', sprintf( __( '[%s] New Customer Order (%s)', 'woocommerce' ), $blogname, $order->get_order_number() ), $order ); // Buffer ob_start(); diff --git a/classes/class-wc-product.php b/classes/class-wc-product.php index d7e4f254568..518b3a7b97e 100644 --- a/classes/class-wc-product.php +++ b/classes/class-wc-product.php @@ -404,6 +404,9 @@ class WC_Product { * @return int */ function get_stock_quantity() { + if ( get_option( 'woocommerce_manage_stock' ) == 'no' ) + return ''; + return (int) $this->stock; } @@ -692,7 +695,7 @@ class WC_Product { endif; endif; - return $price; + return apply_filters('woocommerce_get_price_html', $price, $this); } /** Functions for getting parts of a price, in html, used by get_price_html */ diff --git a/classes/class-wc-query.php b/classes/class-wc-query.php index 44d4d5426f4..7da6d95d78f 100644 --- a/classes/class-wc-query.php +++ b/classes/class-wc-query.php @@ -54,14 +54,10 @@ class WC_Query { if ( ( ! $query ) // Abort if theres no query - || - ( empty( $this->post__in ) ) // Abort if we're not filtering posts - || - ( ! empty( $query->wc_query ) ) // Abort if this query is already done - || - ( empty( $query->query_vars["s"] ) ) // Abort if this isn't a search query - || - ( ! $query->is_post_type_archive( 'product' ) && ! $query->is_tax( array_merge( array('product_cat', 'product_tag'), $woocommerce->get_attribute_taxonomy_names() ) ) ) // Abort if we're not on a post type archive/prduct taxonomy + || ( empty( $this->post__in ) ) // Abort if we're not filtering posts + || ( ! empty( $query->wc_query ) ) // Abort if this query is already done + || ( empty( $query->query_vars["s"] ) ) // Abort if this isn't a search query + || ( ! $query->is_post_type_archive( 'product' ) && ! $query->is_tax( array_merge( array('product_cat', 'product_tag'), $woocommerce->get_attribute_taxonomy_names() ) ) ) // Abort if we're not on a post type archive/prduct taxonomy ) return $posts; @@ -110,13 +106,15 @@ class WC_Query { // Ordering query vars $q->set( 'orderby', $ordering['orderby'] ); $q->set( 'order', $ordering['order'] ); - if (isset($ordering['meta_key'])) $q->set( 'meta_key', $ordering['meta_key'] ); + if ( isset( $ordering['meta_key'] ) ) + $q->set( 'meta_key', $ordering['meta_key'] ); // Query vars that affect posts shown - if (!$q->is_tax( 'product_cat' ) && !$q->is_tax( 'product_tag' )) $q->set( 'post_type', 'product' ); + if ( ! $q->is_tax( 'product_cat' ) && ! $q->is_tax( 'product_tag' ) ) + $q->set( 'post_type', 'product' ); $q->set( 'meta_query', $meta_query ); $q->set( 'post__in', $post__in ); - $q->set( 'posts_per_page', ($q->get('posts_per_page')) ? $q->get('posts_per_page') : apply_filters('loop_shop_per_page', get_option('posts_per_page') ) ); + $q->set( 'posts_per_page', $q->get('posts_per_page') ? $q->get('posts_per_page') : apply_filters('loop_shop_per_page', get_option('posts_per_page') ) ); // Set a special variable $q->set( 'wc_query', true ); @@ -143,14 +141,14 @@ class WC_Query { // Get WP Query for current page (without 'paged') $current_wp_query = $wp_query->query; - unset($current_wp_query['paged']); + unset( $current_wp_query['paged'] ); // Generate a transient name based on current query $transient_name = 'wc_uf_pid_' . md5( http_build_query($current_wp_query) ); - $transient_name = (is_search()) ? $transient_name . '_s' : $transient_name; + $transient_name = ( is_search() ) ? $transient_name . '_s' : $transient_name; if ( false === ( $unfiltered_product_ids = get_transient( $transient_name ) ) ) { - + // Get all visible posts, regardless of filters $unfiltered_product_ids = get_posts( array_merge( @@ -255,33 +253,5 @@ class WC_Query { endif; return $meta_query; } - - /** - * Get a list of product id's which should be hidden from the frontend; useful for custom queries and loops. Makes use of transients. - */ - function get_hidden_product_ids() { - - $transient_name = (is_search()) ? 'wc_hidden_product_ids_search' : 'wc_hidden_product_ids'; - - if ( false === ( $hidden_product_ids = get_transient( $transient_name ) ) ) { - - $meta_query = array(); - $meta_query[] = $this->visibility_meta_query( 'NOT IN' ); - $meta_query[] = $this->stock_status_meta_query( 'outofstock' ); - - $hidden_product_ids = get_posts(array( - 'post_type' => 'product', - 'numberposts' => -1, - 'post_status' => 'publish', - 'meta_query' => $meta_query, - 'fields' => 'ids', - 'no_found_rows' => true - )); - - set_transient( $transient_name, $hidden_product_ids ); - } - - return (array) $hidden_product_ids; - } - + } \ No newline at end of file diff --git a/classes/gateways/class-wc-payment-gateways.php b/classes/gateways/class-wc-payment-gateways.php index b9d22053265..7b3ddd5d4cc 100644 --- a/classes/gateways/class-wc-payment-gateways.php +++ b/classes/gateways/class-wc-payment-gateways.php @@ -68,7 +68,7 @@ class WC_Payment_Gateways { endforeach; - return $_available_gateways; + return apply_filters( 'woocommerce_available_payment_gateways', $_available_gateways ); } function process_admin_options() { diff --git a/classes/integrations/google-analytics/class-wc-google-analytics.php b/classes/integrations/google-analytics/class-wc-google-analytics.php index eb195b5e0f7..091394b11ea 100644 --- a/classes/integrations/google-analytics/class-wc-google-analytics.php +++ b/classes/integrations/google-analytics/class-wc-google-analytics.php @@ -172,8 +172,10 @@ class WC_Google_Analytics extends WC_Integration { } else { $out = array(); $categories = get_the_terms($_product->id, 'product_cat'); - foreach ( $categories as $category ){ - $out[] = $category->name; + if ( $categories ) { + foreach ( $categories as $category ){ + $out[] = $category->name; + } } echo join( "/", $out); } diff --git a/classes/integrations/sharethis/class-wc-sharethis.php b/classes/integrations/sharethis/class-wc-sharethis.php index 664576b90ab..a781df8dbb0 100644 --- a/classes/integrations/sharethis/class-wc-sharethis.php +++ b/classes/integrations/sharethis/class-wc-sharethis.php @@ -20,7 +20,7 @@ class WC_ShareThis extends WC_Integration { $this->default_code = ''; // Load the form fields. @@ -33,7 +33,7 @@ class WC_ShareThis extends WC_Integration { $this->publisher_id = $this->settings['publisher_id']; $this->sharethis_code = $this->settings['sharethis_code']; - if ( ! $this->sharethis_code ) $this->sharethis_code = $this->default_code; + if ( ! $this->sharethis_code ) $this->settings['sharethis_code'] = $this->sharethis_code = $this->default_code; // Actions add_action( 'woocommerce_update_options_integration_sharethis', array( &$this, 'process_admin_options') ); @@ -73,10 +73,15 @@ class WC_ShareThis extends WC_Integration { global $post; if ( $this->publisher_id ) { - + + $thumbnail = ( $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) ? current(wp_get_attachment_image_src( $thumbnail_id, 'large' )) : ''; + $sharethis = ( is_ssl() ) ? 'https://ws.sharethis.com/button/buttons.js' : 'http://w.sharethis.com/button/buttons.js'; - echo str_replace( '{permalink}', urlencode(get_permalink($post->ID)), $this->sharethis_code ); + $sharethis_code = str_replace( '{permalink}', urlencode( get_permalink( $post->ID ) ), $this->sharethis_code ); + if ( isset( $thumbnail ) ) $sharethis_code = str_replace( '{image}', urlencode( $thumbnail ), $sharethis_code ); + + echo $sharethis_code; echo ''; echo ''; diff --git a/classes/shipping/class-wc-flat-rate.php b/classes/shipping/class-wc-flat-rate.php index 30d74371802..378650efaae 100644 --- a/classes/shipping/class-wc-flat-rate.php +++ b/classes/shipping/class-wc-flat-rate.php @@ -10,23 +10,21 @@ * @author WooThemes */ class WC_Flat_Rate extends WC_Shipping_Method { - function __construct() { $this->id = 'flat_rate'; - $this->method_title = __('Flat rate', 'woocommerce'); + $this->method_title = __( 'Flat rate', 'woocommerce' ); $this->flat_rate_option = 'woocommerce_flat_rates'; - $this->admin_page_heading = __('Flat Rates', 'woocommerce'); - $this->admin_page_description = __('Flat rates let you define a standard rate per item, or per order.', 'woocommerce'); + $this->admin_page_heading = __( 'Flat Rates', 'woocommerce' ); + $this->admin_page_description = __( 'Flat rates let you define a standard rate per item, or per order.', 'woocommerce' ); - add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options')); - add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_flat_rates')); + add_action( 'woocommerce_update_options_shipping_' . $this->id, array( &$this, 'process_admin_options' ) ); + add_action( 'woocommerce_update_options_shipping_' . $this->id, array( &$this, 'process_flat_rates' ) ); $this->init(); } function init() { - // Load the form fields. $this->init_form_fields(); @@ -34,19 +32,20 @@ class WC_Flat_Rate extends WC_Shipping_Method { $this->init_settings(); // Define user set variables - $this->enabled = $this->settings['enabled']; - $this->title = $this->settings['title']; - $this->availability = $this->settings['availability']; - $this->countries = $this->settings['countries']; - $this->type = $this->settings['type']; - $this->tax_status = $this->settings['tax_status']; - $this->cost = $this->settings['cost']; - $this->fee = $this->settings['fee']; - $this->minimum_fee = isset($this->settings['minimum_fee']) ? $this->settings['minimum_fee'] : ''; - $this->options = isset($this->settings['options']) ? $this->settings['options'] : ''; + $this->enabled = $this->settings['enabled']; + $this->title = $this->settings['title']; + $this->availability = $this->settings['availability']; + $this->countries = $this->settings['countries']; + $this->type = $this->settings['type']; + $this->tax_status = $this->settings['tax_status']; + $this->cost = $this->settings['cost']; + $this->cost_per_order = isset( $this->settings['cost_per_order'] ) ? $this->settings['cost_per_order'] : ''; + $this->fee = $this->settings['fee']; + $this->minimum_fee = isset( $this->settings['minimum_fee'] ) ? $this->settings['minimum_fee'] : ''; + $this->options = isset( $this->settings['options'] ) ? $this->settings['options'] : ''; // Get options - $this->options = (array) explode("\n", $this->options); + $this->options = (array) explode( "\n", $this->options ); // Load Flat rates $this->get_flat_rates(); @@ -63,13 +62,19 @@ class WC_Flat_Rate extends WC_Shipping_Method { 'title' => __( 'Enable/Disable', 'woocommerce' ), 'type' => 'checkbox', 'label' => __( 'Enable this shipping method', 'woocommerce' ), - 'default' => 'no' + 'default' => 'no', ), 'title' => array( 'title' => __( 'Method Title', 'woocommerce' ), 'type' => 'text', 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ), - 'default' => __( 'Flat Rate', 'woocommerce' ) + 'default' => __( 'Flat Rate', 'woocommerce' ), + ), + 'cost_per_order' => array( + 'title' => __( 'Cost per order', 'woocommerce' ), + 'type' => 'text', + 'description' => __( 'Enter a cost per order, e.g. 5.00. Leave blank to disable.', 'woocommerce' ), + 'default' => '', ), 'availability' => array( 'title' => __( 'Method availability', 'woocommerce' ), @@ -77,9 +82,9 @@ class WC_Flat_Rate extends WC_Shipping_Method { 'default' => 'all', 'class' => 'availability', 'options' => array( - 'all' => __('All allowed countries', 'woocommerce'), - 'specific' => __('Specific Countries', 'woocommerce') - ) + 'all' => __( 'All allowed countries', 'woocommerce' ), + 'specific' => __( 'Specific Countries', 'woocommerce' ), + ), ), 'countries' => array( 'title' => __( 'Specific Countries', 'woocommerce' ), @@ -87,7 +92,7 @@ class WC_Flat_Rate extends WC_Shipping_Method { 'class' => 'chosen_select', 'css' => 'width: 450px;', 'default' => '', - 'options' => $woocommerce->countries->countries + 'options' => $woocommerce->countries->countries, ), 'type' => array( 'title' => __( 'Calculation Type', 'woocommerce' ), @@ -95,10 +100,10 @@ class WC_Flat_Rate extends WC_Shipping_Method { 'description' => '', 'default' => 'order', 'options' => array( - 'order' => __('Per Order - charge shipping for the entire order as a whole', 'woocommerce'), - 'item' => __('Per Item - charge shipping for each item individually', 'woocommerce'), - 'class' => __('Per Class - charge shipping for each shipping class in an order', 'woocommerce') - ) + 'order' => __( 'Per Order - charge shipping for the entire order as a whole', 'woocommerce' ), + 'item' => __( 'Per Item - charge shipping for each item individually', 'woocommerce' ), + 'class' => __( 'Per Class - charge shipping for each shipping class in an order', 'woocommerce' ), + ), ), 'tax_status' => array( 'title' => __( 'Tax Status', 'woocommerce' ), @@ -106,33 +111,33 @@ class WC_Flat_Rate extends WC_Shipping_Method { 'description' => '', 'default' => 'taxable', 'options' => array( - 'taxable' => __('Taxable', 'woocommerce'), - 'none' => __('None', 'woocommerce') - ) + 'taxable' => __( 'Taxable', 'woocommerce' ), + 'none' => __( 'None', 'woocommerce' ), + ), ), 'cost' => array( 'title' => __( 'Default Cost', 'woocommerce' ), 'type' => 'text', - 'description' => __('Cost excluding tax. Enter an amount, e.g. 2.50.', 'woocommerce'), - 'default' => '' - ), + 'description' => __( 'Cost excluding tax. Enter an amount, e.g. 2.50.', 'woocommerce' ), + 'default' => '', + ), 'fee' => array( 'title' => __( 'Default Handling Fee', 'woocommerce' ), 'type' => 'text', - 'description' => __('Fee excluding tax. Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce'), - 'default' => '' + 'description' => __( 'Fee excluding tax. Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce' ), + 'default' => '', ), 'minimum_fee' => array( 'title' => __( 'Minimum Fee', 'woocommerce' ), 'type' => 'text', - 'description' => __('Enter a minimum fee amount. Fee\'s less than this will be increased. Leave blank to disable.', 'woocommerce'), - 'default' => '' + 'description' => __( 'Enter a minimum fee amount. Fee\'s less than this will be increased. Leave blank to disable.', 'woocommerce' ), + 'default' => '', ), 'options' => array( 'title' => __( 'Shipping Options', 'woocommerce' ), 'type' => 'textarea', - 'description' => __('Optional extra shipping options with additional costs (one per line). Example: Option Name|Cost|Per-order (yes or no). Example: Priority Mail|6.95|yes. If per-order is set to no, it will use the "Calculation Type" setting.', 'woocommerce'), - 'default' => '' + 'description' => __( 'Optional extra shipping options with additional costs (one per line). Example: Option Name|Cost|Per-order (yes or no). Example: Priority Mail|6.95|yes. If per-order is set to no, it will use the "Calculation Type" setting.', 'woocommerce' ), + 'default' => '', ), ); @@ -142,63 +147,58 @@ class WC_Flat_Rate extends WC_Shipping_Method { global $woocommerce; $this->rates = array(); + $cost_per_order = ( isset( $this->cost_per_order ) && ! empty( $this->cost_per_order ) ) ? $this->cost_per_order : 0; if ( $this->type == 'order' ) { - $shipping_total = $this->order_shipping( $package ); $rate = array( 'id' => $this->id, 'label' => $this->title, - 'cost' => $shipping_total + 'cost' => $shipping_total + $cost_per_order, ); - } elseif ( $this->type == 'class' ) { - $shipping_total = $this->class_shipping( $package ); $rate = array( 'id' => $this->id, 'label' => $this->title, - 'cost' => $shipping_total + 'cost' => $shipping_total + $cost_per_order, ); - } elseif ( $this->type == 'item' ) { - $costs = $this->item_shipping( $package ); + $costs['order'] = $cost_per_order; $rate = array( 'id' => $this->id, 'label' => $this->title, 'cost' => $costs, - 'calc_tax' => 'per_item' + 'calc_tax' => 'per_item', ); } // Register the rate - $this->add_rate( $rate ); + $this->add_rate( $rate ); // Add any extra rates if ( sizeof( $this->options ) > 0) foreach ( $this->options as $option ) { $this_option = preg_split( '~\s*\|\s*~', trim( $option ) ); - if (sizeof($this_option)!==3) continue; + if ( sizeof( $this_option ) !== 3 ) continue; $extra_rate = $rate; - $extra_rate['id'] = $this->id . ':' . sanitize_title($this_option[0]); - $extra_rate['label'] = $this_option[0]; + $extra_rate['id'] = $this->id . ':' . sanitize_title($this_option[0]); + $extra_rate['label'] = $this_option[0]; - $per_order_cost = ($this_option[2]=='yes') ? 1 : 0; + $per_order_cost = ( $this_option[2] == 'yes' ) ? 1 : 0; $this_cost = $this_option[1]; - if (is_array($extra_rate['cost'])) { - - if ($per_order_cost) { + if ( is_array( $extra_rate['cost'] ) ) { + if ( $per_order_cost ) { $extra_rate['cost']['order'] = $this_cost; } else { - $total_quantity = 0; // Shipping per item @@ -209,19 +209,16 @@ class WC_Flat_Rate extends WC_Shipping_Method { // Per-product shipping $extra_rate['cost']['order'] = $this_cost * $total_quantity; } - } else { - // If using shipping per class, multiple the cost by the classes we found - if (!$per_order_cost && $this->type=='class') { + if ( ! $per_order_cost && $this->type == 'class' ) { $this_cost = $this_cost * $found_shipping_classes; } $extra_rate['cost'] = $extra_rate['cost'] + $this_cost; } - $this->add_rate( $extra_rate ); - + $this->add_rate( $extra_rate ); } } @@ -245,14 +242,14 @@ class WC_Flat_Rate extends WC_Shipping_Method { // Find most expensive class (if found) foreach ( $found_shipping_classes as $shipping_class ) { - if (isset($this->flat_rates[$shipping_class])) { - if ($this->flat_rates[$shipping_class]['cost'] > $cost) { - $cost = $this->flat_rates[$shipping_class]['cost']; - $fee = $this->flat_rates[$shipping_class]['fee']; + if ( isset( $this->flat_rates[ $shipping_class ] ) ) { + if ( $this->flat_rates[ $shipping_class ]['cost'] > $cost ) { + $cost = $this->flat_rates[ $shipping_class ]['cost']; + $fee = $this->flat_rates[ $shipping_class ]['fee']; } } else { // No matching classes so use defaults - if ($this->cost > $cost) { + if ( $this->cost > $cost ) { $cost = $this->cost; $fee = $this->fee; } @@ -276,36 +273,34 @@ class WC_Flat_Rate extends WC_Shipping_Method { $fee = null; if ( sizeof( $this->flat_rates ) > 0 ) { - $found_shipping_classes = array(); // Find shipping classes for products in the cart. Store prices too, so we can calc a fee for the class. if ( sizeof( $package['contents'] ) > 0 ) { foreach ( $package['contents'] as $item_id => $values ) { - if ( $values['data']->needs_shipping() ) : - if ( isset( $found_shipping_classes[$values['data']->get_shipping_class()] ) ) { - $found_shipping_classes[$values['data']->get_shipping_class()] = ($values['data']->get_price() * $values['quantity']) + $found_shipping_classes[$values['data']->get_shipping_class()]; + if ( $values['data']->needs_shipping() ) { + if ( isset( $found_shipping_classes[ $values['data']->get_shipping_class() ] ) ) { + $found_shipping_classes[ $values['data']->get_shipping_class() ] = ( $values['data']->get_price() * $values['quantity'] ) + $found_shipping_classes[ $values['data']->get_shipping_class() ]; } else { - $found_shipping_classes[$values['data']->get_shipping_class()] = ($values['data']->get_price() * $values['quantity']); + $found_shipping_classes[ $values['data']->get_shipping_class() ] = ( $values['data']->get_price() * $values['quantity'] ); } - endif; + } } } - $found_shipping_classes = array_unique($found_shipping_classes); + $found_shipping_classes = array_unique( $found_shipping_classes ); // For each found class, add up the costs and fees - foreach ($found_shipping_classes as $shipping_class => $class_price) : - if (isset($this->flat_rates[$shipping_class])) : - $cost += $this->flat_rates[$shipping_class]['cost']; - $fee += $this->get_fee( $this->flat_rates[$shipping_class]['fee'], $class_price ); - else : + foreach ( $found_shipping_classes as $shipping_class => $class_price ) { + if ( isset( $this->flat_rates[ $shipping_class ] ) ) { + $cost += $this->flat_rates[ $shipping_class ]['cost']; + $fee += $this->get_fee( $this->flat_rates[ $shipping_class ]['fee'], $class_price ); + } else { // Class not set so we use default rate $cost += $this->cost; $fee += $this->get_fee( $this->fee, $class_price ); - endif; - endforeach; - + } + } } // Total @@ -318,22 +313,20 @@ class WC_Flat_Rate extends WC_Shipping_Method { // Shipping per item foreach ( $package['contents'] as $item_id => $values ) { - $_product = $values['data']; if ( $values['quantity'] > 0 && $_product->needs_shipping() ) { - $shipping_class = $_product->get_shipping_class(); - if ( isset( $this->flat_rates[$shipping_class] ) ) { - $cost = $this->flat_rates[$shipping_class]['cost']; - $fee = $this->get_fee( $this->flat_rates[$shipping_class]['fee'], $_product->get_price() ); + if ( isset( $this->flat_rates[ $shipping_class ] ) ) { + $cost = $this->flat_rates[ $shipping_class ]['cost']; + $fee = $this->get_fee( $this->flat_rates[ $shipping_class ]['fee'], $_product->get_price() ); } else { $cost = $this->cost; $fee = $this->get_fee( $this->fee, $_product->get_price() ); } - $costs[$item_id] = ( ( $cost + $fee ) * $values['quantity'] ); + $costs[ $item_id ] = ( ( $cost + $fee ) * $values['quantity'] ); } } @@ -357,46 +350,50 @@ class WC_Flat_Rate extends WC_Shipping_Method { $this->generate_settings_html(); ?> - : + : - - - + + + - - + + flat_rates) foreach( $this->flat_rates as $class => $rate ) : $i++; + $i = -1; + if ( $this->flat_rates ) { + foreach ( $this->flat_rates as $class => $rate ) { + $i++; - echo ' - - - - - '; - endforeach; + echo ' + + + + + '; + } + } ?>
[?] [?] [?] [?]
- -
+ +
@@ -449,46 +446,42 @@ class WC_Flat_Rate extends WC_Shipping_Method { } // End admin_options() function process_flat_rates() { - // Save the rates $flat_rate_class = array(); $flat_rate_cost = array(); $flat_rate_fee = array(); $flat_rates = array(); - if (isset($_POST[$this->id . '_class'])) $flat_rate_class = array_map('woocommerce_clean', $_POST[$this->id . '_class']); - if (isset($_POST[$this->id . '_cost'])) $flat_rate_cost = array_map('woocommerce_clean', $_POST[$this->id . '_cost']); - if (isset($_POST[$this->id . '_fee'])) $flat_rate_fee = array_map('woocommerce_clean', $_POST[$this->id . '_fee']); + if ( isset( $_POST[ $this->id . '_class'] ) ) $flat_rate_class = array_map( 'woocommerce_clean', $_POST[ $this->id . '_class'] ); + if ( isset( $_POST[ $this->id . '_cost'] ) ) $flat_rate_cost = array_map( 'woocommerce_clean', $_POST[ $this->id . '_cost'] ); + if ( isset( $_POST[ $this->id . '_fee'] ) ) $flat_rate_fee = array_map( 'woocommerce_clean', $_POST[ $this->id . '_fee'] ); // Get max key $values = $flat_rate_class; - ksort($values); - $value = end($values); - $key = key($values); + ksort( $values ); + $value = end( $values ); + $key = key( $values ); - for ($i=0; $i<=$key; $i++) : - - if (isset($flat_rate_class[$i]) && isset($flat_rate_cost[$i]) && isset($flat_rate_fee[$i])) : + for ( $i = 0; $i <= $key; $i++ ) { + if ( isset( $flat_rate_class[ $i ] ) && isset( $flat_rate_cost[ $i ] ) && isset( $flat_rate_fee[ $i ] ) ) { $flat_rate_cost[$i] = number_format($flat_rate_cost[$i], 2, '.', ''); // Add to flat rates array $flat_rates[ sanitize_title($flat_rate_class[$i]) ] = array( - 'cost' => $flat_rate_cost[$i], - 'fee' => $flat_rate_fee[$i] - ); - - endif; - - endfor; + 'cost' => $flat_rate_cost[ $i ], + 'fee' => $flat_rate_fee[ $i ], + ); + } + } - update_option($this->flat_rate_option, $flat_rates); + update_option( $this->flat_rate_option, $flat_rates ); $this->get_flat_rates(); } function get_flat_rates() { - $this->flat_rates = array_filter((array) get_option($this->flat_rate_option)); + $this->flat_rates = array_filter( (array) get_option( $this->flat_rate_option ) ); } } @@ -497,4 +490,4 @@ function add_flat_rate_method( $methods ) { $methods[] = 'WC_Flat_Rate'; return $methods; } -add_filter('woocommerce_shipping_methods', 'add_flat_rate_method' ); +add_filter( 'woocommerce_shipping_methods', 'add_flat_rate_method' ); diff --git a/readme.txt b/readme.txt index 6469107ec31..446481ea33f 100644 --- a/readme.txt +++ b/readme.txt @@ -1,10 +1,10 @@ -=== WooCommerce – excelling eCommerce === +=== WooCommerce - excelling eCommerce === Contributors: woothemes, mikejolley, jameskoster, CoenJacobs Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, affiliate, store, sales, sell, shop, shopping, cart, checkout, configurable, variable, widgets, reports, download, downloadable, digital, inventory, stock, reports, shipping, tax Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce Requires at least: 3.3 Tested up to: 3.4 -Stable tag: 1.5.5 +Stable tag: 1.5.6 WooCommerce is a powerful, extendable eCommerce plugin that helps you sell anything. Beautifully. @@ -147,15 +147,27 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc == Changelog == -= 1.5.6 = +== + +* Fix - Strange error where detecting the page (is_page etc) would break the canonical redirect in some instances when hooked into 'wp'. Used the later get_header hook instead. + += 1.5.6 - 17/05/2012 = * Feature - Default display for shipping methods is radio buttons. Before, when methods were enabled/disabled based on coupons or customer, changed methods could go unnoticed. Radio options are always visible. * Feature - Option to display shipping methods as a select box vs. radio buttons +* Feature - Added support for cost per order to Flat Rate shipping +* Feature - image support added to sharethis * Tweak - When the count of available shipping methods changes, reset to default * Tweak - Optimisations to monthly and product reports * Tweak - Individually sold variation handling * Tweak - Removed mdash; from shipping options +* Tweak - Made woocommerce_locate_template more useful for third party plugins - ability to pass a full path +* Tweak - WC Debug page hooks +* Tweak - Tidied up installer +* Tweak - Removed unused get_hidden_product_ids * Fix - Google Analytics options fix * Fix - % discount rounding +* Fix - get_stock_quantity returns '' if stock management is off in global settings +* Fix - Prevent error in ecommerce tracking if no categories set = 1.5.5 - 10/05/2012 = * Feature - New 'default' sorting order using menu_order, with drag and drop sorting (based on http://wordpress.org/extend/plugins/simple-page-ordering/) diff --git a/shortcodes/shortcode-order_tracking.php b/shortcodes/shortcode-order_tracking.php index a1ccbc9af7c..8c654d2ed4a 100644 --- a/shortcodes/shortcode-order_tracking.php +++ b/shortcodes/shortcode-order_tracking.php @@ -27,10 +27,10 @@ function woocommerce_order_tracking( $atts ) { $woocommerce->verify_nonce( 'order_tracking' ); - if (isset($_POST['orderid']) && $_POST['orderid'] > 0) $order_id = (int) $_POST['orderid']; else $order_id = 0; + if (isset($_POST['orderid']) && $_POST['orderid']) $order_id = $_POST['orderid']; else $order_id = 0; if (isset($_POST['order_email']) && $_POST['order_email']) $order_email = trim($_POST['order_email']); else $order_email = ''; - $order = new WC_Order( $order_id ); + $order = new WC_Order( apply_filters( 'woocommerce_shortcode_order_tracking_order_id', $order_id ) ); if ($order->id && $order_email) : diff --git a/widgets/widget-best_sellers.php b/widgets/widget-best_sellers.php index 58d3aeed4b9..8b276df22a3 100644 --- a/widgets/widget-best_sellers.php +++ b/widgets/widget-best_sellers.php @@ -68,7 +68,12 @@ class WooCommerce_Widget_Best_Sellers extends WP_Widget { ); if ( isset( $instance['hide_free'] ) && 1 == $instance['hide_free'] ) { - $query_args['meta_query'] = array( array( 'key' => '_price', 'value' => 0, 'compare' => '>' ) ); + $query_args['meta_query'] = array( array( + 'key' => '_price', + 'value' => 0, + 'compare' => '>', + 'type' => 'DECIMAL', + ) ); } $r = new WP_Query($query_args); @@ -125,7 +130,7 @@ class WooCommerce_Widget_Best_Sellers extends WP_Widget { function form( $instance ) { $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; if ( !isset($instance['number']) || !$number = (int) $instance['number'] ) $number = 5; - if ( isset( $instance['hide_free'] ) && 1 == $instance['hide_free'] ) $hide_free_checked = ' checked="checked"'; + $hide_free_checked = ( isset( $instance['hide_free'] ) && 1 == $instance['hide_free'] ) ? ' checked="checked"' : ''; ?>

diff --git a/widgets/widget-featured_products.php b/widgets/widget-featured_products.php index 8538ae4ed9a..d14e746a72c 100644 --- a/widgets/widget-featured_products.php +++ b/widgets/widget-featured_products.php @@ -90,6 +90,7 @@ class WooCommerce_Widget_Featured_Products extends WP_Widget { echo $content; wp_cache_set('widget_featured_products', $cache, 'widget'); + wp_reset_postdata(); } /** @see WP_Widget->update */ diff --git a/woocommerce-core-functions.php b/woocommerce-core-functions.php index aa017bb313e..b85ea463f62 100644 --- a/woocommerce-core-functions.php +++ b/woocommerce-core-functions.php @@ -262,13 +262,13 @@ function woocommerce_get_template_part( $slug, $name = '' ) { /** * Get other templates (e.g. product attributes) passing attributes and including the file */ -function woocommerce_get_template( $template_name, $args = array(), $template_path = '' ) { +function woocommerce_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { global $woocommerce; if ( $args && is_array($args) ) extract( $args ); - $located = woocommerce_locate_template( $template_name, $template_path ); + $located = woocommerce_locate_template( $template_name, $template_path, $default_path ); do_action( 'woocommerce_before_template_part', $template_name, $template_path, $located ); @@ -278,19 +278,33 @@ function woocommerce_get_template( $template_name, $args = array(), $template_pa } /** - * Locate a template and return the path for inclusion + * Locate a template and return the path for inclusion. + * + * This is the load order: + * + * yourtheme / $template_path / $template_name + * yourtheme / $template_name + * $default_path / $template_name */ -function woocommerce_locate_template( $template_name, $template_path = '' ) { +function woocommerce_locate_template( $template_name, $template_path = '', $default_path = '' ) { global $woocommerce; - $template = ( ! empty( $template_path ) ) ? locate_template( array( $template_path . $template_name , $template_name ) ) : ''; - - // Look in yourtheme/woocommerce/template-name and yourtheme/template-name - if ( ! $template ) $template = locate_template( array( $woocommerce->template_url . $template_name , $template_name ) ); + if ( ! $template_path ) $template_path = $woocommerce->template_url; + if ( ! $default_path ) $default_path = $woocommerce->plugin_path() . '/templates/'; - // Get default template - if ( ! $template ) $template = $woocommerce->plugin_path() . '/templates/' . $template_name; + // Look within passed path within the theme - this is priority + $template = locate_template( + array( + $template_path . $template_name, + $template_name + ) + ); + // Get default template + if ( ! $template ) + $template = $default_path . $template_name; + + // Return what we found return apply_filters('woocommerce_locate_template', $template, $template_name, $template_path); } diff --git a/woocommerce-hooks.php b/woocommerce-hooks.php index ec8ad178e27..8de46f3b225 100644 --- a/woocommerce-hooks.php +++ b/woocommerce-hooks.php @@ -102,7 +102,7 @@ if ( !is_admin() || defined('DOING_AJAX') ) { /* Shop Page Handling and Support */ add_action( 'template_redirect', 'woocommerce_redirects' ); add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_item_classes', 2, 20 ); -add_action( 'wp', 'woocommerce_front_page_archive_paging_fix', 1 ); +add_action( 'get_header', 'woocommerce_front_page_archive_paging_fix', 1 ); add_action( 'woocommerce_before_shop_loop', 'woocommerce_front_page_archive', 1 ); add_filter( 'wp_list_pages', 'woocommerce_list_pages' ); @@ -111,7 +111,7 @@ add_filter( 'wp_nav_menu_items', 'woocommerce_nav_menu_items', 10, 2 ); /* Clear the cart */ if (get_option('woocommerce_clear_cart_on_logout')=='yes') add_action( 'wp_logout', 'woocommerce_empty_cart' ); -add_action( 'wp', 'woocommerce_clear_cart_after_payment' ); +add_action( 'get_header', 'woocommerce_clear_cart_after_payment' ); /* Disable admin bar */ add_action( 'init', 'woocommerce_disable_admin_bar' ); diff --git a/woocommerce.php b/woocommerce.php index a8a6cfb7642..a97cd7575c8 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce * Plugin URI: http://www.woothemes.com/woocommerce/ * Description: An e-commerce toolkit that helps you sell anything. Beautifully. - * Version: 1.5.5 + * Version: 1.5.6 * Author: WooThemes * Author URI: http://woothemes.com * Requires at least: 3.3 @@ -32,7 +32,7 @@ class Woocommerce { /** Version ***************************************************************/ - var $version = '1.5.5'; + var $version = '1.5.6'; /** URLS ******************************************************************/ @@ -220,7 +220,7 @@ class Woocommerce { add_filter( 'template_include', array(&$this, 'template_loader') ); add_filter( 'comments_template', array(&$this, 'comments_template_loader') ); add_filter( 'wp_redirect', array(&$this, 'redirect'), 1, 2 ); - add_action( 'wp', array(&$this, 'buffer_checkout') ); + add_action( 'get_header', array(&$this, 'buffer_checkout') ); add_action( 'wp_enqueue_scripts', array(&$this, 'frontend_scripts') ); add_action( 'wp_head', array(&$this, 'generator') ); add_action( 'wp_head', array(&$this, 'wp_head') ); @@ -239,7 +239,7 @@ class Woocommerce { // Actions for SSL if ( ! is_admin() || defined('DOING_AJAX') ) { - add_action( 'wp', array( &$this, 'ssl_redirect' ) ); + add_action( 'get_header', array( &$this, 'ssl_redirect' ) ); $filters = array( 'post_thumbnail_html', 'widget_text', 'wp_get_attachment_url', 'wp_get_attachment_image_attributes', 'wp_get_attachment_url', 'option_siteurl', 'option_homeurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src', 'style_loader_src', 'template_directory_uri', 'stylesheet_directory_uri', 'site_url' ); foreach ( $filters as $filter ) add_filter( $filter, array( &$this, 'force_ssl') );