Posted by pounard on July 30, 2012 at 2:10pm
3 followers
| Project: | Drupal Commerce |
| Version: | 7.x-1.x-dev |
| Component: | Order |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
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.
Comments
#1
SVN patch attached (sorry no GIT from here).
#2
Sorry, wrong patch attached, here is the right one.
#3
I'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.
#4
I 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.
#5
Automatically closed -- issue fixed for 2 weeks with no activity.