Merge branch 'master' of github.com:woothemes/woocommerce

This commit is contained in:
Claudio Sanches 2015-07-16 15:42:11 -03:00
commit bb0811643c
3 changed files with 24 additions and 13 deletions

View File

@ -401,10 +401,14 @@ class WC_Coupon {
if ( 'yes' === $this->exclude_sale_items && $this->is_type( array( 'fixed_product', 'percent_product' ) ) ) {
$valid_for_cart = false;
$product_ids_on_sale = wc_get_product_ids_on_sale();
if ( ! WC()->cart->is_empty() ) {
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
if ( sizeof( array_intersect( array( absint( $cart_item['product_id'] ), absint( $cart_item['variation_id'] ), $cart_item['data']->get_parent() ), $product_ids_on_sale ) ) === 0 ) {
// not on sale
if ( ! empty( $cart_item['variation_id'] ) ) {
if ( ! in_array( $cart_item['variation_id'], $product_ids_on_sale, true ) ) {
$valid_for_cart = true;
}
} elseif ( ! in_array( $cart_item['product_id'], $product_ids_on_sale, true ) ) {
$valid_for_cart = true;
}
}

View File

@ -423,14 +423,17 @@ if ( ! function_exists( 'woocommerce_demo_store' ) ) {
*
*/
function woocommerce_demo_store() {
if ( !is_store_notice_showing() )
if ( ! is_store_notice_showing() ) {
return;
}
$notice = get_option( 'woocommerce_demo_store_notice' );
if ( empty( $notice ) )
if ( empty( $notice ) ) {
$notice = __( 'This is a demo store for testing purposes — no orders shall be fulfilled.', 'woocommerce' );
}
echo apply_filters( 'woocommerce_demo_store', '<p class="demo_store">' . $notice . '</p>' );
echo apply_filters( 'woocommerce_demo_store', '<p class="demo_store">' . wp_kses_post( $notice ) . '</p>' );
}
}

View File

@ -218,6 +218,11 @@ final class WooCommerce {
$this->frontend_includes();
}
if ( $this->is_request( 'frontend' ) || $this->is_request( 'cron' ) ) {
include_once( 'includes/abstracts/abstract-wc-session.php' );
include_once( 'includes/class-wc-session-handler.php' );
}
if ( $this->is_request( 'cron' ) && 'yes' === get_option( 'woocommerce_allow_tracking', 'no' ) ) {
include_once( 'includes/class-wc-tracker.php' );
}
@ -225,7 +230,7 @@ final class WooCommerce {
$this->query = include( 'includes/class-wc-query.php' ); // The main query class
$this->api = include( 'includes/class-wc-api.php' ); // API Class
include_once( 'includes/class-wc-auth.php' ); // Auth Class
include_once( 'includes/class-wc-auth.php' ); // Auth Class
include_once( 'includes/class-wc-post-types.php' ); // Registers post types
include_once( 'includes/abstracts/abstract-wc-product.php' ); // Products
include_once( 'includes/abstracts/abstract-wc-order.php' ); // Orders
@ -246,8 +251,6 @@ final class WooCommerce {
public function frontend_includes() {
include_once( 'includes/wc-cart-functions.php' );
include_once( 'includes/wc-notice-functions.php' );
include_once( 'includes/abstracts/abstract-wc-session.php' );
include_once( 'includes/class-wc-session-handler.php' );
include_once( 'includes/wc-template-hooks.php' );
include_once( 'includes/class-wc-template-loader.php' ); // Template Loader
include_once( 'includes/class-wc-frontend-scripts.php' ); // Frontend Scripts
@ -282,13 +285,14 @@ final class WooCommerce {
$this->countries = new WC_Countries(); // Countries class
$this->integrations = new WC_Integrations(); // Integrations class
// Session class, handles session data for users - can be overwritten if custom handler is needed
if ( $this->is_request( 'frontend' ) || $this->is_request( 'cron' ) ) {
$session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' );
$this->session = new $session_class();
}
// Classes/actions loaded for the frontend and for ajax requests
if ( $this->is_request( 'frontend' ) ) {
// Session class, handles session data for users - can be overwritten if custom handler is needed
$session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' );
// Class instances
$this->session = new $session_class();
$this->cart = new WC_Cart(); // Cart class, stores the cart contents
$this->customer = new WC_Customer(); // Customer class, handles data such as customer location
}