Skip to content

Commit

Permalink
Fixing offer price computation.
Browse files Browse the repository at this point in the history
  • Loading branch information
romainruaud committed Jan 25, 2018
1 parent 4f93469 commit 66529a2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Model/Product/Indexer/Fulltext/Datasource/OfferData.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public function addData($storeId, array $indexData)
/**
* Process offer prices
*
* @SuppressWarnings(PHPMD.ElseExpression)
*
* @param array $offerData Offer Data
* @param array $productData Product Data
*
Expand All @@ -88,10 +90,11 @@ private function processOfferPrices($offerData, $productData)
$offerData = array_filter($offerData);
$offerData['original_price'] = isset($offerData['price']) ? $offerData['price'] : $defaultPriceData['original_price'];

$offerData['price'] = $defaultPriceData['price'];
if (isset($offerData['special_price'])) {
$offerData['price'] = min($offerData['price'], $offerData['special_price']);
unset($offerData['special_price']);
} else {
$offerData['price'] = $defaultPriceData['price'];
}

$offerData['is_discount'] = $offerData['price'] < $offerData['original_price'];
Expand Down

0 comments on commit 66529a2

Please sign in to comment.