/** * {@inheritdoc} */ protected function saveItem(Product $product, array $item) { if (isset($item['sample'])) { $this->sampleItem = $item['sample']; unset($item['sample']); } return parent::saveItem($product, $item); }
/** * @param \Magento\Framework\Json\Helper\Data $jsonHelper * @param \Magento\Downloadable\Helper\File $downloadableFile * @param \Magento\Downloadable\Model\SampleFactory $sampleFactory * @param \Magento\Downloadable\Model\Resource\SampleFactory $sampleResourceFactory */ public function __construct(\Magento\Framework\Json\Helper\Data $jsonHelper, \Magento\Downloadable\Helper\File $downloadableFile, \Magento\Downloadable\Model\SampleFactory $sampleFactory, \Magento\Downloadable\Model\Resource\SampleFactory $sampleResourceFactory) { parent::__construct($jsonHelper, $downloadableFile); $this->sampleFactory = $sampleFactory; $this->sampleResourceFactory = $sampleResourceFactory; }