Product updated_at timestamp not updated

A couple of weeks ago I needed to look at that product’s “updated_at”-field to determinate if the product was updated recently or not. I was only to discover that the field wasn’t updating at all.

Since my module heavily depended on that field, I needed a fix. There are others out there with the same problem, but it has not yet been fixed by Magento.

I decided to write a quick (and maybe not so nice) module that looks for the event “catalog_product_save_after” and after that execute some custom code. That event is fired both when saving a product in admin or in your custom script.

The script simply performs a SQL-query and sets the updated_at field to MySQL “NOW()”-value. It does not take current Magento timestamp in consideration, it just uses the same date as MySQL has.

Module on Packagist: codepeak/magento2-productfix

Source code on Github: codepeak/magento2-productfix