Skip to content

Commit 77fefd8

Browse files
committed
#9342: Process selection_can_change_qty during import
1 parent 57f4ad2 commit 77fefd8

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ protected function populateSelectionTemplate($selection, $optionId, $parentId, $
299299
} else {
300300
$productId = $selection['product_id'];
301301
}
302+
302303
$populatedSelection = [
303304
'selection_id' => null,
304305
'option_id' => (int)$optionId,
@@ -310,7 +311,7 @@ protected function populateSelectionTemplate($selection, $optionId, $parentId, $
310311
? self::SELECTION_PRICE_TYPE_FIXED : self::SELECTION_PRICE_TYPE_PERCENT,
311312
'selection_price_value' => (isset($selection['price'])) ? (float)$selection['price'] : 0.0,
312313
'selection_qty' => (isset($selection['default_qty'])) ? (float)$selection['default_qty'] : 1.0,
313-
'selection_can_change_qty' => 1,
314+
'selection_can_change_qty' => isset($selection['can_change_qty']) ? ($selection['can_change_qty'] ? 1 : 0) : 1,
314315
];
315316
if (isset($selection['selection_id'])) {
316317
$populatedSelection['selection_id'] = $selection['selection_id'];

dev/tests/integration/testsuite/Magento/BundleImportExport/Model/Import/Product/Type/BundleTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ public function testBundleImport()
104104
$optionSku = 'Simple ' . ($optionKey + 1 + $linkKey);
105105
$this->assertEquals($optionIdList[$optionSku], $productLink->getData('entity_id'));
106106
$this->assertEquals($optionSku, $productLink->getData('sku'));
107+
108+
switch ($optionKey) {
109+
case 0:
110+
$this->assertEquals(1, $productLink->getData('selection_can_change_qty'));
111+
break;
112+
case 1:
113+
$this->assertEquals(0, $productLink->getData('selection_can_change_qty'));
114+
break;
115+
case 2:
116+
$this->assertEquals(1, $productLink->getData('selection_can_change_qty'));
117+
break;
118+
}
107119
}
108120
}
109121
}

dev/tests/integration/testsuite/Magento/BundleImportExport/Model/Import/_files/import_bundle.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ sku,store_view_code,attribute_set_code,product_type,product_websites,name,produc
22
Simple 1,,Default,simple,base,Simple 1,1,100,,1000,0,1,,,,,
33
Simple 2,,Default,simple,base,Simple 2,1,200,,1000,0,1,,,,,
44
Simple 3,,Default,simple,base,Simple 3,1,300,,1000,0,1,,,,,
5-
Bundle 1,,Default,bundle,base,Bundle 1,1,,shipment_type=separately,0,0,1,dynamic,dynamic,Price range,dynamic,"name=Option 1,type=checkbox,required=1,sku=Simple 1,price=0.0000,default=0,default_qty=1.0000,price_type=fixed|name=Option 2,type=checkbox,required=1,sku=Simple 2,price=0.0000,default=0,default_qty=1.0000,price_type=fixed|name=Option 2,type=checkbox,required=1,sku=Simple 3,price=0.0000,default=0,default_qty=1.0000,price_type=fixed"
5+
Bundle 1,,Default,bundle,base,Bundle 1,1,,shipment_type=separately,0,0,1,dynamic,dynamic,Price range,dynamic,"name=Option 1,type=checkbox,required=1,sku=Simple 1,price=0.0000,default=0,default_qty=1.0000,price_type=fixed,can_change_qty=1|name=Option 2,type=checkbox,required=1,sku=Simple 2,price=0.0000,default=0,default_qty=1.0000,price_type=fixed,can_change_qty=0|name=Option 2,type=checkbox,required=1,sku=Simple 3,price=0.0000,default=0,default_qty=1.0000,price_type=fixed"

0 commit comments

Comments
 (0)