Skip to content

Commit a4056d4

Browse files
author
Michail Slabko
committed
MAGETWO-36162: Unable to change some product information corresponding to all store view (storeId = 0) in multiwebsite structure through API service
1 parent 7fb1b3d commit a4056d4

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

app/code/Magento/Catalog/Api/Data/ProductWebsiteLinkInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
interface ProductWebsiteLinkInterface
1313
{
1414
/**
15-
* @return string|null
15+
* @return string
1616
*/
1717
public function getSku();
1818

app/code/Magento/Catalog/Api/ProductWebsiteLinkRepositoryInterface.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,34 @@
99
interface ProductWebsiteLinkRepositoryInterface
1010
{
1111
/**
12-
* Assign a product to the websites
12+
* Assign a product to the website
1313
*
1414
* @param \Magento\Catalog\Api\Data\ProductWebsiteLinkInterface $productWebsiteLink
15-
* @return bool will returned True if assigned
15+
* @return bool will returned True if website successfully assigned to product
1616
*
1717
* @throws \Magento\Framework\Exception\CouldNotSaveException
1818
* @throws \Magento\Framework\Exception\InputException
1919
*/
2020
public function save(Data\ProductWebsiteLinkInterface $productWebsiteLink);
2121

2222
/**
23-
* Remove the websites assignment from the product by product sku
23+
* Remove the website assignment from the product
24+
*
25+
* @param \Magento\Catalog\Api\Data\ProductWebsiteLinkInterface $productWebsiteLink
26+
* @return bool will returned True if website successfully unassigned from product
27+
*
28+
* @throws \Magento\Framework\Exception\CouldNotSaveException
29+
*/
30+
public function delete(Data\ProductWebsiteLinkInterface $productWebsiteLink);
31+
32+
/**
33+
* Remove the website assignment from the product by product sku
2434
*
2535
* @param string $sku
2636
* @param int $websiteId
27-
* @return bool will returned True if websites successfully unassigned from product
37+
* @return bool will returned True if website successfully unassigned from product
2838
*
29-
* @throws \Magento\Framework\Exception\StateException
39+
* @throws \Magento\Framework\Exception\CouldNotSaveException
3040
*/
3141
public function deleteById($sku, $websiteId);
3242
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ public function save(ProductWebsiteLinkInterface $productWebsiteLink)
5151
return true;
5252
}
5353

54+
/**
55+
* {@inheritdoc}
56+
*/
57+
public function delete(ProductWebsiteLinkInterface $productLink)
58+
{
59+
return $this->deleteById($productLink->getSku(), $productLink->getSku());
60+
}
61+
5462
/**
5563
* {@inheritdoc}
5664
*/

app/code/Magento/Catalog/etc/webapi.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@
385385
<resource ref="Magento_Catalog::categories" />
386386
</resources>
387387
</route>
388+
389+
<!-- Product Website Links -->
388390
<route url="/V1/products/:sku/websites" method="POST">
389391
<service class="Magento\Catalog\Api\ProductWebsiteLinkRepositoryInterface" method="save" />
390392
<resources>

0 commit comments

Comments
 (0)