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

CommentFileSizeAuthor
#9 3016633-9.patch3.05 KBjsacksick

Comments

alexpott created an issue. See original summary.

alexpott’s picture

bojanz’s picture

Status: Postponed » Active
tonytheferg’s picture

+1, however I think it would be a better solution to allow admin users to select from carriers that SupportsTrackingInterface so that shipments created with flat rate shipping methods, and their tracking code can utilize the TrackingLinkFormatter.

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.

alexpott’s picture

@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 :)

tonytheferg’s picture

@alexpott, if we provide a patch, do you think my solution could get included in the module, or should it be a sub module?

alexpott’s picture

@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.

jsacksick’s picture

Let'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 SupportsTrackingInterface

jsacksick’s picture

Status: Active » Needs review
StatusFileSize
new3.05 KB

Here'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.

tonytheferg’s picture

Patch applies cleanly. You can now see the tracking number on the user order display when set to link. Definitely an improvement.

  • jsacksick committed 17d5e6c on 8.x-2.x
    Issue #3016633 by jsacksick, alexpott, tonytheferg: Use...
jsacksick’s picture

Status: Needs review » Fixed

Committed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.