Esempio n. 1
0
 /**
  * @param \Magento\Catalog\Model\Product $product
  * @return $this
  */
 protected function duplicate($product)
 {
     $mediaGalleryData = $product->getData($this->getAttribute()->getAttributeCode());
     if (!isset($mediaGalleryData['images']) || !is_array($mediaGalleryData['images'])) {
         return $this;
     }
     $this->resourceModel->duplicate($this->getAttribute()->getAttributeId(), isset($mediaGalleryData['duplicate']) ? $mediaGalleryData['duplicate'] : [], $product->getOriginalId(), $product->getData($this->metadata->getLinkField()));
     return $this;
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function duplicate($attributeId, $newFiles, $originalProductId, $newProductId)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'duplicate');
     if (!$pluginInfo) {
         return parent::duplicate($attributeId, $newFiles, $originalProductId, $newProductId);
     } else {
         return $this->___callPlugins('duplicate', func_get_args(), $pluginInfo);
     }
 }