Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I noticed that #1207242: Add support for Product revisions is now in Commerce, and I've spotted the fieldset on product edit. However, I haven't been able to find Views support or any diff/history support on products. Does the current version only provide the actual saving of revisions in the database, or are there tools to view them as well, that I just haven't found?
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedNope, no way. Neither product nor order revisions have any default way to be displayed at the moment. I'm not sure if we can integrate them with Views or if a module like diff can work for any entity type, but there's an open issue to research this for Orders somewhere. It would apply similarly to all the Commerce entity types.
Comment #2
AdamGerthel CreditAttribution: AdamGerthel commentedRegarding orders, I presume you are referring to #804850: Integrate Order Revisions with Views which we've already implemented. I guess someone needs to do the legwork to make it happen for products as well
Comment #3
a.ross CreditAttribution: a.ross commentedWe're at a point where there is a tab with the order revisions, but no way for the admin to view the revisions or differences between them. Any way to fix that?
Crosslinking: #1939356: Diffs for Commerce Product entity
Comment #4
rszrama CreditAttribution: rszrama commentedI don't think we need to re-open this issue about product history for order history diffs. The order revision view requires administer order permissions for now - it's a bit much, but I'm not entirely sure how to make View access order specific. I have no clue how Diff works.
Comment #5
a.ross CreditAttribution: a.ross commentedBeing able to views diffs would be great, but just being able to view the revision is enough for me... the view with the list doesn't cut it when shop managers fail to enter log information when they update products.
Comment #6
rszrama CreditAttribution: rszrama commentedSo even with administer orders permission the view isn't showing for you?
Comment #7
a.ross CreditAttribution: a.ross commentedYou misunderstand. The view works fine, what I was asking for was a way to view the Product Revisions individually (or even view a diff between them if possible).
Comment #8
rszrama CreditAttribution: rszrama commentedAhh, ok. There's a similar revisions tab for products using the administer products permission. Diff integration is still another beast, though.
Comment #9
a.ross CreditAttribution: a.ross commentedYes the tab works fine and diff is just a nice-to-have, not a requirement. But that's not what I meant.
I want to be able to view the data of a specific previous revision. Is that possible or do I need to go into the database?
Comment #10
rszrama CreditAttribution: rszrama commentedlol Ok, I see. Yes, this is unsupported, and given that we don't have product "viewing" as is anyways, I'm not sure what it'd take to make it happen. It might be something you can build through Views - for example, revision field data would be available if you wanted to show it in the overview table - but given that we don't have revision ID specific loading you may have a hard time building a "full" view of the revision entity. Same for orders, fwiw. : P
Comment #11
a.ross CreditAttribution: a.ross commentedheheh ok that's that cleared up.
And in our case I would display more columns, if it weren't for the fact that there are zillions of fields :/
We could always just view the columns we need using the Views UI preview feature though, that might work.
Anyway, thanks for the help. Do you think normal displaying of the entities in question will be implemented at some point?
Comment #12
rszrama CreditAttribution: rszrama commentedIt definitely will in Commerce 2.x.
One thing you might consider if you have a bunch of fields but don't have them all on every product would be to put all the fields in a single column or something. Basically build a mini-display using labels and a line break separator or something with all the field data showing together. Empty fields would (or could?) just be ignored on any given row where there weren't values. But yeah, that's probably still not an ideal solution from a query building / performance standpoint.
Comment #13
AdamPS CreditAttribution: AdamPS commentedIn case it helps, I think the issue that this is a duplicate of is #1827292: Integrate Product Revisions with Views, which I have added as a related issue.
As previously mentioned, the related issue, now fixed, covers the views, but not the diffs.