2

I have been using magmi to import products in bulk, but now need to delete some of them.

How can I do this?

3 Answers 3

8

Add a column to your import with this as the header name: magmi:delete

1 is to delete the product 0 is to not delete the product

You want to use the Product Deleter v0.0.2 plugin.

2
  • In my case Magmi tries to Clean flat tables before reindexing. I'm not sure if that causes this error: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction. There is some timelimit with the hosting package so I guess it is related to that. Is there a way to make it work? Already tried to laynt the delete process with magmi.cli.php in shell but with no luck as it seems to fail the delete task too as products are not deleted.
    – Webninja
    Commented Sep 15, 2015 at 14:03
  • Hi, what about product resources like "media files" - Are they also deleted from DB and/or filesystem ? Do you have any experiences about this topic ? Regards
    – domi27
    Commented Oct 12, 2016 at 15:53
6

First you need to enable the Product Deleter Plugin.

enter image description here Then you need to create a CSV, with columns "sku" and "magmi:delete". For example:

"sku","magmi:delete"
"00001","1"
"00004","1"

Then run your import.

0

Click Here to add MAGMI into your module -> https://magento.stackexchange.com/a/351175

Enable Product Deleter plugin.

enter image description here

Using CSV

"sku","magmi:delete"
"sku1","1"
"sku2","1"

Using Code

    $importData = [];
    $configProduct = new \Magmi_ProductImport_DataPump('productimport');
    $importData['sku'] = "your Product SKU";
    $importData['magmi:delete'] = "1";
    $configProduct->beginImportSession("default", "update");
    $run = $configProduct->ingest($importData);
    $configProduct->endImportSession();

Check catalog_eav_attribute table in your db . If is_configurable column not present then update below code from getConfigurableOptsFromAsId() function in this file .../magmi/plugins/base/itemprocessors/configurables/magmi_configurableprocessor.php

    //$sql .= " JOIN $cea as cea ON cea.attribute_id=ea.attribute_id AND cea.is_global=1 AND cea.is_configurable=1";
    $sql .= " JOIN $cea as cea ON cea.attribute_id=ea.attribute_id AND cea.is_global=1";
} else {
    //$cond .= " AND ea.is_global=1 AND ea.is_configurable=1";
    $cond .= " AND ea.is_global=1";

Note:- magmi:delete : 1 is to delete the product 0 is to not delete the product

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.