Merge pull request #6023 from krautnerds/master

Re-add all filters of widget on change of category
This commit is contained in:
Mike Jolley 2014-08-15 13:45:39 +01:00
commit 9deee73b72
2 changed files with 4 additions and 10 deletions

View File

@ -142,7 +142,7 @@ function wc_product_dropdown_categories( $args = array(), $deprecated_hierarchic
return;
}
$output = "<select name='product_cat' id='dropdown_product_cat'>";
$output = "<select name='product_cat' class='dropdown_product_cat'>";
$output .= '<option value="" ' . selected( $current_product_cat, '', false ) . '>' . __( 'Select a category', 'woocommerce' ) . '</option>';
$output .= wc_walk_category_dropdown_tree( $terms, 0, $args );
if ( $args['show_uncategorized'] ) {

View File

@ -200,15 +200,9 @@ class WC_Widget_Product_Categories extends WC_Widget {
wc_product_dropdown_categories( apply_filters( 'woocommerce_product_categories_widget_dropdown_args', $dropdown_args ) );
?>
<script type='text/javascript'>
/* <![CDATA[ */
var product_cat_dropdown = document.getElementById("dropdown_product_cat");
function onProductCatChange() {
if ( product_cat_dropdown.options[product_cat_dropdown.selectedIndex].value !=='' ) {
location.href = "<?php echo home_url(); ?>/?product_cat="+product_cat_dropdown.options[product_cat_dropdown.selectedIndex].value;
}
}
product_cat_dropdown.onchange = onProductCatChange;
/* ]]> */
jQuery('.dropdown_product_cat').change(function() {
location.href = "<?php echo home_url(); ?>/?product_cat="+jQuery(this).val()+"&"+location.search.substring(1);
});
</script>
<?php