Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Diego Zanella 2015-03-25 16:56:50 +00:00
commit 32b0684a93
48 changed files with 535 additions and 150 deletions

View File

@ -227,10 +227,8 @@
margin-left: -.5em;
margin-top: -.5em;
display: block;
-webkit-animation: spin 1s ease-in-out infinite;
-moz-animation: spin 1s ease-in-out infinite;
animation: spin 1s ease-in-out infinite;
content: "";
@include animation( spin 1s ease-in-out infinite );
background: url(../images/icons/loader.svg) center center;
background-size: cover;
line-height: 1;

View File

@ -1 +1 @@
.woocommerce-message{overflow:hidden;position:relative;border-left-color:#cc99c2!important}.woocommerce-message a.button-primary,p.woocommerce-actions a.button-primary{background:#cc99c2;border-color:#b366a4;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);color:#fff}.woocommerce-message a.button-primary:hover,p.woocommerce-actions a.button-primary:hover{background:#bb77ae;border-color:#aa559a;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15)}.woocommerce-message a.button-primary:active,p.woocommerce-actions a.button-primary:active{background:#aa559a;border-color:#aa559a}.woocommerce-message a.docs,.woocommerce-message a.skip,p.woocommerce-actions a.docs,p.woocommerce-actions a.skip{opacity:.5;text-decoration:none!important}.woocommerce-message a.docs:focus,.woocommerce-message a.docs:hover,.woocommerce-message a.skip:focus,.woocommerce-message a.skip:hover,p.woocommerce-actions a.docs:focus,p.woocommerce-actions a.docs:hover,p.woocommerce-actions a.skip:focus,p.woocommerce-actions a.skip:hover{opacity:1}.woocommerce-message a.button-primary,.woocommerce-message a.button-secondary,p.woocommerce-actions a.button-primary,p.woocommerce-actions a.button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-left:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}
.woocommerce-message{overflow:hidden;position:relative;border-left-color:#cc99c2!important}.woocommerce-message a.button-primary,p.woocommerce-actions a.button-primary{background:#cc99c2;border-color:#b366a4;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);color:#fff}.woocommerce-message a.button-primary:hover,p.woocommerce-actions a.button-primary:hover{background:#bb77ae;border-color:#aa559a;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15)}.woocommerce-message a.button-primary:active,p.woocommerce-actions a.button-primary:active{background:#aa559a;border-color:#aa559a}.woocommerce-message a.docs,.woocommerce-message a.skip,p.woocommerce-actions a.docs,p.woocommerce-actions a.skip{opacity:.5}.woocommerce-message a.docs:focus,.woocommerce-message a.docs:hover,.woocommerce-message a.skip:focus,.woocommerce-message a.skip:hover,p.woocommerce-actions a.docs:focus,p.woocommerce-actions a.docs:hover,p.woocommerce-actions a.skip:focus,p.woocommerce-actions a.skip:hover{opacity:1}.woocommerce-message a.button-primary,.woocommerce-message a.button-secondary,p.woocommerce-actions a.button-primary,p.woocommerce-actions a.button-secondary{text-decoration:none!important}.woocommerce-message .twitter-share-button,p.woocommerce-actions .twitter-share-button{margin-top:-3px;margin-left:3px;vertical-align:middle}.woocommerce-about-text,p.woocommerce-actions{margin-bottom:1em!important}

View File

@ -42,7 +42,6 @@ p.woocommerce-actions,
a.skip,
a.docs {
opacity: 0.5;
text-decoration: none !important;
&:hover, &:focus {
opacity: 1;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -215,6 +215,8 @@
} else {
$reset_variations.css( 'visibility', 'hidden' );
$sku = $( this ).closest( '.product' ).find( '.sku' );
$sku.text( $sku.attr( 'data-o_sku' ) );
}

File diff suppressed because one or more lines are too long

View File

@ -18,9 +18,7 @@ jQuery( function( $ ) {
$thisbutton.removeClass( 'added' );
$thisbutton.addClass( 'loading' );
var data = {
action: 'woocommerce_add_to_cart',
};
var data = {};
$.each( $thisbutton.data(), function( key, value ) {
data[key] = value;
@ -30,7 +28,7 @@ jQuery( function( $ ) {
$( 'body' ).trigger( 'adding_to_cart', [ $thisbutton, data ] );
// Ajax action
$.post( wc_add_to_cart_params.ajax_url, data, function( response ) {
$.post( wc_add_to_cart_params.wc_ajax_url + 'add_to_cart', data, function( response ) {
if ( ! response )
return;

View File

@ -1 +1 @@
jQuery(function(a){return"undefined"==typeof wc_add_to_cart_params?!1:void a(document).on("click",".add_to_cart_button",function(){var b=a(this);if(b.is(".product_type_simple")){if(!b.attr("data-product_id"))return!0;b.removeClass("added"),b.addClass("loading");var c={action:"woocommerce_add_to_cart"};return a.each(b.data(),function(a,b){c[a]=b}),a("body").trigger("adding_to_cart",[b,c]),a.post(wc_add_to_cart_params.ajax_url,c,function(c){if(c){var d=window.location.toString();return d=d.replace("add-to-cart","added-to-cart"),c.error&&c.product_url?void(window.location=c.product_url):"yes"===wc_add_to_cart_params.cart_redirect_after_add?void(window.location=wc_add_to_cart_params.cart_url):(b.removeClass("loading"),fragments=c.fragments,cart_hash=c.cart_hash,fragments&&a.each(fragments,function(b){a(b).addClass("updating")}),a(".shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}}),b.addClass("added"),wc_add_to_cart_params.is_cart||0!==b.parent().find(".added_to_cart").size()||b.after(' <a href="'+wc_add_to_cart_params.cart_url+'" class="added_to_cart wc-forward" title="'+wc_add_to_cart_params.i18n_view_cart+'">'+wc_add_to_cart_params.i18n_view_cart+"</a>"),fragments&&a.each(fragments,function(b,c){a(b).replaceWith(c)}),a(".widget_shopping_cart, .updating").stop(!0).css("opacity","1").unblock(),a(".shop_table.cart").load(d+" .shop_table.cart:eq(0) > *",function(){a(".shop_table.cart").stop(!0).css("opacity","1").unblock(),a("body").trigger("cart_page_refreshed")}),a(".cart_totals").load(d+" .cart_totals:eq(0) > *",function(){a(".cart_totals").stop(!0).css("opacity","1").unblock()}),a("body").trigger("added_to_cart",[fragments,cart_hash,b]),void 0)}}),!1}return!0})});
jQuery(function(a){return"undefined"==typeof wc_add_to_cart_params?!1:void a(document).on("click",".add_to_cart_button",function(){var b=a(this);if(b.is(".product_type_simple")){if(!b.attr("data-product_id"))return!0;b.removeClass("added"),b.addClass("loading");var c={};return a.each(b.data(),function(a,b){c[a]=b}),a("body").trigger("adding_to_cart",[b,c]),a.post(wc_add_to_cart_params.wc_ajax_url+"add_to_cart",c,function(c){if(c){var d=window.location.toString();return d=d.replace("add-to-cart","added-to-cart"),c.error&&c.product_url?void(window.location=c.product_url):"yes"===wc_add_to_cart_params.cart_redirect_after_add?void(window.location=wc_add_to_cart_params.cart_url):(b.removeClass("loading"),fragments=c.fragments,cart_hash=c.cart_hash,fragments&&a.each(fragments,function(b){a(b).addClass("updating")}),a(".shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}}),b.addClass("added"),wc_add_to_cart_params.is_cart||0!==b.parent().find(".added_to_cart").size()||b.after(' <a href="'+wc_add_to_cart_params.cart_url+'" class="added_to_cart wc-forward" title="'+wc_add_to_cart_params.i18n_view_cart+'">'+wc_add_to_cart_params.i18n_view_cart+"</a>"),fragments&&a.each(fragments,function(b,c){a(b).replaceWith(c)}),a(".widget_shopping_cart, .updating").stop(!0).css("opacity","1").unblock(),a(".shop_table.cart").load(d+" .shop_table.cart:eq(0) > *",function(){a(".shop_table.cart").stop(!0).css("opacity","1").unblock(),a("body").trigger("cart_page_refreshed")}),a(".cart_totals").load(d+" .cart_totals:eq(0) > *",function(){a(".cart_totals").stop(!0).css("opacity","1").unblock()}),a("body").trigger("added_to_cart",[fragments,cart_hash,b]),void 0)}}),!1}return!0})});

View File

@ -16,9 +16,8 @@ jQuery( function( $ ) {
}
$fragment_refresh = {
url: wc_cart_fragments_params.ajax_url,
url: wc_cart_fragments_params.wc_ajax_url + 'get_refreshed_fragments',
type: 'POST',
data: { action: 'woocommerce_get_refreshed_fragments' },
success: function( data ) {
if ( data && data.fragments ) {

View File

@ -1 +1 @@
jQuery(function(a){if("undefined"==typeof wc_cart_fragments_params)return!1;try{$supports_html5_storage="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc")}catch(b){$supports_html5_storage=!1}if($fragment_refresh={url:wc_cart_fragments_params.ajax_url,type:"POST",data:{action:"woocommerce_get_refreshed_fragments"},success:function(b){b&&b.fragments&&(a.each(b.fragments,function(b,c){a(b).replaceWith(c)}),$supports_html5_storage&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(b.fragments)),sessionStorage.setItem("wc_cart_hash",b.cart_hash)),a("body").trigger("wc_fragments_refreshed"))}},$supports_html5_storage){a("body").bind("added_to_cart",function(a,b,c){sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(b)),sessionStorage.setItem("wc_cart_hash",c)});try{var c=a.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),d=sessionStorage.getItem("wc_cart_hash"),e=a.cookie("woocommerce_cart_hash");if((null===d||void 0===d||""===d)&&(d=""),(null===e||void 0===e||""===e)&&(e=""),!c||!c["div.widget_shopping_cart_content"]||d!=e)throw"No fragment";a.each(c,function(b,c){a(b).replaceWith(c)}),a("body").trigger("wc_fragments_loaded")}catch(b){a.ajax($fragment_refresh)}}else a.ajax($fragment_refresh);a.cookie("woocommerce_items_in_cart")>0?a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),a("body").bind("adding_to_cart",function(){a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})});
jQuery(function(a){if("undefined"==typeof wc_cart_fragments_params)return!1;try{$supports_html5_storage="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc")}catch(b){$supports_html5_storage=!1}if($fragment_refresh={url:wc_cart_fragments_params.wc_ajax_url+"get_refreshed_fragments",type:"POST",success:function(b){b&&b.fragments&&(a.each(b.fragments,function(b,c){a(b).replaceWith(c)}),$supports_html5_storage&&(sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(b.fragments)),sessionStorage.setItem("wc_cart_hash",b.cart_hash)),a("body").trigger("wc_fragments_refreshed"))}},$supports_html5_storage){a("body").bind("added_to_cart",function(a,b,c){sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(b)),sessionStorage.setItem("wc_cart_hash",c)});try{var c=a.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),d=sessionStorage.getItem("wc_cart_hash"),e=a.cookie("woocommerce_cart_hash");if((null===d||void 0===d||""===d)&&(d=""),(null===e||void 0===e||""===e)&&(e=""),!c||!c["div.widget_shopping_cart_content"]||d!=e)throw"No fragment";a.each(c,function(b,c){a(b).replaceWith(c)}),a("body").trigger("wc_fragments_loaded")}catch(b){a.ajax($fragment_refresh)}}else a.ajax($fragment_refresh);a.cookie("woocommerce_items_in_cart")>0?a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show():a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").hide(),a("body").bind("adding_to_cart",function(){a(".hide_cart_widget_if_empty").closest(".widget_shopping_cart").show()})});

View File

@ -27,12 +27,11 @@ jQuery( function( $ ) {
});
var data = {
action: 'woocommerce_update_shipping_method',
security: wc_cart_params.update_shipping_method_nonce,
shipping_method: shipping_methods
};
$.post( wc_cart_params.ajax_url, data, function( response ) {
$.post( wc_cart_params.wc_ajax_url + 'update_shipping_method', data, function( response ) {
$( 'div.cart_totals' ).replaceWith( response );
$( 'body' ).trigger( 'updated_shipping_method' );

View File

@ -1 +1 @@
jQuery(function(a){return"undefined"==typeof wc_cart_params?!1:(a(document).on("click",".shipping-calculator-button",function(){return a(".shipping-calculator-form").slideToggle("slow"),!1}).on("change","select.shipping_method, input[name^=shipping_method]",function(){var b=[];a("select.shipping_method, input[name^=shipping_method][type=radio]:checked, input[name^=shipping_method][type=hidden]").each(function(){b[a(this).data("index")]=a(this).val()}),a("div.cart_totals").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var c={action:"woocommerce_update_shipping_method",security:wc_cart_params.update_shipping_method_nonce,shipping_method:b};a.post(wc_cart_params.ajax_url,c,function(b){a("div.cart_totals").replaceWith(b),a("body").trigger("updated_shipping_method")})}),void a(".shipping-calculator-form").hide())});
jQuery(function(a){return"undefined"==typeof wc_cart_params?!1:(a(document).on("click",".shipping-calculator-button",function(){return a(".shipping-calculator-form").slideToggle("slow"),!1}).on("change","select.shipping_method, input[name^=shipping_method]",function(){var b=[];a("select.shipping_method, input[name^=shipping_method][type=radio]:checked, input[name^=shipping_method][type=hidden]").each(function(){b[a(this).data("index")]=a(this).val()}),a("div.cart_totals").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var c={security:wc_cart_params.update_shipping_method_nonce,shipping_method:b};a.post(wc_cart_params.wc_ajax_url+"update_shipping_method",c,function(b){a("div.cart_totals").replaceWith(b),a("body").trigger("updated_shipping_method")})}),void a(".shipping-calculator-form").hide())});

View File

@ -220,7 +220,6 @@ jQuery( function( $ ) {
});
var data = {
action: 'woocommerce_update_order_review',
security: wc_checkout_params.update_order_review_nonce,
shipping_method: shipping_methods,
payment_method: payment_method,
@ -241,7 +240,7 @@ jQuery( function( $ ) {
wc_checkout_form.xhr = $.ajax({
type: 'POST',
url: wc_checkout_params.ajax_url,
url: wc_checkout_params.wc_ajax_url + 'update_order_review',
data: data,
success: function( data ) {
// Always update the fragments
@ -420,14 +419,13 @@ jQuery( function( $ ) {
});
var data = {
action: 'woocommerce_apply_coupon',
security: wc_checkout_params.apply_coupon_nonce,
coupon_code: $form.find( 'input[name=coupon_code]' ).val()
};
$.ajax({
type: 'POST',
url: wc_checkout_params.ajax_url,
url: wc_checkout_params.wc_ajax_url + 'apply_coupon',
data: data,
success: function( code ) {
$( '.woocommerce-error, .woocommerce-message' ).remove();
@ -460,14 +458,13 @@ jQuery( function( $ ) {
});
var data = {
action: 'woocommerce_remove_coupon',
security: wc_checkout_params.remove_coupon_nonce,
coupon: coupon
};
$.ajax({
type: 'POST',
url: wc_checkout_params.ajax_url,
url: wc_checkout_params.wc_ajax_url + 'remove_coupon',
data: data,
success: function( code ) {
$( '.woocommerce-error, .woocommerce-message' ).remove();

File diff suppressed because one or more lines are too long

View File

@ -834,7 +834,7 @@ abstract class WC_Abstract_Order {
}
// Orders store the state of prices including tax when created
$this->prices_include_tax = metadata_exists( 'post', $this->id, '_prices_include_tax' ) ? get_post_meta( $this->id, '_prices_include_tax', true ) : $this->prices_include_tax;
$this->prices_include_tax = metadata_exists( 'post', $this->id, '_prices_include_tax' ) ? get_post_meta( $this->id, '_prices_include_tax', true ) === 'yes' : $this->prices_include_tax;
}
/**

View File

@ -56,13 +56,6 @@ class WC_Product {
*/
public $product_type = null;
/**
* String of dimensions (imploded with X)
*
* @var string
*/
protected $dimensions = '';
/**
* Prouduct shipping class
*
@ -604,7 +597,7 @@ class WC_Product {
* @return bool
*/
public function has_enough_stock( $quantity ) {
return ! $this->managing_stock() || $this->backorders_allowed() || $this->stock >= $quantity ? true : false;
return ! $this->managing_stock() || $this->backorders_allowed() || $this->get_stock_quantity() >= $quantity ? true : false;
}
/**
@ -724,15 +717,6 @@ class WC_Product {
return apply_filters( 'woocommerce_product_is_on_sale', ( $this->get_sale_price() !== $this->get_regular_price() && $this->get_sale_price() === $this->get_price() ), $this );
}
/**
* Returns the product's weight.
* @todo refactor filters in this class to naming woocommerce_product_METHOD
* @return string
*/
public function get_weight() {
return apply_filters( 'woocommerce_product_get_weight', $this->weight ? $this->weight : '' );
}
/**
* Returns false if the product cannot be bought.
*
@ -1401,6 +1385,39 @@ class WC_Product {
return $this->get_dimensions() ? true : false;
}
/**
* Returns the product length.
* @return string
*/
public function get_length() {
return apply_filters( 'woocommerce_product_length', $this->length ? $this->length : '', $this );
}
/**
* Returns the product width.
* @return string
*/
public function get_width() {
return apply_filters( 'woocommerce_product_width', $this->width ? $this->width : '', $this );
}
/**
* Returns the product height.
* @return string
*/
public function get_height() {
return apply_filters( 'woocommerce_product_height', $this->height ? $this->height : '', $this );
}
/**
* Returns the product's weight.
* @todo refactor filters in this class to naming woocommerce_product_METHOD
* @return string
*/
public function get_weight() {
return apply_filters( 'woocommerce_product_weight', apply_filters( 'woocommerce_product_get_weight', $this->weight ? $this->weight : '' ), $this );
}
/**
* Returns whether or not the product has weight set.
*
@ -1411,36 +1428,21 @@ class WC_Product {
}
/**
* Returns dimensions.
*
* Returns formatted dimensions.
* @return string
*/
public function get_dimensions() {
$dimensions = implode( ' x ', array_filter( array(
$this->get_length(),
$this->get_width(),
$this->get_height(),
) ) );
if ( ! $this->dimensions ) {
$dimensions = array();
if ( $this->length ) {
$dimensions[] = $this->length;
}
if ( $this->width ) {
$dimensions[] = $this->width;
}
if ( $this->height ){
$dimensions[] = $this->height;
}
$this->dimensions = implode( ' x ', $dimensions );
if ( ! empty( $this->dimensions ) ) {
$this->dimensions .= ' ' . get_option( 'woocommerce_dimension_unit' );
}
if ( ! empty( $dimensions ) ) {
$dimensions .= ' ' . get_option( 'woocommerce_dimension_unit' );
}
return $this->dimensions;
return apply_filters( 'woocommerce_product_dimensions', $dimensions, $this );
}
/**

View File

@ -22,6 +22,7 @@ class WC_Admin_Taxonomies {
* Constructor
*/
public function __construct() {
global $wc_product_attributes;
// Category/term ordering
add_action( 'create_term', array( $this, 'create_term' ), 5, 3 );
@ -41,6 +42,10 @@ class WC_Admin_Taxonomies {
add_action( 'product_cat_pre_add_form', array( $this, 'product_cat_description' ) );
add_action( 'product_shipping_class_pre_add_form', array( $this, 'shipping_class_description' ) );
foreach ( array_keys( $wc_product_attributes ) as $attribute ) {
add_action( $attribute . '_pre_add_form', array( $this, 'product_attribute_description' ) );
}
// Maintain hierarchy of terms
add_filter( 'wp_terms_checklist_args', array( $this, 'disable_checked_ontop' ) );
}
@ -53,7 +58,6 @@ class WC_Admin_Taxonomies {
* @param mixed $taxonomy
*/
public function create_term( $term_id, $tt_id = '', $taxonomy = '' ) {
if ( $taxonomy != 'product_cat' && ! taxonomy_is_product_attribute( $taxonomy ) ) {
return;
}
@ -69,15 +73,13 @@ class WC_Admin_Taxonomies {
* @param mixed $term_id
*/
public function delete_term( $term_id ) {
$term_id = (int) $term_id;
if ( ! $term_id ) {
return;
}
global $wpdb;
$wpdb->query( "DELETE FROM {$wpdb->woocommerce_termmeta} WHERE `woocommerce_term_id` = " . $term_id );
$term_id = absint( $term_id );
if ( $term_id ) {
$wpdb->delete( $wpdb->woocommerce_termmeta, array( 'woocommerce_term_id' => $term_id ), array( '%d' ) );
}
}
/**
@ -272,6 +274,13 @@ class WC_Admin_Taxonomies {
echo wpautop( __( 'Shipping classes can be used to group products of similar type. These groups can then be used by certain shipping methods to provide different rates to different products.', 'woocommerce' ) );
}
/**
* Description for shipping class page to aid users.
*/
public function product_attribute_description() {
echo wpautop( __( 'Attribute terms can be assigned to products and variations.<br/><br/><b>Note</b>: Deleting a term will remove it from all products and variations to which it has been assigned. Recreating a term will not automatically assign it back to products.', 'woocommerce' ) );
}
/**
* Thumbnail column added to category admin.
*

View File

@ -42,7 +42,7 @@ class WC_Meta_Box_Order_Actions {
<optgroup label="<?php _e( 'Resend order emails', 'woocommerce' ); ?>">
<?php
$mailer = WC()->mailer();
$available_emails = apply_filters( 'woocommerce_resend_order_emails_available', array( 'new_order', 'cancelled_order', 'customer_processing_order', 'customer_completed_order', 'customer_invoice' ) );
$available_emails = apply_filters( 'woocommerce_resend_order_emails_available', array( 'new_order', 'cancelled_order', 'customer_processing_order', 'customer_completed_order', 'customer_invoice', 'customer_refunded_order' ) );
$mails = $mailer->get_emails();
if ( ! empty( $mails ) ) {

View File

@ -335,7 +335,7 @@ class WC_Meta_Box_Order_Data {
}
if ( apply_filters( 'woocommerce_enable_order_notes_field', 'yes' == get_option( 'woocommerce_enable_order_comments', 'yes' ) ) && $post->post_excerpt ) {
echo '<p><strong>' . __( 'Customer Note', 'woocommerce' ) . ':</strong> ' . nl2br( esc_html( $post->post_excerpt ) ) . '</p>';
echo '<p><strong>' . __( 'Customer Provided Note', 'woocommerce' ) . ':</strong> ' . nl2br( esc_html( $post->post_excerpt ) ) . '</p>';
}
echo '</div>';
@ -365,7 +365,7 @@ class WC_Meta_Box_Order_Data {
if ( apply_filters( 'woocommerce_enable_order_notes_field', 'yes' == get_option( 'woocommerce_enable_order_comments', 'yes' ) ) ) {
?>
<p class="form-field form-field-wide"><label for="excerpt"><?php _e( 'Customer Note:', 'woocommerce' ) ?></label>
<p class="form-field form-field-wide"><label for="excerpt"><?php _e( 'Customer Provided Note', 'woocommerce' ) ?>:</label>
<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php _e( 'Customer\'s notes about the order', 'woocommerce' ); ?>"><?php echo wp_kses_post( $post->post_excerpt ); ?></textarea></p>
<?php
}

View File

@ -72,8 +72,8 @@ class WC_Meta_Box_Order_Notes {
</p>
<p>
<select name="order_note_type" id="order_note_type">
<option value="customer"><?php _e( 'Customer note', 'woocommerce' ); ?></option>
<option value=""><?php _e( 'Private note', 'woocommerce' ); ?></option>
<option value="customer"><?php _e( 'Note to customer', 'woocommerce' ); ?></option>
</select>
<a href="#" class="add_note button"><?php _e( 'Add', 'woocommerce' ); ?></a>
</p>

View File

@ -1233,7 +1233,7 @@ class WC_Meta_Box_Product_Data {
for ( $i = 0; $i < $file_url_size; $i ++ ) {
if ( ! empty( $file_urls[ $i ] ) ) {
$file_url = ( 0 === strpos( $file_urls[ $i ], '[' ) && 0 !== strpos( $file_urls[ $i ], 'http' ) ) ? wc_clean( $file_urls[ $i ] ) : esc_url_raw( $file_urls[ $i ] );
$file_url = ( 0 !== strpos( $file_urls[ $i ], 'http' ) ) ? wc_clean( $file_urls[ $i ] ) : esc_url_raw( $file_urls[ $i ] );
$file_name = wc_clean( $file_names[ $i ] );
$file_hash = md5( $file_url );
$files[ $file_hash ] = array(

View File

@ -68,13 +68,24 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
array( 'title' => __( 'Checkout Process', 'woocommerce' ), 'type' => 'title', 'id' => 'checkout_process_options' ),
array(
'title' => __( 'Coupons', 'woocommerce' ),
'desc' => __( 'Enable the use of coupons', 'woocommerce' ),
'id' => 'woocommerce_enable_coupons',
'default' => 'yes',
'type' => 'checkbox',
'desc_tip' => __( 'Coupons can be applied from the cart and checkout pages.', 'woocommerce' ),
'autoload' => false
'title' => __( 'Coupons', 'woocommerce' ),
'desc' => __( 'Enable the use of coupons', 'woocommerce' ),
'id' => 'woocommerce_enable_coupons',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'desc_tip' => __( 'Coupons can be applied from the cart and checkout pages.', 'woocommerce' ),
'autoload' => false
),
array(
'desc' => __( 'Calculate coupon discounts sequentially', 'woocommerce' ),
'id' => 'woocommerce_calc_discounts_sequentially',
'default' => 'no',
'type' => 'checkbox',
'desc_tip' => __( 'When applying multiple coupons, apply the first coupon to the full price and the second coupon to the discounted price and so on.', 'woocommerce' ),
'checkboxgroup' => 'end',
'autoload' => false
),
array(

View File

@ -4,7 +4,7 @@
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit;
}
$plugin_slug = 'woocommerce-colors';
@ -14,10 +14,9 @@ if ( current_user_can( 'install_plugins' ) ) {
} else {
$url = 'http://wordpress.org/plugins/' . $plugin_slug;
}
?>
?>
<div id="message" class="updated woocommerce-message wc-connect">
<p><?php _e( '<strong>The Frontend Style options are deprecated</strong> &#8211; If you want to continue editing the colors of your store we recommended that you install the replacement WooCommerce Colors plugin from WordPress.org.', 'woocommerce' ); ?></p>
<p class="submit"><a href="<?php echo esc_url( $url ); ?>" class="wc-update-now button-primary"><?php _e( 'Install the new WooCommerce Colors plugin', 'woocommerce' ); ?></a> <a class="skip button" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'frontend_colors' ) ); ?>"><?php _e( 'Hide this notice', 'woocommerce' ); ?></a></p>
<p class="submit"><a href="<?php echo esc_url( $url ); ?>" class="button-primary"><?php _e( 'Install the new WooCommerce Colors plugin', 'woocommerce' ); ?></a> <a class="button-secondary skip" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'frontend_colors' ) ); ?>"><?php _e( 'Hide This Notice', 'woocommerce' ); ?></a></p>
</div>

View File

@ -4,12 +4,11 @@
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit;
}
?>
<div id="message" class="updated woocommerce-message wc-connect">
<p><?php _e( '<strong>Welcome to WooCommerce</strong> &#8211; You\'re almost ready to start selling :)', 'woocommerce' ); ?></p>
<p class="submit"><a href="<?php echo esc_url( add_query_arg( 'install_woocommerce_pages', 'true', admin_url( 'admin.php?page=wc-settings' ) ) ); ?>" class="button-primary"><?php _e( 'Install WooCommerce Pages', 'woocommerce' ); ?></a> <a class="skip button" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'install' ) ); ?>"><?php _e( 'Skip setup', 'woocommerce' ); ?></a></p>
<p class="submit"><a href="<?php echo esc_url( add_query_arg( 'install_woocommerce_pages', 'true', admin_url( 'admin.php?page=wc-settings' ) ) ); ?>" class="button-primary"><?php _e( 'Install WooCommerce Pages', 'woocommerce' ); ?></a> <a class="button-secondary skip" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'install' ) ); ?>"><?php _e( 'Skip Setup', 'woocommerce' ); ?></a></p>
</div>

View File

@ -4,12 +4,11 @@
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit;
}
?>
<div id="message" class="updated woocommerce-message wc-connect">
<p><?php _e( '<strong>Your theme has bundled outdated copies of WooCommerce template files.</strong> If you notice an issue on your site, this could be the reason. Please contact your theme developer for further assistance. You can review the System Status report for full details or <a href="http://docs.woothemes.com/document/template-structure/" target="_blank">learn more about WooCommerce Template Structure here</a>.', 'woocommerce' ); ?></p>
<p class="submit"><a class="button-primary" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-status' ) ); ?>"><?php _e( 'System Status', 'woocommerce' ); ?></a> <a class="skip button-primary" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'template_files' ) ); ?>"><?php _e( 'Hide this notice', 'woocommerce' ); ?></a></p>
<p class="submit"><a class="button-primary" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-status' ) ); ?>"><?php _e( 'System Status', 'woocommerce' ); ?></a> <a class="button-secondary skip" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'template_files' ) ); ?>"><?php _e( 'Hide This Notice', 'woocommerce' ); ?></a></p>
</div>

View File

@ -4,16 +4,15 @@
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit;
}
?>
<div id="message" class="updated woocommerce-message wc-connect">
<p><?php printf( __( '<strong>Your theme does not declare WooCommerce support</strong> &#8211; Please read our integration guide or check out our %sStorefront%s theme which is totally free to download and designed specifically for use with WooCommerce :)', 'woocommerce' ), '<a href="' . esc_url( admin_url( 'theme-install.php?theme=storefront' ) ) . '">', '</a>' ); ?></p>
<p class="submit">
<a href="http://www.woothemes.com/storefront/?utm_source=wpadmin&utm_medium=notice&utm_campaign=Storefront" class="button-primary" target="_blank"><?php _e( 'Find out more about Storefront', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'http://docs.woothemes.com/document/third-party-custom-theme-compatibility/', 'theme-compatibility' ) ); ?>" class="button" target="_blank"><?php _e( 'Theme integration guide', 'woocommerce' ); ?></a>
<a class="skip button" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'theme_support' ) ); ?>"><?php _e( 'Hide this notice', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'http://docs.woothemes.com/document/third-party-custom-theme-compatibility/', 'theme-compatibility' ) ); ?>" class="button-secondary" target="_blank"><?php _e( 'Theme Integration Guide', 'woocommerce' ); ?></a>
<a class="button-secondary skip" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'theme_support' ) ); ?>"><?php _e( 'Hide This Notice', 'woocommerce' ); ?></a>
</p>
</div>

View File

@ -5,11 +5,12 @@
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div id="message" class="updated woocommerce-message woocommerce-tracker">
<p><?php printf( __( 'Want to help make WooCommerce even more awesome? Allow WooThemes to collect non-sensitive diagnostic data and usage information, and get %s discount on your next WooThemes purchase. %sFind out more%s.', 'woocommerce' ), '20%', '<a href="http://www.woothemes.com/woocommerce/usage-tracking/" target="_blank">', '</a>' ); ?></p>
<p class="submit">
<a class="button-primary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc_tracker_optin', 'true' ), 'wc_tracker_optin', 'wc_tracker_nonce' ) ); ?>"><?php _e( 'Allow', 'woocommerce' ); ?></a>
<a class="skip button" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'tracking' ) ); ?>"><?php _e( 'No, do not bother me again', 'woocommerce' ); ?></a>
<a class="button-secondary skip" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'tracking' ) ); ?>"><?php _e( 'No, do not bother me again', 'woocommerce' ); ?></a>
</p>
</div>

View File

@ -4,10 +4,10 @@
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit;
}
?>
?>
<div id="message" class="updated woocommerce-message wc-connect">
<p><?php printf( __( '<strong>WooCommerce Translation Available</strong> &#8211; Install or update your <code>%s</code> translation to version <code>%s</code>.', 'woocommerce' ), get_locale(), WC_VERSION ); ?></p>
@ -16,8 +16,8 @@ if ( ! defined( 'ABSPATH' ) ) {
<a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=translation_upgrade' ), 'debug_action' ) ); ?>" class="button-primary"><?php _e( 'Update Translation', 'woocommerce' ); ?></a>
<?php else : ?>
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'do-translation-upgrade' ), admin_url( 'update-core.php' ) ), 'upgrade-translations' ) ); ?>" class="button-primary"><?php _e( 'Update Translation', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=translation_upgrade' ), 'debug_action' ) ); ?>" class="button-primary"><?php _e( 'Force Update Translation', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=translation_upgrade' ), 'debug_action' ) ); ?>" class="button-secondary"><?php _e( 'Force Update Translation', 'woocommerce' ); ?></a>
<?php endif; ?>
<a href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'translation_upgrade' ) ); ?>" class="button"><?php _e( 'Hide This Message', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'translation_upgrade' ) ); ?>" class="button-secondary skip"><?php _e( 'Hide This Notice', 'woocommerce' ); ?></a>
</p>
</div>

View File

@ -4,11 +4,10 @@
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit;
}
?>
<div id="message" class="updated woocommerce-message wc-connect">
<p><?php _e( '<strong>WooCommerce Data Update Required</strong> &#8211; We just need to update your install to the latest version', 'woocommerce' ); ?></p>
<p class="submit"><a href="<?php echo esc_url( add_query_arg( 'do_update_woocommerce', 'true', admin_url( 'admin.php?page=wc-settings' ) ) ); ?>" class="wc-update-now button-primary"><?php _e( 'Run the updater', 'woocommerce' ); ?></a></p>

View File

@ -387,14 +387,8 @@ class WC_API_Products extends WC_API_Resource {
return $id;
}
$args = array(
'post_id' => $id,
'approve' => 'approve',
);
$comments = get_comments( $args );
$reviews = array();
$comments = get_approved_comments( $id );
$reviews = array();
foreach ( $comments as $comment ) {
@ -520,6 +514,19 @@ class WC_API_Products extends WC_API_Resource {
$query_args['product_cat'] = $args['category'];
}
// Filter by specific sku
if ( ! empty( $args['sku'] ) ) {
if ( ! is_array( $query_args['meta_query'] ) ) {
$query_args['meta_query'] = array();
}
$query_args['meta_query'][] = array(
'key' => '_sku',
'value' => $args['sku'],
'compare' => '='
);
}
$query_args = $this->merge_query_args( $query_args, $args );
return new WP_Query( $query_args );

View File

@ -18,10 +18,72 @@ if ( ! defined( 'ABSPATH' ) ) {
class WC_AJAX {
/**
* Hook in methods
* Hook in ajax handlers
*/
public static function init() {
add_action( 'init', array( __CLASS__, 'add_endpoint') );
add_action( 'parse_query', array( __CLASS__, 'do_wc_ajax'), 0 );
self::add_ajax_events();
}
/**
* Add our endpoint for frontend ajax requests
*/
public static function add_endpoint() {
add_rewrite_tag( '%wc-ajax%', '([^/]*)' );
add_rewrite_rule( 'wc-ajax/([^/]*)/?', 'index.php?wc-ajax=$matches[1]', 'top' );
}
/**
* Get WC Ajax Endpoint
* @param string $request Optional
* @param string $ssl Optional
* @return string
*/
public static function get_endpoint( $request = '', $ssl = null ) {
if ( is_null( $ssl ) ) {
$scheme = parse_url( home_url(), PHP_URL_SCHEME );
} elseif ( $ssl ) {
$scheme = 'https';
} else {
$scheme = 'http';
}
if ( strstr( get_option( 'permalink_structure' ), '/index.php/' ) ) {
$endpoint = trailingslashit( home_url( '/index.php/wc-ajax/' . $request, $scheme ) );
} elseif ( get_option( 'permalink_structure' ) ) {
$endpoint = trailingslashit( home_url( '/wc-ajax/' . $request, $scheme ) );
} else {
$endpoint = add_query_arg( 'wc-ajax=', $request, trailingslashit( home_url( '', $scheme ) ) );
}
return esc_url_raw( $endpoint );
}
/**
* Check for WC Ajax request and fire action
*/
public static function do_wc_ajax() {
global $wp_query;
if ( ! empty( $_GET['wc-ajax'] ) ) {
$wp_query->set( 'wc-ajax', sanitize_text_field( $_GET['wc-ajax'] ) );
}
if ( $action = $wp_query->get( 'wc-ajax' ) ) {
if ( ! defined( 'DOING_AJAX' ) ) {
define( 'DOING_AJAX', true );
}
do_action( 'wc_ajax_' . sanitize_text_field( $action ) );
die();
}
}
/**
* Hook in methods - uses WordPress ajax handlers (admin-ajax)
*/
public static function add_ajax_events() {
// woocommerce_EVENT => nopriv
$ajax_events = array(
'get_refreshed_fragments' => true,
@ -74,6 +136,9 @@ class WC_AJAX {
if ( $nopriv ) {
add_action( 'wp_ajax_nopriv_woocommerce_' . $ajax_event, array( __CLASS__, $ajax_event ) );
// WC AJAX can be used for frontend ajax requests
add_action( 'wc_ajax_' . $ajax_event, array( __CLASS__, $ajax_event ) );
}
}
}
@ -96,7 +161,7 @@ class WC_AJAX {
'div.widget_shopping_cart_content' => '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>'
)
),
'cart_hash' => apply_filters( 'woocommerce_add_to_cart_hash', WC()->cart->get_cart() ? md5( json_encode( WC()->cart->get_cart() ) ) : '', WC()->cart->get_cart() )
'cart_hash' => apply_filters( 'woocommerce_add_to_cart_hash', WC()->cart->get_cart_for_session() ? md5( json_encode( WC()->cart->get_cart_for_session() ) ) : '', WC()->cart->get_cart_for_session() )
);
wp_send_json( $data );

View File

@ -73,7 +73,7 @@ class WC_API {
* @since 2.0
* @return void
*/
public function add_endpoint() {
public static function add_endpoint() {
// REST API
add_rewrite_rule( '^wc-api/v([1-2]{1})/?$', 'index.php?wc-api-version=$matches[1]&wc-api-route=/', 'top' );

View File

@ -88,6 +88,7 @@ class WC_Cart {
'taxes' => array(),
'shipping_taxes' => array(),
'discount_cart' => 0,
'discount_cart_tax' => 0,
'shipping_total' => 0,
'shipping_tax_total' => 0,
'coupon_discount_amounts' => array(),
@ -186,7 +187,7 @@ class WC_Cart {
private function set_cart_cookies( $set = true ) {
if ( $set ) {
wc_setcookie( 'woocommerce_items_in_cart', 1 );
wc_setcookie( 'woocommerce_cart_hash', md5( json_encode( $this->get_cart() ) ) );
wc_setcookie( 'woocommerce_cart_hash', md5( json_encode( $this->get_cart_for_session() ) ) );
} elseif ( isset( $_COOKIE['woocommerce_items_in_cart'] ) ) {
wc_setcookie( 'woocommerce_items_in_cart', 0, time() - HOUR_IN_SECONDS );
wc_setcookie( 'woocommerce_cart_hash', '', time() - HOUR_IN_SECONDS );
@ -691,8 +692,7 @@ class WC_Cart {
*
* @return array contents of the cart
*/
private function get_cart_for_session() {
public function get_cart_for_session() {
$cart_session = array();
if ( $this->get_cart() ) {
@ -844,16 +844,19 @@ class WC_Cart {
/**
* Add a product to the cart.
*
* @param string $product_id contains the id of the product to add to the cart
* @param integer $product_id contains the id of the product to add to the cart
* @param integer $quantity contains the quantity of the item to add
* @param int $variation_id
* @param integer $variation_id
* @param array $variation attribute values
* @param array $cart_item_data extra cart item data we want to pass into the item
* @return string $cart_item_key
*/
public function add_to_cart( $product_id, $quantity = 1, $variation_id = '', $variation = array(), $cart_item_data = array() ) {
public function add_to_cart( $product_id = 0, $quantity = 1, $variation_id = 0, $variation = array(), $cart_item_data = array() ) {
// Wrap in try catch so plugins can throw an exception to prevent adding to cart
try {
$product_id = absint( $product_id );
$variation_id = absint( $variation_id );
// Ensure we don't add a variation to the cart directly by variation ID
if ( 'product_variation' == get_post_type( $product_id ) ) {
$variation_id = $product_id;
@ -1797,13 +1800,15 @@ class WC_Cart {
return $price;
}
if ( ! empty( $this->coupons ) ) {
$undiscounted_price = $price;
if ( ! empty( $this->coupons ) ) {
$product = $values['data'];
foreach ( $this->coupons as $code => $coupon ) {
if ( $coupon->is_valid() && ( $coupon->is_valid_for_product( $product, $values ) || $coupon->is_valid_for_cart() ) ) {
$discount_amount = $coupon->get_discount_amount( $price, $values, $single = true );
$discount_amount = $coupon->get_discount_amount( ( 'yes' === get_option( 'woocommerce_calc_discounts_sequentially', 'no' ) ? $price : $undiscounted_price ), $values, $single = true );
$discount_amount = min( $price, $discount_amount );
$price = max( $price - $discount_amount, 0 );
// Store the totals for DISPLAY in the cart

View File

@ -69,6 +69,7 @@ class WC_Emails {
'woocommerce_order_status_on-hold_to_processing',
'woocommerce_order_status_on-hold_to_cancelled',
'woocommerce_order_status_completed',
'woocommerce_order_status_refunded',
'woocommerce_new_customer_note',
'woocommerce_created_customer'
) );
@ -123,6 +124,7 @@ class WC_Emails {
$this->emails['WC_Email_Cancelled_Order'] = include( 'emails/class-wc-email-cancelled-order.php' );
$this->emails['WC_Email_Customer_Processing_Order'] = include( 'emails/class-wc-email-customer-processing-order.php' );
$this->emails['WC_Email_Customer_Completed_Order'] = include( 'emails/class-wc-email-customer-completed-order.php' );
$this->emails['WC_Email_Customer_Refunded_Order'] = include( 'emails/class-wc-email-customer-refunded-order.php' );
$this->emails['WC_Email_Customer_Invoice'] = include( 'emails/class-wc-email-customer-invoice.php' );
$this->emails['WC_Email_Customer_Note'] = include( 'emails/class-wc-email-customer-note.php' );
$this->emails['WC_Email_Customer_Reset_Password'] = include( 'emails/class-wc-email-customer-reset-password.php' );

View File

@ -194,7 +194,8 @@ class WC_Frontend_Scripts {
switch ( $handle ) {
case 'woocommerce' :
return array(
'ajax_url' => WC()->ajax_url(),
'ajax_url' => WC()->ajax_url(),
'wc_ajax_url' => WC_AJAX::get_endpoint()
);
break;
case 'wc-single-product' :
@ -206,6 +207,7 @@ class WC_Frontend_Scripts {
case 'wc-checkout' :
return array(
'ajax_url' => WC()->ajax_url(),
'wc_ajax_url' => WC_AJAX::get_endpoint(),
'update_order_review_nonce' => wp_create_nonce( 'update-order-review' ),
'apply_coupon_nonce' => wp_create_nonce( 'apply-coupon' ),
'remove_coupon_nonce' => wp_create_nonce( 'remove-coupon' ),
@ -225,18 +227,21 @@ class WC_Frontend_Scripts {
case 'wc-cart' :
return array(
'ajax_url' => WC()->ajax_url(),
'wc_ajax_url' => WC_AJAX::get_endpoint(),
'update_shipping_method_nonce' => wp_create_nonce( "update-shipping-method" ),
);
break;
case 'wc-cart-fragments' :
return array(
'ajax_url' => WC()->ajax_url(),
'wc_ajax_url' => WC_AJAX::get_endpoint(),
'fragment_name' => apply_filters( 'woocommerce_cart_fragment_name', 'wc_fragments' )
);
break;
case 'wc-add-to-cart' :
return array(
'ajax_url' => WC()->ajax_url(),
'wc_ajax_url' => WC_AJAX::get_endpoint(),
'i18n_view_cart' => esc_attr__( 'View Cart', 'woocommerce' ),
'cart_url' => wc_get_page_permalink( 'cart' ),
'is_cart' => is_cart(),

View File

@ -97,6 +97,8 @@ class WC_Install {
// Also register endpoints - this needs to be done prior to rewrite rule flush
WC()->query->init_query_vars();
WC()->query->add_endpoints();
WC_API::add_endpoint();
WC_AJAX::add_endpoint();
self::create_terms();
self::create_cron_jobs();
@ -144,7 +146,8 @@ class WC_Install {
'2.0.9' => 'updates/woocommerce-update-2.0.9.php',
'2.1.0' => 'updates/woocommerce-update-2.1.php',
'2.2.0' => 'updates/woocommerce-update-2.2.php',
'2.3.0' => 'updates/woocommerce-update-2.3.php'
'2.3.0' => 'updates/woocommerce-update-2.3.php',
'2.4.0' => 'updates/woocommerce-update-2.4.php'
);
foreach ( $db_updates as $version => $updater ) {

View File

@ -41,7 +41,7 @@ class WC_Order_Factory {
}
// Filter classname so that the class can be overridden if extended.
$classname = apply_filters( 'woocommerce_order_class', $classname, $post_type, $order_id );
$classname = apply_filters( 'woocommerce_order_class', $classname, $post_type, $order_id, $the_order );
if ( ! class_exists( $classname ) ) {
$classname = 'WC_Order';

View File

@ -0,0 +1,172 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'WC_Email_Customer_Refunded_Order' ) ) :
/**
* Customer Refunded Order Email
*
* Order refunded emails are sent to the customer when the order is marked refunded.
*
* @class WC_Email_Customer_Refunded_Order
* @version 2.4.0
* @package WooCommerce/Classes/Emails
* @author WooThemes
* @extends WC_Email
*/
class WC_Email_Customer_Refunded_Order extends WC_Email {
/**
* Constructor
*/
function __construct() {
$this->id = 'customer_refunded_order';
$this->title = __( 'Refunded order', 'woocommerce' );
$this->description = __( 'Order refunded emails are sent to customers when their orders are marked refunded.', 'woocommerce' );
$this->heading = __( 'Your order has been refunded', 'woocommerce' );
$this->subject = __( 'Your {site_title} order from {order_date} has been refunded', 'woocommerce' );
$this->template_html = 'emails/customer-refunded-order.php';
$this->template_plain = 'emails/plain/customer-refunded-order.php';
// Triggers for this email
add_action( 'woocommerce_order_status_refunded_notification', array( $this, 'trigger' ) );
// Call parent constuctor
parent::__construct();
}
/**
* trigger function.
*
* @access public
* @return void
*/
function trigger( $order_id ) {
if ( $order_id ) {
$this->object = wc_get_order( $order_id );
$this->recipient = $this->object->billing_email;
$this->find['order-date'] = '{order_date}';
$this->find['order-number'] = '{order_number}';
$this->replace['order-date'] = date_i18n( wc_date_format(), strtotime( $this->object->order_date ) );
$this->replace['order-number'] = $this->object->get_order_number();
}
if ( ! $this->is_enabled() || ! $this->get_recipient() ) {
return;
}
$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
}
/**
* get_subject function.
*
* @access public
* @return string
*/
function get_subject() {
if ( ! empty( $this->object ) && $this->object->has_downloadable_item() )
return apply_filters( 'woocommerce_email_subject_customer_refunded_order', $this->format_string( $this->subject_downloadable ), $this->object );
else
return apply_filters( 'woocommerce_email_subject_customer_refunded_order', $this->format_string( $this->subject ), $this->object );
}
/**
* get_heading function.
*
* @access public
* @return string
*/
function get_heading() {
if ( ! empty( $this->object ) && $this->object->has_downloadable_item() )
return apply_filters( 'woocommerce_email_heading_customer_refunded_order', $this->format_string( $this->heading_downloadable ), $this->object );
else
return apply_filters( 'woocommerce_email_heading_customer_refunded_order', $this->format_string( $this->heading ), $this->object );
}
/**
* get_content_html function.
*
* @access public
* @return string
*/
function get_content_html() {
ob_start();
wc_get_template( $this->template_html, array(
'order' => $this->object,
'email_heading' => $this->get_heading(),
'sent_to_admin' => false,
'plain_text' => false
) );
return ob_get_clean();
}
/**
* get_content_plain function.
*
* @access public
* @return string
*/
function get_content_plain() {
ob_start();
wc_get_template( $this->template_plain, array(
'order' => $this->object,
'email_heading' => $this->get_heading(),
'sent_to_admin' => false,
'plain_text' => true
) );
return ob_get_clean();
}
/**
* Initialise Settings Form Fields
*
* @access public
* @return void
*/
function init_form_fields() {
$this->form_fields = array(
'enabled' => array(
'title' => __( 'Enable/Disable', 'woocommerce' ),
'type' => 'checkbox',
'label' => __( 'Enable this email notification', 'woocommerce' ),
'default' => 'yes'
),
'subject' => array(
'title' => __( 'Subject', 'woocommerce' ),
'type' => 'text',
'description' => sprintf( __( 'Defaults to <code>%s</code>', 'woocommerce' ), $this->subject ),
'placeholder' => '',
'default' => ''
),
'heading' => array(
'title' => __( 'Email Heading', 'woocommerce' ),
'type' => 'text',
'description' => sprintf( __( 'Defaults to <code>%s</code>', 'woocommerce' ), $this->heading ),
'placeholder' => '',
'default' => ''
),
'email_type' => array(
'title' => __( 'Email type', 'woocommerce' ),
'type' => 'select',
'description' => __( 'Choose which format of email to send.', 'woocommerce' ),
'default' => 'html',
'class' => 'email_type wc-enhanced-select',
'options' => $this->get_email_type_options()
)
);
}
}
endif;
return new WC_Email_Customer_Refunded_Order();

View File

@ -0,0 +1,16 @@
<?php
/**
* Update WC to 2.4.0
*
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin/Updates
* @version 2.4.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Maintain the old coupon logic for upgrades
update_option( 'woocommerce_calc_discounts_sequentially', 'yes' );

View File

@ -138,11 +138,17 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
== Changelog ==
* Fix - Ensure coupon taxes are reset when calculating totals.
* Tweak - Base discounts on the undiscounted price. #5874
= 2.3.7 - 18/03/2015 =
* Fix - Allow saving of empty download expiry date on orders.
* Fix - get_total_discount() function with certain tax setups.
* Fix - stock management for variations for Products API.
* Fix - Price filter styling.
* Fix - Support price filter min or max only.
* Fix - stock management for variations for Products API.
* Fix - Allowed paths for file url.
* Tweak - Chile address format.
* Tweak - Revised how discounts/discount taxes are stored for consistency. Always store ex. tax to make data retrieval easier, and to ensure totals are correct after settings changes. Backwards compatibility maintained through use of order versioning.
* Tweak - Delete product attachments when the Products API fails.

View File

@ -0,0 +1,57 @@
<?php
/**
* Customer refunded order email
*
* @author WooThemes
* @package WooCommerce/Templates/Emails
* @version 2.4.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<?php do_action( 'woocommerce_email_header', $email_heading ); ?>
<p><?php printf( __( "Hi there. Your order on %s has been refunded.", 'woocommerce' ), get_option( 'blogname' ) ); ?></p>
<?php do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text ); ?>
<h2><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></h2>
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
<thead>
<tr>
<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Product', 'woocommerce' ); ?></th>
<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Price', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php echo $order->email_order_items_table( true, false, true ); ?>
</tbody>
<tfoot>
<?php
if ( $totals = $order->get_order_item_totals() ) {
$i = 0;
foreach ( $totals as $total ) {
$i++;
?><tr>
<th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
<td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
</tr><?php
}
}
?>
</tfoot>
</table>
<?php do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text ); ?>
<?php do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text ); ?>
<?php do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text ); ?>
<?php do_action( 'woocommerce_email_footer' ); ?>

View File

@ -0,0 +1,45 @@
<?php
/**
* Customer refunded order email (plain text)
*
* @author WooThemes
* @package WooCommerce/Templates/Emails/Plain
* @version 2.4.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
echo "= " . $email_heading . " =\n\n";
echo sprintf( __( "Hi there. Your order on %s has been refunded. Your order details are shown below for your reference:", 'woocommerce' ), get_option( 'blogname' ) ) . "\n\n";
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text );
echo strtoupper( sprintf( __( 'Order number: %s', 'woocommerce' ), $order->get_order_number() ) ) . "\n";
echo date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $order->order_date ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
echo "\n" . $order->email_order_items_table( true, false, true, '', '', true );
echo "==========\n\n";
if ( $totals = $order->get_order_item_totals() ) {
foreach ( $totals as $total ) {
echo $total['label'] . "\t " . $total['value'] . "\n";
}
}
echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text );
do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text );
echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
echo apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) );

View File

@ -43,6 +43,8 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="clear"></div>
<?php do_action( 'woocommerce_lostpassword_form' ); ?>
<p class="form-row">
<input type="hidden" name="wc_reset_password" value="true" />
<input type="submit" class="button" value="<?php echo 'lost_password' == $args['form'] ? __( 'Reset Password', 'woocommerce' ) : __( 'Save', 'woocommerce' ); ?>" />

View File

@ -23,13 +23,13 @@ $tag_count = sizeof( get_the_terms( $post->ID, 'product_tag' ) );
<?php if ( wc_product_sku_enabled() && ( $product->get_sku() || $product->is_type( 'variable' ) ) ) : ?>
<span class="sku_wrapper"><?php _e( 'SKU:', 'woocommerce' ); ?> <span class="sku" itemprop="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : __( 'N/A', 'woocommerce' ); ?></span>.</span>
<span class="sku_wrapper"><?php _e( 'SKU:', 'woocommerce' ); ?> <span class="sku" itemprop="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : __( 'N/A', 'woocommerce' ); ?></span></span>
<?php endif; ?>
<?php echo $product->get_categories( ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', $cat_count, 'woocommerce' ) . ' ', '.</span>' ); ?>
<?php echo $product->get_categories( ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', $cat_count, 'woocommerce' ) . ' ', '</span>' ); ?>
<?php echo $product->get_tags( ', ', '<span class="tagged_as">' . _n( 'Tag:', 'Tags:', $tag_count, 'woocommerce' ) . ' ', '.</span>' ); ?>
<?php echo $product->get_tags( ', ', '<span class="tagged_as">' . _n( 'Tag:', 'Tags:', $tag_count, 'woocommerce' ) . ' ', '</span>' ); ?>
<?php do_action( 'woocommerce_product_meta_end' ); ?>

View File

@ -207,15 +207,12 @@ final class WooCommerce {
include_once( 'includes/class-wc-download-handler.php' );
include_once( 'includes/class-wc-comments.php' );
include_once( 'includes/class-wc-post-data.php' );
include_once( 'includes/class-wc-ajax.php' );
if ( $this->is_request( 'admin' ) ) {
include_once( 'includes/admin/class-wc-admin.php' );
}
if ( $this->is_request( 'ajax' ) ) {
$this->ajax_includes();
}
if ( $this->is_request( 'frontend' ) ) {
$this->frontend_includes();
}
@ -241,13 +238,6 @@ final class WooCommerce {
include_once( 'includes/class-wc-language-pack-upgrader.php' ); // Download/update languages
}
/**
* Include required ajax files.
*/
public function ajax_includes() {
include_once( 'includes/class-wc-ajax.php' ); // Ajax functions for admin and the front-end
}
/**
* Include required frontend files.
*/