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

This commit is contained in:
Barry Kooij 2015-03-09 13:19:10 +01:00
commit ca6e9a7371
6 changed files with 45 additions and 34 deletions

View File

@ -243,6 +243,8 @@ class WC_Product {
// Clear caches
wp_cache_delete( $this->id, 'post_meta' );
delete_transient( 'wc_low_stock_count' );
delete_transient( 'wc_outofstock_count' );
unset( $this->stock );
// Stock status

View File

@ -95,7 +95,9 @@ class WC_Admin_Dashboard {
// Get products using a query - this is too advanced for get_posts :(
$stock = absint( max( get_option( 'woocommerce_notify_low_stock_amount' ), 1 ) );
$nostock = absint( max( get_option( 'woocommerce_notify_no_stock_amount' ), 0 ) );
$transient_name = 'wc_low_stock_count';
if ( false === ( $lowinstock_count = get_transient( $transient_name ) ) ) {
$query_from = apply_filters( 'woocommerce_report_low_in_stock_query_from', "FROM {$wpdb->posts} as posts
INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id
INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id
@ -106,9 +108,13 @@ class WC_Admin_Dashboard {
AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$stock}'
AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) > '{$nostock}'
" );
$lowinstock_count = absint( $wpdb->get_var( "SELECT COUNT( DISTINCT posts.ID ) {$query_from};" ) );
set_transient( $transient_name, $lowinstock_count, DAY_IN_SECONDS * 30 );
}
$transient_name = 'wc_outofstock_count';
if ( false === ( $outofstock_count = get_transient( $transient_name ) ) ) {
$query_from = apply_filters( 'woocommerce_report_out_of_stock_query_from', "FROM {$wpdb->posts} as posts
INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id
INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id
@ -118,8 +124,9 @@ class WC_Admin_Dashboard {
AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes'
AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$nostock}'
" );
$outofstock_count = absint( $wpdb->get_var( "SELECT COUNT( DISTINCT posts.ID ) {$query_from};" ) );
set_transient( $transient_name, $outofstock_count, DAY_IN_SECONDS * 30 );
}
?>
<ul class="wc_status_list">
<li class="sales-this-month">

View File

@ -30,8 +30,8 @@ class WC_Admin_Taxonomies {
// Add form
add_action( 'product_cat_add_form_fields', array( $this, 'add_category_fields' ) );
add_action( 'product_cat_edit_form_fields', array( $this, 'edit_category_fields' ), 10 );
add_action( 'created_term', array( $this, 'save_category_fields' ), 10 );
add_action( 'edit_term', array( $this, 'save_category_fields' ), 10 );
add_action( 'created_term', array( $this, 'save_category_fields' ), 10, 3 );
add_action( 'edit_term', array( $this, 'save_category_fields' ), 10, 3 );
// Add columns
add_filter( 'manage_edit-product_cat_columns', array( $this, 'product_cat_columns' ) );
@ -249,12 +249,11 @@ class WC_Admin_Taxonomies {
*
* @param mixed $term_id Term ID being saved
*/
public function save_category_fields( $term_id ) {
if ( isset( $_POST['display_type'] ) ) {
public function save_category_fields( $term_id, $tt_id = '', $taxonomy = '' ) {
if ( isset( $_POST['display_type'] ) && 'product_cat' === $taxonomy ) {
update_woocommerce_term_meta( $term_id, 'display_type', esc_attr( $_POST['display_type'] ) );
}
if ( isset( $_POST['product_cat_thumbnail_id'] ) ) {
if ( isset( $_POST['product_cat_thumbnail_id'] ) && 'product_cat' === $taxonomy ) {
update_woocommerce_term_meta( $term_id, 'thumbnail_id', absint( $_POST['product_cat_thumbnail_id'] ) );
}
}

View File

@ -647,9 +647,9 @@ function wc_trim_string( $string, $chars = 200, $suffix = '...' ) {
* Format content to display shortcodes
*
* @since 2.3.0
* @param string $string
* @param string $raw_string
* @return string
*/
function wc_format_content( $string ) {
return do_shortcode( shortcode_unautop( wpautop( $string ) ) );
function wc_format_content( $raw_string ) {
return apply_filters( 'woocommerce_format_content', do_shortcode( shortcode_unautop( wpautop( $raw_string ) ) ), $raw_string );
}

View File

@ -79,7 +79,9 @@ function wc_delete_product_transients( $post_id = 0 ) {
// Core transients
$transients_to_clear = array(
'wc_products_onsale',
'wc_featured_products'
'wc_featured_products',
'wc_outofstock_count',
'wc_low_stock_count'
);
// Transients that include an ID

View File

@ -151,6 +151,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Tweak - Prevent cart being cleared when accessing the login page.
* Tweak - Shipping calculator - Made state/postcode respect country locale like checkout.
* Tweak - Move default customer location to general settings tab.
* Tweak - Only run save_category_fields for product_cat taxonomy.
= 2.3.5 - 20/02/2015 =
* Fix - Plain text address formatting.