From 66529a29a164dba0acf6a9c1d5bd02dba818b8aa Mon Sep 17 00:00:00 2001 From: Romain Ruaud Date: Wed, 24 Jan 2018 15:34:10 +0100 Subject: [PATCH] Fixing offer price computation. --- Model/Product/Indexer/Fulltext/Datasource/OfferData.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Model/Product/Indexer/Fulltext/Datasource/OfferData.php b/Model/Product/Indexer/Fulltext/Datasource/OfferData.php index 82b90bd..84d9ffe 100644 --- a/Model/Product/Indexer/Fulltext/Datasource/OfferData.php +++ b/Model/Product/Indexer/Fulltext/Datasource/OfferData.php @@ -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 * @@ -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'];