File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
app/code/Magento/Bundle/Model/ResourceModel
dev/tests/api-functional/testsuite/Magento/Bundle/Api Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -174,8 +174,8 @@ public function saveSelectionPrice($item)
174174 $ values = [
175175 'selection_id ' => $ item ->getSelectionId (),
176176 'website_id ' => $ item ->getWebsiteId (),
177- 'selection_price_type ' => $ item ->getSelectionPriceType (),
178- 'selection_price_value ' => $ item ->getSelectionPriceValue (),
177+ 'selection_price_type ' => $ item ->getSelectionPriceType () ?? 0 ,
178+ 'selection_price_value ' => $ item ->getSelectionPriceValue () ?? 0 ,
179179 'parent_product_id ' => $ item ->getParentProductId (),
180180 ];
181181 $ connection ->insertOnDuplicate (
Original file line number Diff line number Diff line change @@ -87,6 +87,32 @@ public function testAddChild()
8787 $ this ->assertGreaterThan (0 , $ childId );
8888 }
8989
90+ /**
91+ * @magentoApiDataFixture Magento/Bundle/_files/product.php
92+ * @magentoApiDataFixture Magento/Catalog/_files/product_virtual.php
93+ */
94+ public function testAddChildWithoutPriceAndPriceType ()
95+ {
96+ $ productSku = 'bundle-product ' ;
97+ $ children = $ this ->getChildren ($ productSku );
98+
99+ $ optionId = $ children [0 ]['option_id ' ];
100+
101+ $ linkedProduct = [
102+ 'sku ' => 'virtual-product ' ,
103+ 'option_id ' => $ optionId ,
104+ 'position ' => '1 ' ,
105+ 'is_default ' => 1 ,
106+ 'priceType ' => null ,
107+ 'price ' => null ,
108+ 'qty ' => 8 ,
109+ 'can_change_quantity ' => 1 ,
110+ ];
111+
112+ $ childId = $ this ->addChild ($ productSku , $ optionId , $ linkedProduct );
113+ $ this ->assertGreaterThan (0 , $ childId );
114+ }
115+
90116 /**
91117 * Verify empty out of stock bundle product is in stock after child has been added.
92118 *
You can’t perform that action at this time.
0 commit comments