I am building a custom indexer and quick search based on a mysql table with fulltext indices and having some difficulties in understanding the Mage_Index_Model_Event::TYPE_DELETE in conjunction with TYPE_MASS_ACTION.

The Indexer is build very similar to Mage_Catalog_Model_Product_Indexer_Flat.

A single delete event is working just fine, the ID got passed with the data object and I can get it with getId() to proceed the deletion. But when I go to the Backend Catalog -> Manage Products List and mark a few products (via checkbox) for deletion and select the delete action, just one product ID out of the selected set will get deleted, the others remain in my index (via Mage_Index_Model_Event::TYPE_DELETE). I supposed that the deletion of multiple products would be of TYPE_MASS_ACTION, just as it is for status change of products, but it seems not.

What event type gets triggered with multiple products deletion? Even though I would expect to get these to be deleted product IDs with $product = $event->getDataObject(); and $product->getProductIds(). Or is there another way to solve this?

If been digging in Catalog/Model/Product/Indexer/Flat.php, the models and resources and can not find out how it is done.

Been sitting over this a few hours now, I might oversee it. Maybe somebody could shed some light on that question.

Any help and hints are appreciated!

  • This is just an idea. You should put a FK on your index table on the product id column to the catalog_product_entity.entity_id field with ON DELETE CASCADE. This way you don't have to worry about the delete event or the multiple delete event. Everything will cascade nicely.
    – Marius
    Nov 7, 2014 at 15:16
  • @Marius: The table has MyISAM storage type and does not support foreign keys. Have to choose MyISAM, as only Mysql 5.6 InnoDB would support fulltext index. Nov 7, 2014 at 15:25
  • OK. Got it. It was worth a shot. For the flat catalog tables this is how it's done. with FK and cascade.
    – Marius
    Nov 7, 2014 at 15:27
  • @Marius: I already got a bad feeling when you gave your first comment with the FK cascade delete ... :-) OK, at least that explains now how it works. Thx! Seems not to be a simple task then ... sigh! Probably a mysql trigger can help ... Nov 7, 2014 at 15:30

1 Answer 1


To give an answer to my own question:

I tried to emulate Marius suggestion with the on delete cascade by using the on delete trigger. But that trigger is not activated due to a remaining bug in MySQL that is ... "Currently, cascaded foreign key actions do not activate triggers".

So to overcome that I simply synchronize my fulltext index table with an SQL query by getting all product IDs that are not found in the Magento product index and delete them. In fact that the Mage_Index_Model_Event::TYPE_DELETE is sent out this solution works pretty well.

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.