Variations limit fix / Transients cleared on install

This commit is contained in:
Mike Jolley 2011-11-17 19:38:32 +00:00
parent e65f1d1aa0
commit 75db7b253e
4 changed files with 8 additions and 2 deletions

View File

@ -61,10 +61,11 @@ function install_woocommerce() {
*/ */
add_action('admin_init', 'install_woocommerce_redirect'); add_action('admin_init', 'install_woocommerce_redirect');
function install_woocommerce_redirect() { function install_woocommerce_redirect() {
global $pagenow; global $pagenow, $woocommerce;
if ( is_admin() && isset( $_GET['activate'] ) && ($_GET['activate'] == true) && $pagenow == 'plugins.php' && get_option( "woocommerce_installed" ) == 1 ) : if ( is_admin() && isset( $_GET['activate'] ) && ($_GET['activate'] == true) && $pagenow == 'plugins.php' && get_option( "woocommerce_installed" ) == 1 ) :
$woocommerce->clear_product_transients();
update_option( "woocommerce_installed", 0 ); update_option( "woocommerce_installed", 0 );
flush_rewrite_rules( false ); flush_rewrite_rules( false );
wp_redirect(admin_url('admin.php?page=woocommerce&installed=true')); wp_redirect(admin_url('admin.php?page=woocommerce&installed=true'));

View File

@ -161,7 +161,7 @@ class woocommerce_product {
if ( false === ( $this->children = get_transient( $transient_name ) ) ) : if ( false === ( $this->children = get_transient( $transient_name ) ) ) :
$this->children = get_posts( 'post_parent='.$this->id.'&post_type='.$child_post_type.'&orderby=menu_order&order=ASC&fields=ids&post_status=any' ); $this->children = get_posts( 'post_parent='.$this->id.'&post_type='.$child_post_type.'&orderby=menu_order&order=ASC&fields=ids&post_status=any&numberposts=-1' );
set_transient( $transient_name, $this->children ); set_transient( $transient_name, $this->children );

View File

@ -340,6 +340,9 @@ class woocommerce {
$post_id = (int) $post_id; $post_id = (int) $post_id;
delete_transient('woocommerce_product_total_stock_'.$post_id); delete_transient('woocommerce_product_total_stock_'.$post_id);
delete_transient('woocommerce_product_children_ids_'.$post_id); delete_transient('woocommerce_product_children_ids_'.$post_id);
else :
$wpdb->query("DELETE FROM `$wpdb->options` WHERE `option_name` LIKE ('_transient_woocommerce_product_children_ids_%')");
$wpdb->query("DELETE FROM `$wpdb->options` WHERE `option_name` LIKE ('_transient_woocommerce_product_total_stock_%')");
endif; endif;
} }

View File

@ -86,6 +86,8 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
* Fix for sale price logic * Fix for sale price logic
* Related products array_diff fix * Related products array_diff fix
* Fixed Produkt-Kategorie in formal german translation * Fixed Produkt-Kategorie in formal german translation
* Variations limit fix
* Transients cleared on install
= 1.2.2 - 17/11/2011 = = 1.2.2 - 17/11/2011 =
* Minor fixes and optimisations * Minor fixes and optimisations