Exemplo n.º 1
0
 /**
  * @param \Magento\Catalog\Model\Product $product
  * @param array $images
  * @return void
  */
 protected function processNewAndExistingImages($product, array &$images)
 {
     foreach ($images as &$image) {
         if (empty($image['removed'])) {
             $data = $this->processNewImage($product, $image);
             $this->resourceModel->deleteGalleryValueInStore($image['value_id'], $product->getData($this->metadata->getLinkField()), $product->getStoreId());
             // Add per store labels, position, disabled
             $data['value_id'] = $image['value_id'];
             $data['label'] = isset($image['label']) ? $image['label'] : '';
             $data['position'] = isset($image['position']) ? (int) $image['position'] : 0;
             $data['disabled'] = isset($image['disabled']) ? (int) $image['disabled'] : 0;
             $data['store_id'] = (int) $product->getStoreId();
             $data[$this->metadata->getLinkField()] = (int) $product->getData($this->metadata->getLinkField());
             $this->resourceModel->insertGalleryValueInStore($data);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function deleteGalleryValueInStore($valueId, $entityId, $storeId)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'deleteGalleryValueInStore');
     if (!$pluginInfo) {
         return parent::deleteGalleryValueInStore($valueId, $entityId, $storeId);
     } else {
         return $this->___callPlugins('deleteGalleryValueInStore', func_get_args(), $pluginInfo);
     }
 }