Skip to content

Commit

Permalink
FIx #539 : price slider bounds display.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurélien FOUCRET committed Feb 23, 2018
1 parent 90074ce commit b647b03
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function apply(\Magento\Framework\App\RequestInterface $request)

$this->getLayer()->getProductCollection()->addFieldToFilter(
$this->getAttributeModel()->getAttributeCode(),
['from' => $fromValue, 'to' => $toValue]
['gte' => $fromValue, 'lt' => $toValue]
);

$this->getLayer()->getState()->addFilter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ define(["jquery", 'Magento_Catalog/js/price-utils', 'mage/template', "jquery/ui"
$.widget('smileEs.rangeSlider', {

options: {
fromLabel : '[data-role=from-label]',
toLabel : '[data-role=to-label]',
sliderBar : '[data-role=slider-bar]',
message : '[data-role=message-box]',
applyButton : '[data-role=apply-range]',
rate : 1.0000,
fromLabel : '[data-role=from-label]',
toLabel : '[data-role=to-label]',
sliderBar : '[data-role=slider-bar]',
message : '[data-role=message-box]',
applyButton : '[data-role=apply-range]',
rate : 1.0000,
maxLabelOffset : 0.01,
messageTemplates : {
"displayCount": '<span class="msg"><%- count %> items</span>',
"displayEmpty": '<span class="msg-error">No items in the current range.</span>'
}
},
},

_create: function () {
Expand Down Expand Up @@ -78,7 +79,7 @@ define(["jquery", 'Magento_Catalog/js/price-utils', 'mage/template', "jquery/ui"
}

if (this.element.find('[data-role=to-label]')) {
this.element.find('[data-role=to-label]').html(this._formatLabel(this.to));
this.element.find('[data-role=to-label]').html(this._formatLabel(this.to - this.options.maxLabelOffset));
}

if (this.element.find('[data-role=message-box]')) {
Expand Down Expand Up @@ -109,7 +110,7 @@ define(["jquery", 'Magento_Catalog/js/price-utils', 'mage/template', "jquery/ui"

_getItemCount : function() {
var from = this.from, to = this.to, intervals = this.intervals;
var count = intervals.map(function(item) {return item.value >= from && item.value <= to ? item.count : 0;})
var count = intervals.map(function(item) {return item.value >= from && item.value < to ? item.count : 0;})
.reduce(function(a,b) {return a + b;});
return count;
},
Expand Down

0 comments on commit b647b03

Please sign in to comment.