Merge branch 'master' into dev
This commit is contained in:
commit
9e770011eb
|
@ -723,7 +723,7 @@ class WC_Order {
|
|||
|
||||
$_product = $this->get_product_from_item( $item );
|
||||
|
||||
if ( $_product->exists && $_product->is_downloadable() && $_product->is_virtual() ) :
|
||||
if ( $_product->is_downloadable() && $_product->is_virtual() ) :
|
||||
$downloadable_order = true;
|
||||
continue;
|
||||
endif;
|
||||
|
|
|
@ -4,7 +4,7 @@ Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sh
|
|||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce
|
||||
Requires at least: 3.3
|
||||
Tested up to: 3.3
|
||||
Stable tag: 1.4.1
|
||||
Stable tag: 1.4.2
|
||||
|
||||
WooCommerce is an open-source e-commerce toolkit that helps you sell anything. Beautifully.
|
||||
|
||||
|
@ -82,7 +82,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 1.4.2 =
|
||||
= 1.4.2 - 07/02/2012 =
|
||||
* Uninstall fix
|
||||
* Improved template loader - passes args instead of using globals
|
||||
* Get dimensions fix
|
||||
|
@ -92,6 +92,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
|
|||
* Fixed sharethis code
|
||||
* Added sharedaddy support
|
||||
* Option to require login to download files
|
||||
* woocommerce_nocache function for cart/checkout/myaccount pages which need to be dynamic
|
||||
|
||||
= 1.4.1 - 01/02/2012 =
|
||||
* Depreciated tax class fix
|
||||
|
|
|
@ -17,6 +17,8 @@ function get_woocommerce_cart( $atts ) {
|
|||
function woocommerce_cart( $atts ) {
|
||||
global $woocommerce;
|
||||
|
||||
woocommerce_nocache();
|
||||
|
||||
if (!defined('WOOCOMMERCE_CART')) define('WOOCOMMERCE_CART', true);
|
||||
|
||||
// Remove Discount Codes
|
||||
|
|
|
@ -17,6 +17,8 @@ function get_woocommerce_checkout( $atts ) {
|
|||
function woocommerce_checkout( $atts ) {
|
||||
global $woocommerce;
|
||||
|
||||
woocommerce_nocache();
|
||||
|
||||
if (sizeof($woocommerce->cart->get_cart())==0) return;
|
||||
|
||||
$non_js_checkout = (isset($_POST['woocommerce_checkout_update_totals']) && $_POST['woocommerce_checkout_update_totals']) ? true : false;
|
||||
|
|
|
@ -38,6 +38,8 @@ function get_woocommerce_view_order() {
|
|||
function woocommerce_my_account( $atts ) {
|
||||
global $woocommerce, $current_user;
|
||||
|
||||
woocommerce_nocache();
|
||||
|
||||
if ( ! is_user_logged_in() ) :
|
||||
|
||||
woocommerce_get_template( 'myaccount/form-login.php' );
|
||||
|
@ -75,6 +77,8 @@ function woocommerce_my_account( $atts ) {
|
|||
function woocommerce_edit_address() {
|
||||
global $woocommerce;
|
||||
|
||||
woocommerce_nocache();
|
||||
|
||||
if ( ! is_user_logged_in() ) return;
|
||||
|
||||
$load_address = woocommerce_get_address_to_edit();
|
||||
|
@ -245,6 +249,8 @@ add_action( 'template_redirect', 'woocommerce_save_password' );
|
|||
function woocommerce_view_order() {
|
||||
global $woocommerce;
|
||||
|
||||
woocommerce_nocache();
|
||||
|
||||
if ( ! is_user_logged_in() ) return;
|
||||
|
||||
$user_id = get_current_user_id();
|
||||
|
|
|
@ -16,6 +16,8 @@ function get_woocommerce_order_tracking($atts) {
|
|||
function woocommerce_order_tracking( $atts ) {
|
||||
global $woocommerce;
|
||||
|
||||
woocommerce_nocache();
|
||||
|
||||
extract(shortcode_atts(array(
|
||||
), $atts));
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ function get_woocommerce_pay( $atts ) {
|
|||
function woocommerce_pay() {
|
||||
global $woocommerce;
|
||||
|
||||
woocommerce_nocache();
|
||||
|
||||
if ( isset($_GET['pay_for_order']) && isset($_GET['order']) && isset($_GET['order_id']) ) :
|
||||
|
||||
// Pay for existing order
|
||||
|
|
|
@ -20,6 +20,8 @@ function get_woocommerce_thankyou( $atts ) {
|
|||
function woocommerce_thankyou( $atts ) {
|
||||
global $woocommerce;
|
||||
|
||||
woocommerce_nocache();
|
||||
|
||||
$order = false;
|
||||
|
||||
// Pay for order after checkout step
|
||||
|
|
|
@ -156,6 +156,7 @@ class WooCommerce_Widget_Layered_Nav extends WP_Widget {
|
|||
$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
||||
$taxonomy = $woocommerce->attribute_taxonomy_name($instance['attribute']);
|
||||
$query_type = (isset($instance['query_type'])) ? $instance['query_type'] : 'and';
|
||||
$display_type = (isset($instance['display_type'])) ? $instance['display_type'] : 'list';
|
||||
|
||||
if (!taxonomy_exists($taxonomy)) return;
|
||||
|
||||
|
@ -172,120 +173,153 @@ class WooCommerce_Widget_Layered_Nav extends WP_Widget {
|
|||
|
||||
echo $before_widget . $before_title . $title . $after_title;
|
||||
|
||||
echo "<ul>";
|
||||
|
||||
// Force found when option is selected
|
||||
if (is_array($_chosen_attributes) && array_key_exists($taxonomy, $_chosen_attributes)) $found = true;
|
||||
|
||||
foreach ($terms as $term) {
|
||||
if ($display_type=='dropdown') {
|
||||
|
||||
// Get count based on current view - uses transients
|
||||
$transient_name = 'woocommerce_layered_nav_count_' . sanitize_key($taxonomy) . sanitize_key( $term->term_id );
|
||||
$found = true;
|
||||
|
||||
if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {
|
||||
|
||||
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
||||
echo '<select id="dropdown_layered_nav_'.$taxonomy.'">';
|
||||
|
||||
set_transient( $transient_name, $_products_in_term );
|
||||
echo '<option>'. sprintf( __('Any %s', 'woocommerce'), $taxonomy ) .'</option>';
|
||||
|
||||
foreach ($terms as $term) {
|
||||
echo '<option>'.$term->name.'</option>';
|
||||
}
|
||||
|
||||
$option_is_set = (isset($_chosen_attributes[$taxonomy]) && in_array($term->term_id, $_chosen_attributes[$taxonomy]['terms']));
|
||||
|
||||
// If this is an AND query, only show options with count > 0
|
||||
if ($query_type=='and') {
|
||||
|
||||
$count = sizeof(array_intersect($_products_in_term, $woocommerce->query->filtered_product_ids));
|
||||
|
||||
if ($count>0) $found = true;
|
||||
echo '</select>';
|
||||
|
||||
if ($count==0 && !$option_is_set) continue;
|
||||
?>
|
||||
<script type='text/javascript'>
|
||||
/* <![CDATA[ */
|
||||
var dropdown = document.getElementById("dropdown_layered_nav_<?php echo $taxonomy; ?>");
|
||||
function onCatChange() {
|
||||
if ( dropdown.options[dropdown.selectedIndex].value !=='' ) {
|
||||
location.href = "<?php echo home_url(); ?>/?product_cat="+dropdown.options[dropdown.selectedIndex].value;
|
||||
}
|
||||
}
|
||||
dropdown.onchange = onCatChange;
|
||||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
|
||||
} else {
|
||||
|
||||
// If this is an OR query, show all options so search can be expanded
|
||||
} else {
|
||||
// List display
|
||||
echo "<ul>";
|
||||
|
||||
// Force found when option is selected
|
||||
if (is_array($_chosen_attributes) && array_key_exists($taxonomy, $_chosen_attributes)) $found = true;
|
||||
|
||||
foreach ($terms as $term) {
|
||||
|
||||
$count = sizeof(array_intersect($_products_in_term, $woocommerce->query->unfiltered_product_ids));
|
||||
// Get count based on current view - uses transients
|
||||
$transient_name = 'woocommerce_layered_nav_count_' . sanitize_key($taxonomy) . sanitize_key( $term->term_id );
|
||||
|
||||
if ($count>0) $found = true;
|
||||
|
||||
}
|
||||
|
||||
$class = '';
|
||||
|
||||
$arg = 'filter_'.strtolower(sanitize_title($instance['attribute']));
|
||||
|
||||
if (isset($_GET[ $arg ])) $current_filter = explode(',', $_GET[ $arg ]); else $current_filter = array();
|
||||
|
||||
if (!is_array($current_filter)) $current_filter = array();
|
||||
|
||||
if (!in_array($term->term_id, $current_filter)) $current_filter[] = $term->term_id;
|
||||
|
||||
// Base Link decided by current page
|
||||
if (defined('SHOP_IS_ON_FRONT')) :
|
||||
$link = home_url();
|
||||
elseif (is_post_type_archive('product') || is_page( woocommerce_get_page_id('shop') )) :
|
||||
$link = get_post_type_archive_link('product');
|
||||
else :
|
||||
$link = get_term_link( get_query_var('term'), get_query_var('taxonomy') );
|
||||
endif;
|
||||
|
||||
// All current filters
|
||||
if ($_chosen_attributes) foreach ($_chosen_attributes as $name => $data) :
|
||||
if ($name!==$taxonomy) :
|
||||
$link = add_query_arg( strtolower(sanitize_title(str_replace('pa_', 'filter_', $name))), implode(',', $data['terms']), $link );
|
||||
if ($data['query_type']=='or') $link = add_query_arg( strtolower(sanitize_title(str_replace('pa_', 'query_type_', $name))), 'or', $link );
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
// Min/Max
|
||||
if (isset($_GET['min_price'])) :
|
||||
$link = add_query_arg( 'min_price', $_GET['min_price'], $link );
|
||||
endif;
|
||||
if (isset($_GET['max_price'])) :
|
||||
$link = add_query_arg( 'max_price', $_GET['max_price'], $link );
|
||||
endif;
|
||||
|
||||
// Current Filter = this widget
|
||||
if (isset( $_chosen_attributes[$taxonomy] ) && is_array($_chosen_attributes[$taxonomy]['terms']) && in_array($term->term_id, $_chosen_attributes[$taxonomy]['terms'])) :
|
||||
$class = 'class="chosen"';
|
||||
if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {
|
||||
|
||||
$_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
|
||||
|
||||
// Remove this term is $current_filter has more than 1 term filtered
|
||||
if (sizeof($current_filter)>1) :
|
||||
$current_filter_without_this = array_diff($current_filter, array($term->term_id));
|
||||
$link = add_query_arg( $arg, implode(',', $current_filter_without_this), $link );
|
||||
set_transient( $transient_name, $_products_in_term );
|
||||
}
|
||||
|
||||
$option_is_set = (isset($_chosen_attributes[$taxonomy]) && in_array($term->term_id, $_chosen_attributes[$taxonomy]['terms']));
|
||||
|
||||
// If this is an AND query, only show options with count > 0
|
||||
if ($query_type=='and') {
|
||||
|
||||
$count = sizeof(array_intersect($_products_in_term, $woocommerce->query->filtered_product_ids));
|
||||
|
||||
if ($count>0) $found = true;
|
||||
|
||||
if ($count==0 && !$option_is_set) continue;
|
||||
|
||||
// If this is an OR query, show all options so search can be expanded
|
||||
} else {
|
||||
|
||||
$count = sizeof(array_intersect($_products_in_term, $woocommerce->query->unfiltered_product_ids));
|
||||
|
||||
if ($count>0) $found = true;
|
||||
|
||||
}
|
||||
|
||||
$class = '';
|
||||
|
||||
$arg = 'filter_'.strtolower(sanitize_title($instance['attribute']));
|
||||
|
||||
if (isset($_GET[ $arg ])) $current_filter = explode(',', $_GET[ $arg ]); else $current_filter = array();
|
||||
|
||||
if (!is_array($current_filter)) $current_filter = array();
|
||||
|
||||
if (!in_array($term->term_id, $current_filter)) $current_filter[] = $term->term_id;
|
||||
|
||||
// Base Link decided by current page
|
||||
if (defined('SHOP_IS_ON_FRONT')) :
|
||||
$link = home_url();
|
||||
elseif (is_post_type_archive('product') || is_page( woocommerce_get_page_id('shop') )) :
|
||||
$link = get_post_type_archive_link('product');
|
||||
else :
|
||||
$link = get_term_link( get_query_var('term'), get_query_var('taxonomy') );
|
||||
endif;
|
||||
|
||||
else :
|
||||
$link = add_query_arg( $arg, implode(',', $current_filter), $link );
|
||||
endif;
|
||||
// All current filters
|
||||
if ($_chosen_attributes) foreach ($_chosen_attributes as $name => $data) :
|
||||
if ($name!==$taxonomy) :
|
||||
$link = add_query_arg( strtolower(sanitize_title(str_replace('pa_', 'filter_', $name))), implode(',', $data['terms']), $link );
|
||||
if ($data['query_type']=='or') $link = add_query_arg( strtolower(sanitize_title(str_replace('pa_', 'query_type_', $name))), 'or', $link );
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
// Min/Max
|
||||
if (isset($_GET['min_price'])) :
|
||||
$link = add_query_arg( 'min_price', $_GET['min_price'], $link );
|
||||
endif;
|
||||
if (isset($_GET['max_price'])) :
|
||||
$link = add_query_arg( 'max_price', $_GET['max_price'], $link );
|
||||
endif;
|
||||
|
||||
// Current Filter = this widget
|
||||
if (isset( $_chosen_attributes[$taxonomy] ) && is_array($_chosen_attributes[$taxonomy]['terms']) && in_array($term->term_id, $_chosen_attributes[$taxonomy]['terms'])) :
|
||||
$class = 'class="chosen"';
|
||||
|
||||
// Remove this term is $current_filter has more than 1 term filtered
|
||||
if (sizeof($current_filter)>1) :
|
||||
$current_filter_without_this = array_diff($current_filter, array($term->term_id));
|
||||
$link = add_query_arg( $arg, implode(',', $current_filter_without_this), $link );
|
||||
endif;
|
||||
|
||||
else :
|
||||
$link = add_query_arg( $arg, implode(',', $current_filter), $link );
|
||||
endif;
|
||||
|
||||
// Search Arg
|
||||
if (get_search_query()) :
|
||||
$link = add_query_arg( 's', get_search_query(), $link );
|
||||
endif;
|
||||
|
||||
// Post Type Arg
|
||||
if (isset($_GET['post_type'])) :
|
||||
$link = add_query_arg( 'post_type', $_GET['post_type'], $link );
|
||||
endif;
|
||||
|
||||
// Query type Arg
|
||||
if ($query_type=='or' && !( sizeof($current_filter) == 1 && isset( $_chosen_attributes[$taxonomy]['terms'] ) && is_array($_chosen_attributes[$taxonomy]['terms']) && in_array($term->term_id, $_chosen_attributes[$taxonomy]['terms']) )) :
|
||||
$link = add_query_arg( 'query_type_'.strtolower(sanitize_title($instance['attribute'])), 'or', $link );
|
||||
endif;
|
||||
|
||||
echo '<li '.$class.'>';
|
||||
|
||||
if ($count>0 || $option_is_set) echo '<a href="'.$link.'">'; else echo '<span>';
|
||||
|
||||
echo $term->name;
|
||||
|
||||
if ($count>0 || $option_is_set) echo '</a>'; else echo '</span>';
|
||||
|
||||
echo ' <small class="count">'.$count.'</small></li>';
|
||||
|
||||
}
|
||||
|
||||
// Search Arg
|
||||
if (get_search_query()) :
|
||||
$link = add_query_arg( 's', get_search_query(), $link );
|
||||
endif;
|
||||
|
||||
// Post Type Arg
|
||||
if (isset($_GET['post_type'])) :
|
||||
$link = add_query_arg( 'post_type', $_GET['post_type'], $link );
|
||||
endif;
|
||||
|
||||
// Query type Arg
|
||||
if ($query_type=='or' && !( sizeof($current_filter) == 1 && isset( $_chosen_attributes[$taxonomy]['terms'] ) && is_array($_chosen_attributes[$taxonomy]['terms']) && in_array($term->term_id, $_chosen_attributes[$taxonomy]['terms']) )) :
|
||||
$link = add_query_arg( 'query_type_'.strtolower(sanitize_title($instance['attribute'])), 'or', $link );
|
||||
endif;
|
||||
|
||||
echo '<li '.$class.'>';
|
||||
|
||||
if ($count>0 || $option_is_set) echo '<a href="'.$link.'">'; else echo '<span>';
|
||||
|
||||
echo $term->name;
|
||||
|
||||
if ($count>0 || $option_is_set) echo '</a>'; else echo '</span>';
|
||||
|
||||
echo ' <small class="count">'.$count.'</small></li>';
|
||||
|
||||
}
|
||||
echo "</ul>";
|
||||
|
||||
echo "</ul>";
|
||||
} // End display type conditional
|
||||
|
||||
echo $after_widget;
|
||||
|
||||
|
@ -307,6 +341,7 @@ class WooCommerce_Widget_Layered_Nav extends WP_Widget {
|
|||
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
||||
$instance['attribute'] = stripslashes($new_instance['attribute']);
|
||||
$instance['query_type'] = stripslashes($new_instance['query_type']);
|
||||
$instance['display_type'] = stripslashes($new_instance['display_type']);
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
@ -315,6 +350,7 @@ class WooCommerce_Widget_Layered_Nav extends WP_Widget {
|
|||
global $woocommerce;
|
||||
|
||||
if (!isset($instance['query_type'])) $instance['query_type'] = 'and';
|
||||
if (!isset($instance['display_type'])) $instance['display_type'] = 'list';
|
||||
?>
|
||||
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'woocommerce') ?></label>
|
||||
<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id('title') ); ?>" name="<?php echo esc_attr( $this->get_field_name('title') ); ?>" value="<?php if (isset ( $instance['title'])) {echo esc_attr( $instance['title'] );} ?>" /></p>
|
||||
|
@ -339,6 +375,12 @@ class WooCommerce_Widget_Layered_Nav extends WP_Widget {
|
|||
?>
|
||||
</select></p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('display_type'); ?>"><?php _e('Display Type:', 'woocommerce') ?></label>
|
||||
<select id="<?php echo esc_attr( $this->get_field_id('display_type') ); ?>" name="<?php echo esc_attr( $this->get_field_name('display_type') ); ?>">
|
||||
<option value="list" <?php selected($instance['display_type'], 'list'); ?>><?php _e('List', 'woocommerce'); ?></option>
|
||||
<option value="dropdown" <?php selected($instance['display_type'], 'dropdown'); ?>><?php _e('Dropdown', 'woocommerce'); ?></option>
|
||||
</select></p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('query_type'); ?>"><?php _e('Query Type:', 'woocommerce') ?></label>
|
||||
<select id="<?php echo esc_attr( $this->get_field_id('query_type') ); ?>" name="<?php echo esc_attr( $this->get_field_name('query_type') ); ?>">
|
||||
<option value="and" <?php selected($instance['query_type'], 'and'); ?>><?php _e('AND', 'woocommerce'); ?></option>
|
||||
|
|
|
@ -20,6 +20,15 @@ function woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: te
|
|||
$mailer->send( $to, $subject, $message, $headers, $attachments );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent caching
|
||||
**/
|
||||
function woocommerce_nocache() {
|
||||
if(!defined('DONOTCACHEPAGE')) {
|
||||
define("DONOTCACHEPAGE", "true"); // WP Super Cache constant
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WooCommerce page IDs
|
||||
*
|
||||
|
|
|
@ -130,8 +130,8 @@ if (!function_exists('woocommerce_get_sidebar')) {
|
|||
* Prevent Cache
|
||||
**/
|
||||
if (!function_exists('woocommerce_prevent_sidebar_cache')) {
|
||||
function woocommerce_prevent_sidebar_cache() {
|
||||
echo '<!--mfunc get_sidebar() --><!--/mfunc-->';
|
||||
function woocommerce_prevent_sidebar_cache( $sidebar ) {
|
||||
echo '<!--mfunc get_sidebar("'.$sidebar.'") --><!--/mfunc-->';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: WooCommerce
|
||||
Plugin URI: http://www.woothemes.com/woocommerce/
|
||||
Description: An e-commerce toolkit that helps you sell anything. Beautifully.
|
||||
Version: 1.4.1
|
||||
Version: 1.4.2
|
||||
Author: WooThemes
|
||||
Author URI: http://woothemes.com
|
||||
Requires at least: 3.1
|
||||
|
@ -29,7 +29,7 @@ class Woocommerce {
|
|||
|
||||
/** Version ***************************************************************/
|
||||
|
||||
var $version = '1.4.1';
|
||||
var $version = '1.4.2';
|
||||
|
||||
/** URLS ******************************************************************/
|
||||
|
||||
|
|
Loading…
Reference in New Issue