How to delete product images using magento csv import in magento 2?
Magento Version: 2.1.0
We have added the wrong image for some of the products when importing through Magento CSV import. we want to remove the images from those products and add new images or replace the images for the same.
We are trying to import using the normal Magento import functionality by selecting replace option. If we select to delete it will delete the complete product. Same issue we will get if we want to remove any multiselect option and add new for any particular product.
EX: if SKU is xyz456 - we added 3 images before and we want to remove these and add new 3 or 4 images or replace the images for the same SKU then it is not working. It will add new images also and it will keep old images also.
Same way if we have selected multiselect options for attribute lets say material: wood, iron and we want to change it to steel, copper then it is not allowing. It will add Material: wood, iron, steel, copper
Can anyone please explain how we can update these. Magento has not provided clear documentation on product import and export functionality.
magento2 magento-2.1 product-images csv magento2.1.0
bumped to the homepage by Community♦ 5 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
Magento Version: 2.1.0
We have added the wrong image for some of the products when importing through Magento CSV import. we want to remove the images from those products and add new images or replace the images for the same.
We are trying to import using the normal Magento import functionality by selecting replace option. If we select to delete it will delete the complete product. Same issue we will get if we want to remove any multiselect option and add new for any particular product.
EX: if SKU is xyz456 - we added 3 images before and we want to remove these and add new 3 or 4 images or replace the images for the same SKU then it is not working. It will add new images also and it will keep old images also.
Same way if we have selected multiselect options for attribute lets say material: wood, iron and we want to change it to steel, copper then it is not allowing. It will add Material: wood, iron, steel, copper
Can anyone please explain how we can update these. Magento has not provided clear documentation on product import and export functionality.
magento2 magento-2.1 product-images csv magento2.1.0
bumped to the homepage by Community♦ 5 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
Magento Version: 2.1.0
We have added the wrong image for some of the products when importing through Magento CSV import. we want to remove the images from those products and add new images or replace the images for the same.
We are trying to import using the normal Magento import functionality by selecting replace option. If we select to delete it will delete the complete product. Same issue we will get if we want to remove any multiselect option and add new for any particular product.
EX: if SKU is xyz456 - we added 3 images before and we want to remove these and add new 3 or 4 images or replace the images for the same SKU then it is not working. It will add new images also and it will keep old images also.
Same way if we have selected multiselect options for attribute lets say material: wood, iron and we want to change it to steel, copper then it is not allowing. It will add Material: wood, iron, steel, copper
Can anyone please explain how we can update these. Magento has not provided clear documentation on product import and export functionality.
magento2 magento-2.1 product-images csv magento2.1.0
Magento Version: 2.1.0
We have added the wrong image for some of the products when importing through Magento CSV import. we want to remove the images from those products and add new images or replace the images for the same.
We are trying to import using the normal Magento import functionality by selecting replace option. If we select to delete it will delete the complete product. Same issue we will get if we want to remove any multiselect option and add new for any particular product.
EX: if SKU is xyz456 - we added 3 images before and we want to remove these and add new 3 or 4 images or replace the images for the same SKU then it is not working. It will add new images also and it will keep old images also.
Same way if we have selected multiselect options for attribute lets say material: wood, iron and we want to change it to steel, copper then it is not allowing. It will add Material: wood, iron, steel, copper
Can anyone please explain how we can update these. Magento has not provided clear documentation on product import and export functionality.
magento2 magento-2.1 product-images csv magento2.1.0
magento2 magento-2.1 product-images csv magento2.1.0
edited Dec 27 '17 at 6:39
Prince Patel
13.3k54676
13.3k54676
asked Dec 27 '17 at 6:37
RahulRahul
161
161
bumped to the homepage by Community♦ 5 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 5 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Use following code to remove image from product in Magento2.
// Instance of object manager
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$productId = Your_Product_Id; // Id of product
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId);
$productRepository = $objectManager->create('MagentoCatalogApiProductRepositoryInterface');
$existingMediaGalleryEntries = $product->getMediaGalleryEntries();
foreach ($existingMediaGalleryEntries as $key => $entry) {
unset($existingMediaGalleryEntries[$key]);
}
$product->setMediaGalleryEntries($existingMediaGalleryEntries);
$productRepository->save($product);
We want to remove or replace the image using magento csv import how we can do this..? Can you please explain....Do we need to write any code for this..? We want to do all product updates, addition, remove etc.... using csv import.
– Rahul
Dec 28 '17 at 6:36
magento 2.2.6 this doesnt work.
– TTech IT Solutions
Sep 20 '18 at 14:48
add a comment |
You can do it by Following the steps in ,
http://docs.magento.com/m1/ce/user_guide/store-operations/dataflow.html
We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.
Aravind, you have recently gone through a few questions and just posted links to documentation. That's not helpful.
– benmarks♦
Dec 27 '17 at 13:28
This is for magento 1 ..... you cannot remove product image. If we select delete while importing it deletes complete product.
– Rahul
Dec 28 '17 at 6:38
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f207226%2fhow-to-delete-product-images-using-magento-csv-import-in-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use following code to remove image from product in Magento2.
// Instance of object manager
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$productId = Your_Product_Id; // Id of product
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId);
$productRepository = $objectManager->create('MagentoCatalogApiProductRepositoryInterface');
$existingMediaGalleryEntries = $product->getMediaGalleryEntries();
foreach ($existingMediaGalleryEntries as $key => $entry) {
unset($existingMediaGalleryEntries[$key]);
}
$product->setMediaGalleryEntries($existingMediaGalleryEntries);
$productRepository->save($product);
We want to remove or replace the image using magento csv import how we can do this..? Can you please explain....Do we need to write any code for this..? We want to do all product updates, addition, remove etc.... using csv import.
– Rahul
Dec 28 '17 at 6:36
magento 2.2.6 this doesnt work.
– TTech IT Solutions
Sep 20 '18 at 14:48
add a comment |
Use following code to remove image from product in Magento2.
// Instance of object manager
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$productId = Your_Product_Id; // Id of product
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId);
$productRepository = $objectManager->create('MagentoCatalogApiProductRepositoryInterface');
$existingMediaGalleryEntries = $product->getMediaGalleryEntries();
foreach ($existingMediaGalleryEntries as $key => $entry) {
unset($existingMediaGalleryEntries[$key]);
}
$product->setMediaGalleryEntries($existingMediaGalleryEntries);
$productRepository->save($product);
We want to remove or replace the image using magento csv import how we can do this..? Can you please explain....Do we need to write any code for this..? We want to do all product updates, addition, remove etc.... using csv import.
– Rahul
Dec 28 '17 at 6:36
magento 2.2.6 this doesnt work.
– TTech IT Solutions
Sep 20 '18 at 14:48
add a comment |
Use following code to remove image from product in Magento2.
// Instance of object manager
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$productId = Your_Product_Id; // Id of product
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId);
$productRepository = $objectManager->create('MagentoCatalogApiProductRepositoryInterface');
$existingMediaGalleryEntries = $product->getMediaGalleryEntries();
foreach ($existingMediaGalleryEntries as $key => $entry) {
unset($existingMediaGalleryEntries[$key]);
}
$product->setMediaGalleryEntries($existingMediaGalleryEntries);
$productRepository->save($product);
Use following code to remove image from product in Magento2.
// Instance of object manager
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$productId = Your_Product_Id; // Id of product
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId);
$productRepository = $objectManager->create('MagentoCatalogApiProductRepositoryInterface');
$existingMediaGalleryEntries = $product->getMediaGalleryEntries();
foreach ($existingMediaGalleryEntries as $key => $entry) {
unset($existingMediaGalleryEntries[$key]);
}
$product->setMediaGalleryEntries($existingMediaGalleryEntries);
$productRepository->save($product);
answered Dec 27 '17 at 10:57
Chander ShekharChander Shekhar
536315
536315
We want to remove or replace the image using magento csv import how we can do this..? Can you please explain....Do we need to write any code for this..? We want to do all product updates, addition, remove etc.... using csv import.
– Rahul
Dec 28 '17 at 6:36
magento 2.2.6 this doesnt work.
– TTech IT Solutions
Sep 20 '18 at 14:48
add a comment |
We want to remove or replace the image using magento csv import how we can do this..? Can you please explain....Do we need to write any code for this..? We want to do all product updates, addition, remove etc.... using csv import.
– Rahul
Dec 28 '17 at 6:36
magento 2.2.6 this doesnt work.
– TTech IT Solutions
Sep 20 '18 at 14:48
We want to remove or replace the image using magento csv import how we can do this..? Can you please explain....Do we need to write any code for this..? We want to do all product updates, addition, remove etc.... using csv import.
– Rahul
Dec 28 '17 at 6:36
We want to remove or replace the image using magento csv import how we can do this..? Can you please explain....Do we need to write any code for this..? We want to do all product updates, addition, remove etc.... using csv import.
– Rahul
Dec 28 '17 at 6:36
magento 2.2.6 this doesnt work.
– TTech IT Solutions
Sep 20 '18 at 14:48
magento 2.2.6 this doesnt work.
– TTech IT Solutions
Sep 20 '18 at 14:48
add a comment |
You can do it by Following the steps in ,
http://docs.magento.com/m1/ce/user_guide/store-operations/dataflow.html
We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.
Aravind, you have recently gone through a few questions and just posted links to documentation. That's not helpful.
– benmarks♦
Dec 27 '17 at 13:28
This is for magento 1 ..... you cannot remove product image. If we select delete while importing it deletes complete product.
– Rahul
Dec 28 '17 at 6:38
add a comment |
You can do it by Following the steps in ,
http://docs.magento.com/m1/ce/user_guide/store-operations/dataflow.html
We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.
Aravind, you have recently gone through a few questions and just posted links to documentation. That's not helpful.
– benmarks♦
Dec 27 '17 at 13:28
This is for magento 1 ..... you cannot remove product image. If we select delete while importing it deletes complete product.
– Rahul
Dec 28 '17 at 6:38
add a comment |
You can do it by Following the steps in ,
http://docs.magento.com/m1/ce/user_guide/store-operations/dataflow.html
You can do it by Following the steps in ,
http://docs.magento.com/m1/ce/user_guide/store-operations/dataflow.html
answered Dec 27 '17 at 9:21
aravindaravind
310113
310113
We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.
We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.
Aravind, you have recently gone through a few questions and just posted links to documentation. That's not helpful.
– benmarks♦
Dec 27 '17 at 13:28
This is for magento 1 ..... you cannot remove product image. If we select delete while importing it deletes complete product.
– Rahul
Dec 28 '17 at 6:38
add a comment |
Aravind, you have recently gone through a few questions and just posted links to documentation. That's not helpful.
– benmarks♦
Dec 27 '17 at 13:28
This is for magento 1 ..... you cannot remove product image. If we select delete while importing it deletes complete product.
– Rahul
Dec 28 '17 at 6:38
Aravind, you have recently gone through a few questions and just posted links to documentation. That's not helpful.
– benmarks♦
Dec 27 '17 at 13:28
Aravind, you have recently gone through a few questions and just posted links to documentation. That's not helpful.
– benmarks♦
Dec 27 '17 at 13:28
This is for magento 1 ..... you cannot remove product image. If we select delete while importing it deletes complete product.
– Rahul
Dec 28 '17 at 6:38
This is for magento 1 ..... you cannot remove product image. If we select delete while importing it deletes complete product.
– Rahul
Dec 28 '17 at 6:38
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f207226%2fhow-to-delete-product-images-using-magento-csv-import-in-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown