Skip to content

Commit

Permalink
Merge branch 'trunk' into develop-pwa-studio-5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Cody Nguyen committed Jul 9, 2020
2 parents af9167c + f19f80c commit fcddd0f
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions app/code/Simi/Simiconnector/Helper/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,12 @@ public function filterCollectionByAttribute($collection, $params, &$cat_filtered
foreach ($params['filter']['layer'] as $key => $value) {
if ($key == 'price') {
$value = explode('-', $value);
$select = $collection->getSelect();
$whereFunction = 'where';
if ($value[0] > 0) {
$this->filteredAttributes[$key] = $value;
$minPrice = $value[0];
$select->$whereFunction('price_index.final_price >= ' . $minPrice . " OR ( price_index.final_price = '0.0000' AND price_index.min_price >=" . $minPrice . ')');
}
if ($value[1] > 0) {
$this->filteredAttributes[$key] = $value;
$maxPrice = $value[1];
$select->$whereFunction('price_index.final_price < ' . $maxPrice . " OR ( price_index.final_price = '0.0000' AND price_index.min_price >=" . $maxPrice . ')');
}
$priceFilter = array();
if (isset($value[0]))
$priceFilter['from'] = $value[0];
if (isset($value[0]))
$priceFilter['to'] = $value[1];
$collection->addFieldToFilter('price', $priceFilter);
} else {
if ($key == 'category_id') {
$cat_filtered = true;
Expand Down

0 comments on commit fcddd0f

Please sign in to comment.