Skip to content

Commit 9a4db6b

Browse files
committed
MAGETWO-55729: [Customer] Optimize performance for bundled products with lots of product options
- MAGETWO-60826: Wrong Regular price for dynamic bundle
1 parent b5d4966 commit 9a4db6b

7 files changed

+200
-237
lines changed

dev/tests/integration/testsuite/Magento/Bundle/Model/Product/DynamicBundleWithSpecialPriceCalculatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testPriceForDynamicBundle(array $strategyModifiers, array $expec
5353
$this->assertEquals(
5454
$expectedResults['regularMaximalPrice'],
5555
$priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue(),
56-
'Failed to check minimal regular price on product'
56+
'Failed to check maximal regular price on product'
5757
);
5858
}
5959
}

dev/tests/integration/testsuite/Magento/Bundle/Model/Product/FixedBundlePriceCalculatorTest.php

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,75 @@ public function getTestCases()
116116
// 110 + 30
117117
'maximalPrice' => 140
118118
]
119-
]
119+
],
120+
121+
'
122+
#5 Testing price for fixed bundle product
123+
with fixed sub items, fixed options and without any discounts
124+
' => [
125+
'strategy' => $this->getBundleConfiguration3(
126+
LinkInterface::PRICE_TYPE_FIXED,
127+
self::CUSTOM_OPTION_PRICE_TYPE_FIXED
128+
),
129+
'expectedResults' => [
130+
// 110 + 1 * 20 + 100
131+
'minimalPrice' => 230,
132+
133+
// 110 + 1 * 20 + 100
134+
'maximalPrice' => 230
135+
]
136+
],
137+
138+
'
139+
#6 Testing price for fixed bundle product
140+
with percent sub items, percent options and without any discounts
141+
' => [
142+
'strategy' => $this->getBundleConfiguration3(
143+
LinkInterface::PRICE_TYPE_PERCENT,
144+
self::CUSTOM_OPTION_PRICE_TYPE_PERCENT
145+
),
146+
'expectedResults' => [
147+
// 110 + 110 * 0.2 + 110 * 1
148+
'minimalPrice' => 242,
149+
150+
// 110 + 110 * 0.2 + 110 * 1
151+
'maximalPrice' => 242
152+
]
153+
],
154+
155+
'
156+
#7 Testing price for fixed bundle product
157+
with fixed sub items, percent options and without any discounts
158+
' => [
159+
'strategy' => $this->getBundleConfiguration3(
160+
LinkInterface::PRICE_TYPE_FIXED,
161+
self::CUSTOM_OPTION_PRICE_TYPE_PERCENT
162+
),
163+
'expectedResults' => [
164+
// 110 + 1 * 20 + 110 * 1
165+
'minimalPrice' => 240,
166+
167+
// 110 + 1 * 20 + 110 * 1
168+
'maximalPrice' => 240
169+
]
170+
],
171+
172+
'
173+
#8 Testing price for fixed bundle product
174+
with percent sub items, fixed options and without any discounts
175+
' => [
176+
'strategy' => $this->getBundleConfiguration3(
177+
LinkInterface::PRICE_TYPE_PERCENT,
178+
self::CUSTOM_OPTION_PRICE_TYPE_FIXED
179+
),
180+
'expectedResults' => [
181+
// 110 + 110 * 0.2 + 100
182+
'minimalPrice' => 232,
183+
184+
// 110 + 110 * 0.2 + 100
185+
'maximalPrice' => 232
186+
]
187+
],
120188
];
121189
}
122190

@@ -275,4 +343,51 @@ private function getProductWithDifferentPrice()
275343
],
276344
];
277345
}
346+
347+
/**
348+
* Fixed bundle product with required option, custom option and without any discounts
349+
* @param $selectionsPriceType
350+
* @param $customOptionsPriceType
351+
* @return array
352+
*/
353+
private function getBundleConfiguration3($selectionsPriceType, $customOptionsPriceType)
354+
{
355+
$optionsData = [
356+
[
357+
'title' => 'Op1',
358+
'required' => true,
359+
'type' => 'checkbox',
360+
'links' => [
361+
[
362+
'sku' => 'simple1',
363+
'qty' => 1,
364+
'price' => 20,
365+
'price_type' => $selectionsPriceType
366+
],
367+
]
368+
],
369+
];
370+
371+
$customOptionsData = [
372+
[
373+
'price_type' => $customOptionsPriceType,
374+
'title' => 'Test Field',
375+
'type' => 'field',
376+
'is_require' => 1,
377+
'price' => 100,
378+
'sku' => '1-text',
379+
]
380+
];
381+
382+
return [
383+
[
384+
'modifierName' => 'addSimpleProduct',
385+
'data' => [$optionsData]
386+
],
387+
[
388+
'modifierName' => 'addCustomOption',
389+
'data' => [$customOptionsData]
390+
],
391+
];
392+
}
278393
}

0 commit comments

Comments
 (0)