Skip to content

Commit

Permalink
Merge pull request #7 from delyriand/fix-offer-price
Browse files Browse the repository at this point in the history
Fixing offer price value
  • Loading branch information
romainruaud authored Mar 14, 2018
2 parents 66529a2 + 633848a commit db65dd3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Model/Product/Indexer/Fulltext/Datasource/OfferData.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ public function addData($storeId, array $indexData)
/**
* Process offer prices
*
* @SuppressWarnings(PHPMD.ElseExpression)
*
* @param array $offerData Offer Data
* @param array $productData Product Data
*
Expand All @@ -84,17 +82,16 @@ private function processOfferPrices($offerData, $productData)
foreach ($productData['price'] as $currentPriceData) {
if ($currentPriceData['customer_group_id'] == CustomerGroupInterface::NOT_LOGGED_IN_ID) {
$defaultPriceData = $currentPriceData;
break;
}
}

$offerData = array_filter($offerData);
$offerData['original_price'] = isset($offerData['price']) ? $offerData['price'] : $defaultPriceData['original_price'];

$offerData['price'] = $offerData['original_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 db65dd3

Please sign in to comment.