Skip to content

Commit 3aba465

Browse files
committed
ACP2E-2224: Regular Price does not show on PLP for Configurable Product
- improvements for updated PAT failures
1 parent f1bfb2b commit 3aba465

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

app/code/Magento/Catalog/Block/Product/ListProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ protected function getPriceRender()
446446
if ($this->specialPriceMap === null) {
447447
$this->specialPriceMap = $this->specialPriceBulkResolver->generateSpecialPriceMap(
448448
(int)$this->_storeManager->getStore()->getId(),
449-
$this->_productCollection
449+
$this->_getProductCollection()
450450
);
451451
}
452452

dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/CheckProductPriceTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Catalog\Block\Product\ListProduct;
99

10+
use Magento\Catalog\Model\ResourceModel\Product\Collection;
1011
use Magento\Catalog\Api\ProductRepositoryInterface;
1112
use Magento\Catalog\Block\Product\ListProduct;
1213
use Magento\Catalog\Test\Fixture\Category as CategoryFixture;
@@ -52,6 +53,11 @@ class CheckProductPriceTest extends TestCase
5253
*/
5354
private $customerSession;
5455

56+
/**
57+
* @var Collection
58+
*/
59+
private $productCollection;
60+
5561
/**
5662
* @inheritdoc
5763
*/
@@ -61,6 +67,7 @@ protected function setUp(): void
6167
$this->pageFactory = $this->objectManager->get(PageFactory::class);
6268
$this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
6369
$this->customerSession = $this->objectManager->create(Session::class);
70+
$this->productCollection = $this->objectManager->create(Collection::class);
6471
parent::setUp();
6572
}
6673

@@ -120,6 +127,7 @@ public function testCheckProductPriceWithoutAdditionalPriceConfigurations(): voi
120127
* Assert that product special price rendered correctly.
121128
*
122129
* @magentoDataFixture Magento/Catalog/_files/product_special_price.php
130+
* @magentoDbIsolation disabled
123131
*
124132
* @return void
125133
*/
@@ -162,6 +170,7 @@ public function testCheckPercentTierPrice(): void
162170
* Assert that price of product with fixed tier price for not logged user is renders correctly.
163171
*
164172
* @magentoDataFixture Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user.php
173+
* @magentoDbIsolation disabled
165174
*
166175
* @return void
167176
*/
@@ -356,6 +365,9 @@ private function assertRegularPrice(string $priceHtml, float $expectedPrice): vo
356365
private function getProductPriceHtml(string $sku): string
357366
{
358367
$product = $this->productRepository->get($sku, false, null, true);
368+
if (false === in_array($product->getId(), $this->productCollection->getAllIds())) {
369+
$this->productCollection->addItem($product);
370+
}
359371

360372
return preg_replace('/[\n\r]/', '', $this->getListProductBlock()->getProductPrice($product));
361373
}
@@ -375,6 +387,8 @@ private function getListProductBlock(): ListProduct
375387
$page->getLayout()->generateXml();
376388
/** @var Template $categoryProductsBlock */
377389
$categoryProductsBlock = $page->getLayout()->getBlock('category.products');
390+
$listProduct = $categoryProductsBlock->getChildBlock('product_list');
391+
$listProduct->setCollection($this->productCollection);
378392

379393
return $categoryProductsBlock->getChildBlock('product_list');
380394
}

dev/tests/integration/testsuite/Magento/Catalog/Pricing/Render/FinalPriceBox/RenderingBasedOnIsProductListFlagTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public function testRenderingByDefault()
102102
public function testRenderingAccordingToIsProductListFlag($flag)
103103
{
104104
$this->finalPriceBox->setData('is_product_list', $flag);
105+
$this->finalPriceBox->setData('special_price_map', [$this->product->getId() => true]);
105106
$html = $this->finalPriceBox->toHtml();
106107
self::assertStringContainsString('5.99', $html);
107108
$this->assertGreaterThanOrEqual(

dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableViewOnCategoryPageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function testCheckConfigurablePriceOnSecondWebsite(): void
126126
'fixture_second_store',
127127
[$this, 'assertProductPrice'],
128128
'configurable',
129-
__('As low as') . ' $10.00 '
129+
__('As low as') . ' $10.00'
130130
);
131131
$this->resetPageLayout();
132132
$this->assertProductPrice('configurable', '$150.00');

0 commit comments

Comments
 (0)