Fixed notices and the order field. Closes #42.

This commit is contained in:
Mike Jolley 2011-10-04 10:32:42 +01:00
parent 96c9ebccf7
commit 280803e088
4 changed files with 17 additions and 5 deletions

View File

@ -26,11 +26,22 @@ class woocommerce_query {
* Query the products, applying sorting/ordering etc. This applies to the main wordpress loop
*/
function parse_query( $q ) {
if (is_admin()) return;
// Only apply to product categories, the product post archive, the shop page, and product tags
if ( ( isset( $q->query_vars['suppress_filters'] ) && true == $q->query_vars['suppress_filters'] ) || (!$q->is_tax( 'product_cat' ) && !$q->is_post_type_archive( 'product' ) && !$q->is_page( get_option('woocommerce_shop_page_id') ) && !$q->is_tax( 'product_tag' ))) return;
if (
(
isset( $q->query_vars['suppress_filters'] )
&& true == $q->query_vars['suppress_filters']
) || (
!$q->is_tax( 'product_cat' )
&& !$q->is_tax( 'product_tag' )
&& !$q->is_post_type_archive( 'product' )
// this rule should be covered by the above && !$q->is_page(get_option('woocommerce_shop_page_id'))
)
)
return;
// Meta query
$meta_query = (array) $q->get( 'meta_query' );

View File

@ -58,6 +58,7 @@ For further documentation on using WooCommerce, please sign up for free at http:
== Changelog ==
= 1.0.3 - 02/xx/2011 =
* Several minor fixes/tweaks
* Conditionals check for existing function names
* Made image size settings clearer
* Cleaned up coupon code settings/write panel and added a few more hooks

View File

@ -33,7 +33,7 @@
add_action('init', 'woocommerce_update_catalog_ordering');
function woocommerce_update_catalog_ordering() {
if (isset($_POST['orderby']) && $_POST['orderby'] != '') $_SESSION['orderby'] = $_POST['orderby'];
if (isset($_POST['catalog_orderby']) && $_POST['catalog_orderby'] != '') $_SESSION['orderby'] = $_POST['catalog_orderby'];
}
/**

View File

@ -469,7 +469,7 @@ if (!function_exists('woocommerce_catalog_ordering')) {
?>
<form class="woocommerce_ordering" method="post">
<select name="orderby" class="orderby">
<select name="catalog_orderby" class="orderby">
<option value="title" <?php if (isset($_SESSION['orderby'])) selected( $_SESSION['orderby'], 'title' ); ?>><?php _e('Alphabetically', 'woo themes'); ?></option>
<option value="date" <?php if (isset($_SESSION['orderby'])) selected( $_SESSION['orderby'], 'date' ); ?>><?php _e('Most Recent', 'woothemes'); ?></option>
<option value="price" <?php if (isset($_SESSION['orderby'])) selected( $_SESSION['orderby'], 'price' ); ?>><?php _e('Price', 'woo themes'); ?></option>