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.
The commerce_order_uri()
function does not use the commerce_order_uri()
hook in order to compute the order URL, thus leaving an hardcoded user/' . $order->uid . '/orders/' . $order->order_id
instead.
Additional note, the commerce-order:customer-url
should probably belong to the commerce_order module instead, thus allowing modules to given an URI without the need of enabling the commerce_order_ui module.
Comment | File | Size | Author |
---|---|---|---|
#2 | 1705316-2-commerce_order_uri_call_in_token_replacement.patch | 1.03 KB | pounard |
#1 | 1705316-1-commerce_order_uri_call_in_token_replacement.patch | 1.07 KB | pounard |
Comments
Comment #1
pounardSVN patch attached (sorry no GIT from here).
Comment #2
pounardSorry, wrong patch attached, here is the right one.
Comment #3
rszrama CreditAttribution: rszrama commentedI've committed the fix. I see what you're saying about putting the token in commerce_order.tokens.inc, but I'm undecided. The problem is we need to conditionally make the token available in hook_token_info() - I suppose we could do this by checking to see if a module implements hook_commerce_order_uri() and making it available if any does. But it's still less than perfect - what should we do if no valid URI is returned? Should the token be empty, potentially breaking its usage in some links?
I'm up for ideas; I'm going to mark this bug report fixed for now, though, and we can consider moving it separately if need be. At least as it stands we can be assured of a fallback URL.
Comment #4
pounardI see what you mean, you don't want to provide the token if there's no way to have a URL. Your solution of exposing it if no modules implements the hook_commerce_order_uri() sounds fine. I have no strong fealings about this.