Skip to content

Commit 7d7193d

Browse files
committed
ACP2E-3513: [CLOUD] Special price not showing in Configurable product
1 parent 30d0b82 commit 7d7193d

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2011 Adobe
4+
* All Rights Reserved.
55
*/
6-
76
namespace Magento\ConfigurableProduct\Model\Product\Type;
87

98
use Magento\Catalog\Api\Data\ProductAttributeInterface;
@@ -1483,7 +1482,8 @@ private function getAttributesForCollection(\Magento\Catalog\Model\Product $prod
14831482
'thumbnail',
14841483
'status',
14851484
'visibility',
1486-
'media_gallery'
1485+
'media_gallery',
1486+
'special_price',
14871487
];
14881488

14891489
$usedAttributes = array_map(

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

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2017 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox;
77

88
use Magento\Catalog\Api\Data\ProductInterface;
9+
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
910
use Magento\Catalog\Api\ProductRepositoryInterface;
1011
use Magento\Catalog\Model\Product;
1112
use Magento\Catalog\Pricing\Price\FinalPrice;
1213
use Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox;
14+
use Magento\Framework\App\Area;
1315
use Magento\Framework\Pricing\Render\Amount;
1416
use Magento\Framework\Pricing\Render\RendererPool;
17+
use Magento\TestFramework\Fixture\AppArea;
18+
use Magento\TestFramework\Fixture\DataFixture;
19+
use Magento\TestFramework\Fixture\DbIsolation;
1520
use Magento\TestFramework\Helper\Bootstrap;
1621

1722
/**
@@ -101,6 +106,26 @@ public function testRenderingByDefault()
101106
);
102107
}
103108

109+
#[
110+
DataFixture('Magento/ConfigurableProduct/_files/product_configurable.php'),
111+
AppArea(Area::AREA_FRONTEND),
112+
DbIsolation(false),
113+
]
114+
public function testHasSpecialPrice(): void
115+
{
116+
$productAttributeRepository = Bootstrap::getObjectManager()->get(ProductAttributeRepositoryInterface::class);
117+
$specialPrice = $productAttributeRepository->get('special_price');
118+
$specialPrice->setUsedInProductListing(false);
119+
$productAttributeRepository->save($specialPrice);
120+
121+
try {
122+
self::assertTrue($this->finalPriceBox->hasSpecialPrice());
123+
} finally {
124+
$specialPrice->setUsedInProductListing(true);
125+
$productAttributeRepository->save($specialPrice);
126+
}
127+
}
128+
104129
/**
105130
* Test when is_product_list flag is specified
106131
*

0 commit comments

Comments
 (0)