Merge remote branch 'upstream/master'
This commit is contained in:
commit
adeda9cc47
|
@ -573,7 +573,7 @@ jQuery( function($){
|
|||
if (product_type!='variable') enable_variation = 'style="display:none;"'; else enable_variation = '';
|
||||
|
||||
// Add custom attribute row
|
||||
$('.woocommerce_attributes').append('<div class="woocommerce_attribute">\
|
||||
$('.woocommerce_attributes').append('<div class="woocommerce_attribute wc-metabox">\
|
||||
<h3>\
|
||||
<button type="button" class="remove_row button">' + woocommerce_writepanel_params.remove_label + '</button>\
|
||||
<div class="handlediv" title="' + woocommerce_writepanel_params.click_to_toggle + '"></div>\
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -45,8 +45,7 @@ class WC_Cart {
|
|||
$this->display_totals_ex_tax = (get_option('woocommerce_display_totals_excluding_tax')=='yes') ? true : false;
|
||||
$this->display_cart_ex_tax = (get_option('woocommerce_display_cart_prices_excluding_tax')=='yes') ? true : false;
|
||||
|
||||
add_action('init', array(&$this, 'init'), 1); // Get cart on init
|
||||
//add_action('wp', array(&$this, 'calculate_totals'), 1); // Defer calculate totals so we can detect page
|
||||
add_action('init', array(&$this, 'init'), 5); // Get cart on init
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,15 +158,45 @@ class WC_Cart {
|
|||
$_SESSION['shipping_total'] = $this->shipping_total;
|
||||
$_SESSION['shipping_tax_total'] = $this->shipping_tax_total;
|
||||
$_SESSION['shipping_label'] = $this->shipping_label;
|
||||
|
||||
if (get_current_user_id()) $this->persistent_cart_update();
|
||||
|
||||
do_action('woocommerce_cart_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty the cart data and destroy the session
|
||||
*/
|
||||
function empty_cart() {
|
||||
function empty_cart( $clear_persistent_cart = true ) {
|
||||
|
||||
$this->cart_contents = array();
|
||||
$this->reset();
|
||||
|
||||
unset( $_SESSION['cart_contents_total'], $_SESSION['cart_contents_weight'], $_SESSION['cart_contents_count'], $_SESSION['cart_contents_tax'], $_SESSION['total'], $_SESSION['subtotal'], $_SESSION['subtotal_ex_tax'], $_SESSION['tax_total'], $_SESSION['taxes'], $_SESSION['shipping_taxes'], $_SESSION['discount_cart'], $_SESSION['discount_total'], $_SESSION['shipping_total'], $_SESSION['shipping_tax_total'], $_SESSION['shipping_label'], $_SESSION['coupons'], $_SESSION['cart'] );
|
||||
|
||||
if ($clear_persistent_cart && get_current_user_id()) $this->persistent_cart_destroy();
|
||||
|
||||
do_action('woocommerce_cart_emptied');
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Persistent cart handling */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Save the persistent cart when updated
|
||||
*/
|
||||
function persistent_cart_update() {
|
||||
update_user_meta( get_current_user_id(), '_woocommerce_persistent_cart', array(
|
||||
'cart' => $_SESSION['cart'],
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the persistent cart
|
||||
*/
|
||||
function persistent_cart_destroy() {
|
||||
delete_user_meta( get_current_user_id(), '_woocommerce_persistent_cart' );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
|
|
@ -241,7 +241,6 @@ class WC_Customer {
|
|||
endif;
|
||||
|
||||
return apply_filters('woocommerce_customer_get_downloadable_products', $downloads);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -144,12 +144,14 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
== Changelog ==
|
||||
|
||||
= 1.5.1 =
|
||||
* Persistent (logged-in) customer carts (thanks dominic-p)
|
||||
* Error suppression on set_time_out
|
||||
* Order-details removed shipping when disabled
|
||||
* Updated Turkish translation
|
||||
* Layered nav for attribute pages (thanks helgatheviking)
|
||||
* Fixed dates in dashboard stats
|
||||
* Download expiry was backwards
|
||||
* Fix styling of new attribute
|
||||
|
||||
= 1.5 - 01/03/2012 =
|
||||
* Quick edit products
|
||||
|
|
|
@ -54,7 +54,24 @@ if (!function_exists('woocommerce_empty_cart')) {
|
|||
|
||||
if (!isset($woocommerce->cart) || $woocommerce->cart == '' ) $woocommerce->cart = new WC_Cart();
|
||||
|
||||
$woocommerce->cart->empty_cart();
|
||||
$woocommerce->cart->empty_cart( false );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the cart upon login
|
||||
**/
|
||||
function woocommerce_load_persistent_cart( $user_login, $user ) {
|
||||
global $woocommerce;
|
||||
|
||||
$saved_cart = get_user_meta( $user->ID, '_woocommerce_persistent_cart', true );
|
||||
|
||||
if ($saved_cart) {
|
||||
if (!isset($_SESSION['cart']) || !is_array($_SESSION['cart']) || sizeof($_SESSION['cart'])==0) {
|
||||
|
||||
$_SESSION['cart'] = $saved_cart['cart'];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -462,7 +462,6 @@ function woocommerce_clear_cart_after_payment() {
|
|||
endif;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process the checkout form
|
||||
**/
|
||||
|
|
|
@ -119,6 +119,7 @@ add_action( 'init', 'woocommerce_update_catalog_ordering' );
|
|||
/* Cart Actions */
|
||||
add_action( 'init', 'woocommerce_update_cart_action' );
|
||||
add_action( 'init', 'woocommerce_add_to_cart_action' );
|
||||
add_action( 'wp_login', 'woocommerce_load_persistent_cart', 1, 2);
|
||||
|
||||
/* Checkout Actions */
|
||||
add_action( 'init', 'woocommerce_checkout_action' );
|
||||
|
|
Loading…
Reference in New Issue