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

This commit is contained in:
Manos Psychogyiopoulos 2012-06-28 18:33:06 +03:00
commit c944f190b9
7 changed files with 37 additions and 28 deletions

View File

@ -660,11 +660,11 @@ jQuery(document).ready(function($) {
$('select#shipping_method, input[name=shipping_method]').live('change', function(){
$('body').trigger('update_checkout');
});
$('input#billing_country, input#billing_state, #billing_postcode, input#shipping_country, input#shipping_state, #shipping_postcode').live('keydown', function(){
clearTimeout(updateTimer);
$('.update_totals_on_change input').live('keydown', function(){
clearTimeout( updateTimer );
updateTimer = setTimeout(update_checkout, '1000');
});
$('select#billing_country, select#billing_state, select#shipping_country, select#shipping_state, #shiptobilling input, .update_totals_on_change').live('change', function(){
$('#shiptobilling input, .update_totals_on_change select, .update_totals_on_change input').live('change', function(){
$('body').trigger('update_checkout');
});
@ -860,8 +860,5 @@ jQuery(document).ready(function($) {
}
// Get this show on the road - update locale when loaded
$('select.country_to_state').change();
});

File diff suppressed because one or more lines are too long

View File

@ -1464,7 +1464,7 @@ class WC_Cart {
if ( get_option( 'woocommerce_shipping_cost_requires_address' ) == 'yes' ) {
if ( ! $woocommerce->customer->has_calculated_shipping() ) {
if ( ! $woocommerce->customer->get_shipping_country() || ! $woocommerce->customer->get_shipping_state() ) return false;
if ( ! $woocommerce->customer->get_shipping_country() || ( ! $woocommerce->customer->get_shipping_state() && ! $woocommerce->customer->get_shipping_postcode() ) ) return false;
}
}

View File

@ -1105,38 +1105,38 @@ class WC_Product {
* Checks sale data to see if the product is due to go on sale/sale has expired, and updates the main price
*/
function check_sale_price() {
global $woocommerce;
if ($this->sale_price_dates_from && $this->sale_price_dates_from < current_time('timestamp')) :
if ( $this->sale_price_dates_from && $this->sale_price_dates_from < current_time('timestamp') ) {
if ($this->sale_price && $this->price!==$this->sale_price) :
if ( $this->sale_price && $this->price !== $this->sale_price ) {
// Update price
$this->price = $this->sale_price;
update_post_meta($this->id, '_price', $this->price);
update_post_meta( $this->id, '_price', $this->price );
// Grouped product prices and sale status are affected by children
$this->grouped_product_sync();
endif;
}
endif;
}
if ($this->sale_price_dates_to && $this->sale_price_dates_to < current_time('timestamp')) :
if ( $this->sale_price_dates_to && $this->sale_price_dates_to < current_time('timestamp') ) {
if ($this->regular_price && $this->price!==$this->regular_price) :
if ( $this->regular_price && $this->price !== $this->regular_price ) {
$this->price = $this->regular_price;
update_post_meta($this->id, '_price', $this->price);
update_post_meta( $this->id, '_price', $this->price );
// Sale has expired - clear the schedule boxes
update_post_meta($this->id, '_sale_price', '');
update_post_meta($this->id, '_sale_price_dates_from', '');
update_post_meta($this->id, '_sale_price_dates_to', '');
update_post_meta( $this->id, '_sale_price', '' );
update_post_meta( $this->id, '_sale_price_dates_from', '' );
update_post_meta( $this->id, '_sale_price_dates_to', '' );
// Grouped product prices and sale status are affected by children
$this->grouped_product_sync();
endif;
}
endif;
}
}
/**

View File

@ -153,6 +153,8 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - Widget init function conflict with widget logic
* Fix - PLN currency code
* Fix - Variation get shipping class ID
* Fix - Scheduled on sale ignored from sale widget
* Fix - Use template_redirect instead of get_header to avoid white space errors with the checkout page
= 1.5.8 - 21/06/2012 =
* Tweak - Textarea for notes and enabled HTML

View File

@ -60,9 +60,10 @@ class WooCommerce_Widget_On_Sale extends WP_Widget {
$number = 15;
// Get products on sale
if ( false === ( $product_ids_on_sale = get_transient( 'wc_products_onsale' ) ) ) :
if ( false === ( $product_ids_on_sale = get_transient( 'wc_products_onsale' ) ) ) {
$meta_query = array();
$meta_query[] = array(
'key' => '_sale_price',
'value' => 0,
@ -78,11 +79,19 @@ class WooCommerce_Widget_On_Sale extends WP_Widget {
'fields' => 'id=>parent'
));
$product_ids_on_sale = array_unique(array_merge(array_values($on_sale), array_keys($on_sale)));
$product_ids = array_keys( $on_sale );
$parent_ids = array_values( $on_sale );
// Check for scheduled sales which have not started
foreach ( $product_ids as $key => $id )
if ( get_post_meta( $id, '_sale_price_dates_from', true ) > current_time('timestamp') )
unset( $product_ids[ $key ] );
$product_ids_on_sale = array_unique( array_merge( $product_ids, $parent_ids ) );
set_transient( 'wc_products_onsale', $product_ids_on_sale );
endif;
}
$product_ids_on_sale[] = 0;
@ -95,14 +104,15 @@ class WooCommerce_Widget_On_Sale extends WP_Widget {
'no_found_rows' => 1,
'post_status' => 'publish',
'post_type' => 'product',
'orderby' => 'rand',
'orderby' => 'date',
'order' => 'ASC',
'meta_query' => $meta_query,
'post__in' => $product_ids_on_sale
);
$r = new WP_Query($query_args);
if ($r->have_posts()) :
if ( $r->have_posts() ) :
?>
<?php echo $before_widget; ?>
<?php if ( $title ) echo $before_title . $title . $after_title; ?>

View File

@ -221,7 +221,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( 'get_header', array(&$this, 'buffer_checkout') );
add_action( 'template_redirect', 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') );