Skip to content

Commit 9e01988

Browse files
author
cspruiell
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-61509-Schema-Comparison
2 parents 5542ee3 + 67ec6f9 commit 9e01988

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveO
564564
$this->resourceModel->getLinkField(),
565565
$existingProduct->getData($this->resourceModel->getLinkField())
566566
);
567+
if (!$product->hasData(Product::STATUS)) {
568+
$product->setStatus($existingProduct->getStatus());
569+
}
567570
} catch (NoSuchEntityException $e) {
568571
$existingProduct = null;
569572
}

app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
<item name="add_variables" xsi:type="boolean">false</item>
194194
<item name="add_widgets" xsi:type="boolean">false</item>
195195
<item name="add_images" xsi:type="boolean">false</item>
196+
<item name="add_directives" xsi:type="boolean">true</item>
196197
</item>
197198
<item name="source" xsi:type="string">category</item>
198199
</item>

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,4 +1266,34 @@ public function testSpecialPrice()
12661266
$this->assertEquals(0, count(array_intersect($attributeCodes, $missingAttributes)));
12671267
$this->assertEquals(2, count(array_intersect($attributeCodes, $expectedAttribute)));
12681268
}
1269+
1270+
public function testUpdateStatus()
1271+
{
1272+
// Create simple product
1273+
$productData = [
1274+
ProductInterface::SKU => "product_simple_502",
1275+
ProductInterface::NAME => "Product Simple 502",
1276+
ProductInterface::VISIBILITY => 4,
1277+
ProductInterface::TYPE_ID => 'simple',
1278+
ProductInterface::PRICE => 100,
1279+
ProductInterface::STATUS => 0,
1280+
ProductInterface::TYPE_ID => 'simple',
1281+
ProductInterface::ATTRIBUTE_SET_ID => 4,
1282+
];
1283+
1284+
// Save product with status disabled
1285+
$this->saveProduct($productData);
1286+
$response = $this->getProduct($productData[ProductInterface::SKU]);
1287+
$this->assertEquals(0, $response['status']);
1288+
1289+
// Update the product
1290+
$productData[ProductInterface::PRICE] = 200;
1291+
$this->saveProduct($productData);
1292+
$response = $this->getProduct($productData[ProductInterface::SKU]);
1293+
1294+
// Status should still be disabled
1295+
$this->assertEquals(0, $response['status']);
1296+
// Price should be updated
1297+
$this->assertEquals(200, $response['price']);
1298+
}
12691299
}

0 commit comments

Comments
 (0)