Commit 15b3dfaf by lmf

断点

parent e98a3f5f
......@@ -108,27 +108,31 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal
foreach ($existingMediaGalleryEntries as $key => $existingEntry) {
$existingEntryTypes = (array)$existingEntry->getTypes();
$existingEntry->setTypes(array_diff($existingEntryTypes, $entryTypes));
$this->remove($sku,$existingEntry->getId());
// if ($existingEntry->getId() == $entry->getId()) {
// $found = true;
// $existingMediaGalleryEntries[$key] = $entry;
// }
unset($existingMediaGalleryEntries[$key]);
$found = true;
break;
}
if (!$found) {
throw new NoSuchEntityException(
__('No image with the provided ID was found. Verify the ID and try again.')
);
}
$product->setMediaGalleryEntries($existingMediaGalleryEntries);
try {
$this->productRepository->save($product);
} catch (\Exception $exception) {
throw new StateException(__("The product can't be saved."));
}
return $this->create($sku,$entry);
// if (!$found) {
// throw new NoSuchEntityException(
// __('No image with the provided ID was found. Verify the ID and try again.')
// );
// }
// $product->setMediaGalleryEntries($existingMediaGalleryEntries);
//
// try {
// $this->productRepository->save($product);
// } catch (\Exception $exception) {
// throw new StateException(__("The product can't be saved."));
// }
// return true;
//return true;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment