Skip to content

Commit 440e9eb

Browse files
MAGETWO-91711: Unable to delete downloadable product links if sample links are not deleted
- Set empty arrays if info doesn't come from request.
1 parent 8fd89cf commit 440e9eb

File tree

1 file changed

+7
-0
lines changed
  • app/code/Magento/Downloadable/Controller/Adminhtml/Product/Initialization/Helper/Plugin

1 file changed

+7
-0
lines changed

app/code/Magento/Downloadable/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Downloadable.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use Magento\Downloadable\Api\Data\SampleInterfaceFactory;
1212
use Magento\Downloadable\Api\Data\LinkInterfaceFactory;
1313

14+
/**
15+
* Class for initialization downloadable info from request.
16+
*/
1417
class Downloadable
1518
{
1619
/**
@@ -92,6 +95,8 @@ public function afterInitialize(
9295
}
9396
}
9497
$extension->setDownloadableProductLinks($links);
98+
} else {
99+
$extension->setDownloadableProductLinks([]);
95100
}
96101
if (isset($downloadable['sample']) && is_array($downloadable['sample'])) {
97102
$samples = [];
@@ -107,6 +112,8 @@ public function afterInitialize(
107112
}
108113
}
109114
$extension->setDownloadableProductSamples($samples);
115+
} else {
116+
$extension->setDownloadableProductSamples([]);
110117
}
111118
$product->setExtensionAttributes($extension);
112119
if ($product->getLinksPurchasedSeparately()) {

0 commit comments

Comments
 (0)