Closed mgsolutionscode closed 7 years ago
@miskec thank you for your feedback. Please format your issue description according to the Issue reporting guidelines.
@veloraven I have updated the issue description. I hope that is better now.
Regards
I just encountered that bug as well. Is there any ETA for a fix?
no ETA yet as the bug has not been confirmed. The original reporter has been asked for information to help us reproduce. Then we need to do that and if an issue then schedule a fix.
@pboisvert what else do you need? His report looks quite helpfull :)
@pboisvert it is very easy to reproduce the error. Just follow the steps from which I wrote in bug report. If I can help you somehow let me know.
I will let @veloraven answer that question. I just saw the "needs update" label which we use when more info is needed. I also see that the report has been edited so perhaps the missing info has been filled in now that was missing when the needs update tag was added. Looks complete to me now.
Thank you for your bug report - internal jira ticket MAGETWO-60169 is created to track this issue.
My shop has encountered same problem. After updating magento from 2.0 to 2.1, some old products can't update updated_at field.
Same here, magento 2.1.0 not updating the "updated_at" field for products, except when the SKU changed.
Same here, Magento 2.1.4... Even tried setting the updated_at field manually without any success. (DateTime, string, null, false, empty string)
We also would like to see this fixed.
Since my project depends on the updated_at field I created a simple module to solve this without hacking core. I know it's not a very neet fix, but it does it job. I've tried saving product using model in custom script and also in admin. And it works for me on Magento 2.1.4.
Created a module if anyone else was in need of the same functionality:
This is becoming a big problem with my store. Any idea when this is going to be fixed?
I'd also really like to know what the status / future is of this issue, or have some sort of patch provided. Also does anybody happen to know if a product going out of stock would generally update this timestamp? I'm sure that quantity updates would NOT cause an update, but stock status change would perhaps?
Any update on this? We're having the same issue with Magento 2.1.0
AFAIK, the updated_at
will update if the data of catalog_product_entity
has changed. For example, the change the sku, product options. We can temporarily use Plugin or Observer to update this table.
Now patch is available from Magento for this issue MDVA-3075_EE_2.1.3_v1_composer.patch 2/16/2017 2:47 PM
Is this only available for EE? Not for CE?
Any update on when a patch for CE will be available?
@Ash-Radwan I used the module that robbanl created: https://github.com/codepeak/magento2-productfix You can always give it a try. Works great for me with Magento 2.1.4
I'm closing this issue as a duplicate of #5385. It was already fixed for develop. Internal ticket for ver. 2.1 - MAGETWO-58514
@veloraven I think #5385 is a different issue.
Repeating the original steps to reproduce on latest develop still gives us the "Actual Result" described here: https://github.com/magento/magento2/issues/6683#issue-178195771
Can you please re-open this issue?
This is causing us to lose a lot of admin edits when integrating the Magento catalog with third party systems (using updated_at to retrieve product changes and merge this with those from other sources).
@robbanl your code is working fine for the products. Can you help me with categories?
Preconditions
Steps to reproduce
Expected result
Actual result
Problem Analyzes
Analyzing catalog_product_entity table it is clear that Default value for that field is CURRENT_TIMESTAMP and Extra is "on update CURRENT_TIMESTAMP".
I have debugging the issue and found source of the problem. When product is saved and if product is not new this class is responsible for updating data in entity table \Magento\Framework\EntityManager\Db\UpdateRow (vendor/magento/framework/EntityManager/Db/UpdateRow.php)
Method "execute" is receiving all product's data in $data variable including new correct value for updated_at field. On line 81 method prepareData return only fields which can be stored in catalog_product_entity table. But in the list of values updated_at is missing.
Now if we look inside prepareData method in the same class, on line 53 all columns which have CURRENT_TIMESTAMP for default values are ignored. And that is the source of problem.
Even if updated_at column has "on update CURRENT_TIMESTAMP" definition it will not update value automatically if values of columns in catalog_product_entity are not changed.
For example there is a product with SKU "testsku" in this case:
UPDATE catalog_product_entity SET sku = 'testsku' WHERE entity_id = 1;
updated_at field will not be updated and will not get new value. However, when product is saved it can get new Name or Description but updated_at info will not be changed.
However if query set new value for SKU field MySQL automatically will set CURRENT_TIMESTAMP to updated_at field. So this query will work:
UPDATE catalog_product_entity SET sku = 'newsku' WHERE entity_id = 1;
Conclusion is that fields which has DEFAULT value CURRENT_TIMESTAMP and "on update CURRENT_TIMESTAMP" definition should not be removed from $data array before save because values will not be updated. In this case it is clear that updated_at value will be changed only if value of any column is changed only in catalog_product_entity table but product entity contain multiple attribute values and updated_at need to be changed when any attribute value for product is changed on save.
Updated at value is important for example in case that we want to check if product is updated and for example pull new data to third party application or something.
Please let me know if you have any questions.
Thanks Milos