Merge pull request #3 from woothemes/master

Update
This commit is contained in:
Peter 2015-12-30 14:10:39 +01:00
commit 6a52817d39
4 changed files with 22 additions and 14 deletions

View File

@ -1851,7 +1851,7 @@ class WC_Cart {
foreach ( $this->coupons as $code => $coupon ) { foreach ( $this->coupons as $code => $coupon ) {
if ( $coupon->is_valid() && ( $coupon->is_valid_for_product( $product, $values ) || $coupon->is_valid_for_cart() ) ) { if ( $coupon->is_valid() && ( $coupon->is_valid_for_product( $product, $values ) || $coupon->is_valid_for_cart() ) ) {
$discount_amount = $coupon->get_discount_amount( ( 'yes' === get_option( 'woocommerce_calc_discounts_sequentially', 'no' ) ? $price : $undiscounted_price ), $values, true ); $discount_amount = $coupon->get_discount_amount( 'yes' === get_option( 'woocommerce_calc_discounts_sequentially', 'no' ) ? $price : $undiscounted_price, $values, true );
$discount_amount = min( $price, $discount_amount ); $discount_amount = min( $price, $discount_amount );
$price = max( $price - $discount_amount, 0 ); $price = max( $price - $discount_amount, 0 );
@ -1873,6 +1873,11 @@ class WC_Cart {
$this->increase_coupon_applied_count( $code, $values['quantity'] ); $this->increase_coupon_applied_count( $code, $values['quantity'] );
} }
} }
// If the price is 0, we can stop going through coupons because there is nothing more to discount for this product.
if ( 0 >= $price ) {
break;
}
} }
} }

View File

@ -147,6 +147,7 @@ class WC_Post_types {
'new_item_name' => __( 'New Shipping Class Name', 'woocommerce' ) 'new_item_name' => __( 'New Shipping Class Name', 'woocommerce' )
), ),
'show_ui' => true, 'show_ui' => true,
'show_in_quick_edit' => false,
'show_in_nav_menus' => false, 'show_in_nav_menus' => false,
'query_var' => is_admin(), 'query_var' => is_admin(),
'capabilities' => array( 'capabilities' => array(
@ -185,6 +186,7 @@ class WC_Post_types {
'new_item_name' => sprintf( __( 'New %s', 'woocommerce' ), $label ) 'new_item_name' => sprintf( __( 'New %s', 'woocommerce' ), $label )
), ),
'show_ui' => true, 'show_ui' => true,
'show_in_quick_edit' => false,
'show_in_menu' => false, 'show_in_menu' => false,
'show_in_nav_menus' => false, 'show_in_nav_menus' => false,
'meta_box_cb' => false, 'meta_box_cb' => false,

View File

@ -62,7 +62,6 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
// Hooks // Hooks
add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
add_action( 'admin_notices', array( $this, 'checks' ) );
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
add_action( 'woocommerce_receipt_' . $this->id, array( $this, 'receipt_page' ) ); add_action( 'woocommerce_receipt_' . $this->id, array( $this, 'receipt_page' ) );
add_action( 'woocommerce_api_wc_gateway_simplify_commerce', array( $this, 'return_handler' ) ); add_action( 'woocommerce_api_wc_gateway_simplify_commerce', array( $this, 'return_handler' ) );
@ -101,6 +100,8 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
<p><?php _e( 'Simplify Commerce is your merchant account and payment gateway all rolled into one. Choose Simplify Commerce as your WooCommerce payment gateway to get access to your money quickly with a powerful, secure payment engine backed by MasterCard.', 'woocommerce' ); ?></p> <p><?php _e( 'Simplify Commerce is your merchant account and payment gateway all rolled into one. Choose Simplify Commerce as your WooCommerce payment gateway to get access to your money quickly with a powerful, secure payment engine backed by MasterCard.', 'woocommerce' ); ?></p>
<?php endif; ?> <?php endif; ?>
<?php $this->checks(); ?>
<table class="form-table"> <table class="form-table">
<?php $this->generate_settings_html(); ?> <?php $this->generate_settings_html(); ?>
<script type="text/javascript"> <script type="text/javascript">
@ -120,7 +121,7 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
jQuery( '#woocommerce_simplify_commerce_mode' ).on( 'change', function() { jQuery( '#woocommerce_simplify_commerce_mode' ).on( 'change', function() {
var color = jQuery( '#woocommerce_simplify_commerce_modal_color' ).closest( 'tr' ); var color = jQuery( '#woocommerce_simplify_commerce_modal_color' ).closest( 'tr' );
if ( 'standard' == jQuery( this ).val() ) { if ( 'standard' === jQuery( this ).val() ) {
color.hide(); color.hide();
} else { } else {
color.show(); color.show();

View File

@ -31,7 +31,7 @@ function wc_get_attribute_taxonomies() {
if ( false === ( $attribute_taxonomies = get_transient( 'wc_attribute_taxonomies' ) ) ) { if ( false === ( $attribute_taxonomies = get_transient( 'wc_attribute_taxonomies' ) ) ) {
global $wpdb; global $wpdb;
$attribute_taxonomies = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies" ); $attribute_taxonomies = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies order by attribute_name ASC;" );
set_transient( 'wc_attribute_taxonomies', $attribute_taxonomies ); set_transient( 'wc_attribute_taxonomies', $attribute_taxonomies );
} }