Skip to content

Commit 30f55fc

Browse files
committed
Revert "#35881: Final Price for grouped products does not include tax in the Recently Viewed Widget and Meta price"
This reverts commit 0bb2e31.
1 parent 60702e1 commit 30f55fc

File tree

4 files changed

+26
-59
lines changed

4 files changed

+26
-59
lines changed

app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Price.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111
use Magento\Catalog\Api\Data\ProductRender\PriceInfoInterfaceFactory;
1212
use Magento\Catalog\Api\Data\ProductRenderInterface;
1313
use Magento\Catalog\Model\ProductRender\FormattedPriceInfoBuilder;
14-
use Magento\Catalog\Pricing\Price\FinalPrice;
15-
use Magento\Catalog\Pricing\Price\RegularPrice;
1614
use Magento\Catalog\Ui\DataProvider\Product\ProductRenderCollectorInterface;
1715
use Magento\Framework\Pricing\PriceCurrencyInterface;
18-
use Magento\GroupedProduct\Model\Product\Type\Grouped;
1916

2017
/**
2118
* Collect information about base prices of products
@@ -25,6 +22,18 @@
2522
*/
2623
class Price implements ProductRenderCollectorInterface
2724
{
25+
/** FInal Price key */
26+
const KEY_FINAL_PRICE = "final_price";
27+
28+
/** Minimal Price key */
29+
const KEY_MINIMAL_PRICE = "minimal_price";
30+
31+
/** Regular Price key */
32+
const KEY_REGULAR_PRICE = "regular_price";
33+
34+
/** Max Price key */
35+
const KEY_MAX_PRICE = "max_price";
36+
2837
/**
2938
* @var PriceCurrencyInterface
3039
*/
@@ -75,38 +84,31 @@ public function collect(ProductInterface $product, ProductRenderInterface $produ
7584
$priceInfo = $this->priceInfoFactory->create();
7685
}
7786

78-
if ($product->getTypeId() === Grouped::TYPE_CODE) {
79-
$product = $product
80-
->getPriceInfo()
81-
->getPrice(FinalPrice::PRICE_CODE)
82-
->getMinProduct();
83-
}
84-
8587
$priceInfo->setFinalPrice(
8688
$product
8789
->getPriceInfo()
88-
->getPrice(FinalPrice::PRICE_CODE)
90+
->getPrice('final_price')
8991
->getAmount()
9092
->getValue()
9193
);
9294
$priceInfo->setMinimalPrice(
9395
$product
9496
->getPriceInfo()
95-
->getPrice(FinalPrice::PRICE_CODE)
97+
->getPrice('final_price')
9698
->getMinimalPrice()
9799
->getValue()
98100
);
99101
$priceInfo->setRegularPrice(
100102
$product
101103
->getPriceInfo()
102-
->getPrice(RegularPrice::PRICE_CODE)
104+
->getPrice('regular_price')
103105
->getAmount()
104106
->getValue()
105107
);
106108
$priceInfo->setMaxPrice(
107109
$product
108110
->getPriceInfo()
109-
->getPrice(FinalPrice::PRICE_CODE)
111+
->getPrice('final_price')
110112
->getMaximalPrice()
111113
->getValue()
112114
);

app/code/Magento/Catalog/view/frontend/templates/product/view/opengraph/general.phtml

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,21 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
use Magento\Catalog\Block\Product\View;
8-
use Magento\Catalog\Model\Product;
9-
use Magento\Catalog\Pricing\Price\FinalPrice;
10-
use Magento\Framework\Escaper;
11-
use Magento\GroupedProduct\Model\Product\Type\Grouped;
12-
13-
/**
14-
* @var View $block
15-
* @var Escaper $escaper
16-
*/
7+
/** @var $block \Magento\Catalog\Block\Product\View */
178
?>
189

1910
<meta property="og:type" content="product" />
2011
<meta property="og:title"
21-
content="<?= $escaper->escapeHtmlAttr($block->stripTags($block->getProduct()->getName())) ?>" />
12+
content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getName())) ?>" />
2213
<meta property="og:image"
23-
content="<?= $escaper->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>"
24-
/>
14+
content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" />
2515
<meta property="og:description"
26-
content="<?= $escaper->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" />
16+
content="<?= $block->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" />
2717
<meta property="og:url" content="<?= $block->escapeUrl($block->getProduct()->getProductUrl()) ?>" />
28-
<?php
29-
if ($block->getProduct()->getTypeId() === Grouped::TYPE_CODE):
30-
/** @var Product $minProduct */
31-
$minProduct = $block->getProduct()
32-
->getPriceInfo()
33-
->getPrice(FinalPrice::PRICE_CODE)
34-
->getMinProduct();
35-
36-
$priceAmount = $minProduct->getPriceInfo()
37-
->getPrice(FinalPrice::PRICE_CODE)
38-
->getAmount();
39-
else:
40-
$priceAmount = $block->getProduct()
41-
->getPriceInfo()
42-
->getPrice(FinalPrice::PRICE_CODE)
43-
->getAmount();
44-
endif;
45-
?>
46-
47-
<?php if ($priceAmount !== null): ?>
48-
<meta property="product:price:amount" content="<?= $block->escapeHtmlAttr($priceAmount) ?>"/>
49-
<?= $block->getChildHtml('meta.currency') ?>
18+
<?php if ($priceAmount = $block->getProduct()
19+
->getPriceInfo()
20+
->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)
21+
->getAmount()):?>
22+
<meta property="product:price:amount" content="<?= $block->escapeHtmlAttr($priceAmount) ?>"/>
23+
<?= $block->getChildHtml('meta.currency') ?>
5024
<?php endif;?>

app/code/Magento/GroupedProduct/view/base/web/template/product/price/special_price.html

Lines changed: 0 additions & 6 deletions
This file was deleted.

app/code/Magento/GroupedProduct/view/frontend/ui_component/widget_recently_viewed.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
<item name="regular_price" xsi:type="array">
1818
<item name="bodyTmpl" xsi:type="string">Magento_GroupedProduct/product/price/regular_price</item>
1919
</item>
20-
<item name="special_price" xsi:type="array">
21-
<item name="bodyTmpl" xsi:type="string">Magento_GroupedProduct/product/price/special_price</item>
22-
</item>
2320
<item name="minimal_price" xsi:type="array">
2421
<item name="label" xsi:type="string" translate="true">Starting at</item>
2522
<item name="bodyTmpl" xsi:type="string">Magento_GroupedProduct/product/price/minimal_price</item>

0 commit comments

Comments
 (0)