0

Magento 2.1.1.

Is there any way to set custom created_at attribute on newly created product? I used method $product->setCreatedAt($date) before saving it. Value is set on product object, but finally when saving it into db, mysql mechanism is trigger, which sets current timestamp, not mine. I logged sql queries, and field created_at is not in insert into catalog_product_entity, so it's actually normal that mysql fills that field with default value.

Only way I could modify it was pure sql, but it is not a way to go.

  • Why do you need change time of product creation/modification? – KAndy Jul 11 '17 at 9:50
  • its data migration, and timestamps from previous db are meant to be created_at timestamps – Bartosz Kubicki Jul 11 '17 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.