Problem/Motivation
In #2854035-59: Create an admin UI for shipments we made the tracking code appear by default on the edit form for Shipment entities. It would be great for usability if the shipment list builder and view used the TrackingLinkFormatter but that only returns a link if the shipping method used has the SupportsTrackingInterface.
Proposed resolution
If the shipping method does not have SupportsTrackingInterface then TrackingLinkFormatter should return the tracking code string if present. This will allow admins to enter and see a tracking code if they've sold something with flat rate shipping, got a tracking code at the post office, entered it in the UI.
This means that list will display a link for the tracking code where possible which is good for usability. They also will display manually entered tracking codes correctly.
Remaining tasks
User interface changes
Use the TrackingLinkFormatter in shipment listings
API changes
None
Data model changes
None
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3016633-9.patch | 3.05 KB | jsacksick |
Comments
Comment #2
alexpottPostponed on #2854035: Create an admin UI for shipments
Comment #3
bojanz commentedComment #4
tonytheferg commented+1, however I think it would be a better solution to allow admin users to select from carriers that
SupportsTrackingInterfaceso that shipments created with flat rate shipping methods, and their tracking code can utilize theTrackingLinkFormatter.As stated above, shipments with flat rate shipping methods don't support links. See also: https://www.drupal.org/project/commerce_shipping/issues/3105876#comment-...
What if when the admin enters the tracking code on a flat rate shipment, they could select a supported carrier?
You would essentially be ascribing a flat rate shipment to a supported carrier. This populated list of carriers could be configured in shipment type settings, so that only the desired carriers populate the selectable options.
I'm not sure how many carriers aren't supported by
SupportsTrackingInterface, so might still be a need to address edge cases where a shipment utilizes an unsupported carrier.Comment #5
alexpott@tonytheferg sure we can improve the UI further but as this seemed a simple idea to improve things. It's 2 and a half years ago so my memory of this is a little fuzzy :)
Comment #6
tonytheferg commented@alexpott, if we provide a patch, do you think my solution could get included in the module, or should it be a sub module?
Comment #7
alexpott@tonytheferg I remember thinking that the module should do this - but I'm not a maintainer of the module - see https://www.drupal.org/node/1076370/maintainers so we need to convince one of them - probably @jsacksick or @mglaman. If you provide a patch with automated test coverage then hopefully someone will review.
Comment #8
jsacksick commentedLet's start by implementing the initial suggestion from @alexpott which is simple enough and already a nice addition.
So as described, update the view to use the TrackingLinkFormatter and fallback to outputting the tracking code for shipping methods that don't implement the
SupportsTrackingInterfaceComment #9
jsacksick commentedHere's a first stab at this.
Note that the change was just made to the view, and not the shipments list builder itself. (So the shipment list builder would still show the code for whoever decides not to use the view) :p.
Comment #10
tonytheferg commentedPatch applies cleanly. You can now see the tracking number on the user order display when set to link. Definitely an improvement.
Comment #12
jsacksick commentedCommitted!