Skip to content

Commit 4d92435

Browse files
authored
Merge pull request #1399 from algolia/update/MAGE-730
Indexed bundled product prices correctly
2 parents c179b52 + 62ac06a commit 4d92435

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Helper/Entity/Product/PriceManager/Bundle.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,21 @@ protected function addAdditionalData($product, $withTax, $subProducts, $currency
4343
*/
4444
protected function getMinMaxPrices(Product $product, $withTax, $subProducts, $currencyCode)
4545
{
46-
$product = $this->productloader->create()->load($product->getId());
47-
$product->setData('website_id', $product->getStore()->getWebsiteId());
48-
$minPrice = $product->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
49-
$minOriginalPrice = $product->getPriceInfo()->getPrice('regular_price')->getMinimalPrice()->getValue();
50-
$maxOriginalPrice = $product->getPriceInfo()->getPrice('regular_price')->getMaximalPrice()->getValue();
51-
$max = $product->getPriceInfo()->getPrice('final_price')->getMaximalPrice()->getValue();
46+
$productWithPrice = $this->productloader->create()->load($product->getId());
47+
$productWithPrice->setData('website_id', $product->getStore()->getWebsiteId());
48+
$minPrice = $productWithPrice->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
49+
$minOriginalPrice = $productWithPrice->getPriceInfo()->getPrice('regular_price')->getMinimalPrice()->getValue();
50+
$maxOriginalPrice = $productWithPrice->getPriceInfo()->getPrice('regular_price')->getMaximalPrice()->getValue();
51+
$max = $productWithPrice->getPriceInfo()->getPrice('final_price')->getMaximalPrice()->getValue();
5252
$minArray = [];
5353
$maxArray = [];
5454
foreach ($this->groups as $group) {
5555
$groupId = (int) $group->getData('customer_group_id');
56-
$product->setData('customer_group_id', $groupId);
57-
$minPrice = $product->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
58-
$minArray[$groupId] = $product->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
59-
$maxArray[$groupId] = $product->getPriceInfo()->getPrice('final_price')->getMaximalPrice()->getValue();
60-
$product->setData('customer_group_id', null);
56+
$productWithPrice->setData('customer_group_id', $groupId);
57+
$minPrice = $productWithPrice->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
58+
$minArray[$groupId] = $productWithPrice->getPriceInfo()->getPrice('final_price')->getMinimalPrice()->getValue();
59+
$maxArray[$groupId] = $productWithPrice->getPriceInfo()->getPrice('final_price')->getMaximalPrice()->getValue();
60+
$productWithPrice->setData('customer_group_id', null);
6161
}
6262

6363
$minPriceArray = [];
@@ -153,4 +153,4 @@ protected function setFinalGroupPricesBundle($field, $currencyCode, $min, $max,
153153
}
154154
}
155155
}
156-
}
156+
}

0 commit comments

Comments
 (0)