Skip to content

Commit f69b0c4

Browse files
committed
AC-13171: Fixed Product Tax (FPT) is not displaying separately with configurable products
Fix static test failures
1 parent 2ba87a8 commit f69b0c4

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

app/code/Magento/Weee/Plugin/ConfigurableProduct/Block/Product/View/Type/Configurable.php

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@
2121
*/
2222
class Configurable
2323
{
24+
/**
25+
* @param WeeeHelper $weeeHelper
26+
* @param EncoderInterface $jsonEncoder
27+
* @param DecoderInterface $jsonDecoder
28+
*/
2429
public function __construct(
2530
private readonly WeeeHelper $weeeHelper,
2631
private readonly EncoderInterface $jsonEncoder,
2732
private readonly DecoderInterface $jsonDecoder
28-
) {}
33+
) {
34+
}
2935

3036
/**
3137
* Add FPT/WEEE data to option prices
@@ -55,6 +61,9 @@ public function afterGetJsonConfig(
5561

5662
/**
5763
* Check if WEEE should be processed
64+
*
65+
* @param array|null $config
66+
* @return bool
5867
*/
5968
private function shouldProcessWeee(?array $config): bool
6069
{
@@ -63,6 +72,11 @@ private function shouldProcessWeee(?array $config): bool
6372

6473
/**
6574
* Inject processed WEEE data into config
75+
*
76+
* @param array &$config
77+
* @param string $productId
78+
* @param Product $product
79+
* @return void
6680
*/
6781
private function injectWeeeData(array &$config, string $productId, Product $product): void
6882
{
@@ -83,6 +97,9 @@ private function injectWeeeData(array &$config, string $productId, Product $prod
8397

8498
/**
8599
* Convert raw attribute objects into array data
100+
*
101+
* @param array $weeeAttributes
102+
* @return array
86103
*/
87104
private function processWeeeAttributes(array $weeeAttributes): array
88105
{
@@ -108,6 +125,11 @@ private function processWeeeAttributes(array $weeeAttributes): array
108125

109126
/**
110127
* Add formatted WEEE data to price array
128+
*
129+
* @param array &$finalPrice
130+
* @param array $priceFormat
131+
* @param array $weeeData
132+
* @return void
111133
*/
112134
private function appendFormattedWeee(
113135
array &$finalPrice,
@@ -141,6 +163,10 @@ private function appendFormattedWeee(
141163

142164
/**
143165
* Format price using the store's price format
166+
*
167+
* @param float $amount
168+
* @param array $priceFormat
169+
* @return string
144170
*/
145171
private function formatPrice(float $amount, array $priceFormat): string
146172
{

app/code/Magento/Weee/Test/Unit/Plugin/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ public function testAfterGetJsonConfigWithWeeeAttributes(): void
333333
* Test afterGetJsonConfig with multiple WEEE attributes
334334
*
335335
* @return void
336+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
336337
*/
337338
public function testAfterGetJsonConfigWithMultipleWeeeAttributes(): void
338339
{

app/code/Magento/Weee/view/frontend/web/js/price-box-mixin.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ define([
2525
/**
2626
* Override reloadPrice to add WEEE breakdown
2727
*/
28-
reloadPrice: function reDrawPrices () {
29-
var priceFormat = (this.options.priceConfig && this.options.priceConfig.priceFormat) || {},
28+
reloadPrice: function reDrawPrices() {
29+
var priceFormat = this.options.priceConfig && this.options.priceConfig.priceFormat || {},
3030
priceTemplate = mageTemplate(this.options.priceTemplate);
3131

3232
// First, render prices normally
@@ -162,10 +162,10 @@ define([
162162
if ($swatchOptions.length) {
163163
widget = $swatchOptions.data('mage-SwatchRenderer') ||
164164
$swatchOptions.data('mageSwatchRenderer');
165+
}
165166

166-
if (widget) {
167-
return widget;
168-
}
167+
if (widget) {
168+
return widget;
169169
}
170170

171171
// Try product detail page selector

0 commit comments

Comments
 (0)