marellocommerce / marello

Marello
Other
51 stars 18 forks source link

Add purchase date for orders #36

Closed clicktrend closed 6 years ago

clicktrend commented 6 years ago

Please add "Purchase Date" to orders to save the date of purchase from sale channel. Attribute CreatedAt is always updated with latest timestamp (see EntityCreatedUpdatedAtTrait).

24198 commented 6 years ago

Hi @clicktrend,

Thank you for reporting. I've looked into the EntityCreatedUpdatedAtTrait and it will 'only' update the createdAt whenever the entity is persisted. In theory this should only happen to the Order once, when it's created, but I think you're hinting on a different scenario where the Order is being updated after it's been created. Do you have specific scenario where it's updating the Order's createdAt after it's being created?

Kind Regards,

Jaimy Casteleijn

clicktrend commented 6 years ago

Hi @Hotlander ,

excuse me if I have used wrong vocabulary to describe the problem. createdAt takes the actual time where order is created (prePersistTimestamp). But I want to set the time myself.

When I POST new order via REST I want to save the purchase date of sales channel. My cronjob is running every X minute and the order's createdAt is set to the cronjobs running time (which is X minutes in the future). I have extended the FormBuilder with "createdAt" to set the date of sales channel but it will be reset with the actual date.

Thanks

24198 commented 6 years ago

Hi @clicktrend,

No problem! I think separating the two dates (createdAt & purchaseDate) makes sense for some scenario's/situations. If you would like to set the purchaseDate by hand instead of relying on the entity's createdAt, I think (for now) adding an additional field through migrations and a FormExtension will be probably be the easiest route. I'll create an internal ticket in order to keep track of this, since we don't actually have something like it on the roadmap or backlog at the moment. Thank you for the feedback, I'll have run it with some colleagues and see if it's something we should add in the future.

Kind Regards,

Jaimy Casteleijn

24198 commented 6 years ago

Hi @clicktrend,

A new field on Orders, purchaseDate, has been added to our latest release (https://github.com/marellocommerce/marello-application/releases/tag/1.5.0). Hopefully this will help solve your issue of setting a purchaseDate explicitly.

Kind Regards,

Jaimy Casteleijn