[Experimental] Fix minor issues of new filter blocks (#45305)
* fix: make the dropdown hidden by default * fix: price clause * fix: variable name in attribute clause generator * chore: changelog * fix: flashing issue for dropdown has selected items
This commit is contained in:
parent
ebd54a7c59
commit
8e200a35b7
|
@ -0,0 +1,5 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
Comment: Experimental: fixes some minor issue with new filter blocks: query clause and initial dropdown style
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ class Dropdown {
|
|||
<div class="wc-interactivity-dropdown__dropdown" tabindex="-1" >
|
||||
<div class="wc-interactivity-dropdown__dropdown-selection" id="options-dropdown" tabindex="0" aria-haspopup="listbox">
|
||||
<span class="wc-interactivity-dropdown__placeholder" data-wc-text="state.placeholderText">
|
||||
<?php echo esc_html( $placeholder ); ?>
|
||||
<?php echo empty( $selected_items ) ? esc_html( $placeholder ) : ''; ?>
|
||||
</span>
|
||||
<?php if ( 'multiple' === $select_type ) { ?>
|
||||
<div class="selected-options">
|
||||
|
@ -98,7 +98,13 @@ class Dropdown {
|
|||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
<div data-wc-bind--hidden="!context.isOpen" class="wc-interactivity-dropdown__dropdown-list" aria-labelledby="options-dropdown" role="listbox">
|
||||
<div
|
||||
class="wc-interactivity-dropdown__dropdown-list"
|
||||
aria-labelledby="options-dropdown"
|
||||
role="listbox"
|
||||
data-wc-bind--hidden="!context.isOpen"
|
||||
<?php echo esc_attr( $dropdown_context['isOpen'] ? '' : 'hidden' ); ?>
|
||||
>
|
||||
<?php
|
||||
foreach ( $items as $item ) :
|
||||
$context = array( 'item' => $item );
|
||||
|
|
|
@ -235,9 +235,9 @@ final class QueryFilters {
|
|||
$min_price_filter = intval( $wp_query->get( 'min_price' ) );
|
||||
|
||||
if ( $adjust_for_taxes ) {
|
||||
$args['where'] .= $this->get_price_filter_query_for_displayed_taxes( $min_price_filter, 'min_price', '>=' );
|
||||
$args['where'] .= $this->get_price_filter_query_for_displayed_taxes( $min_price_filter, 'max_price', '>=' );
|
||||
} else {
|
||||
$args['where'] .= $wpdb->prepare( ' AND wc_product_meta_lookup.min_price >= %f ', $min_price_filter );
|
||||
$args['where'] .= $wpdb->prepare( ' AND wc_product_meta_lookup.max_price >= %f ', $min_price_filter );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,9 +245,9 @@ final class QueryFilters {
|
|||
$max_price_filter = intval( $wp_query->get( 'max_price' ) );
|
||||
|
||||
if ( $adjust_for_taxes ) {
|
||||
$args['where'] .= $this->get_price_filter_query_for_displayed_taxes( $max_price_filter, 'max_price', '<=' );
|
||||
$args['where'] .= $this->get_price_filter_query_for_displayed_taxes( $max_price_filter, 'min_price', '<=' );
|
||||
} else {
|
||||
$args['where'] .= $wpdb->prepare( ' AND wc_product_meta_lookup.max_price <= %f ', $max_price_filter );
|
||||
$args['where'] .= $wpdb->prepare( ' AND wc_product_meta_lookup.min_price <= %f ', $max_price_filter );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -475,7 +475,7 @@ final class QueryFilters {
|
|||
if ( ! empty( $clauses ) ) {
|
||||
// "temp" is needed because the extra derived tables require an alias.
|
||||
$args['where'] .= ' AND (' . join( ' temp ) AND ', $clauses ) . ' temp ))';
|
||||
} elseif ( ! empty( $attributes_to_filter_by ) ) {
|
||||
} elseif ( ! empty( $chosen_attributes ) ) {
|
||||
$args['where'] .= ' AND 1=0';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue