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.


pounard’s picture

Status:Active» Needs work
new1.07 KB

SVN patch attached (sorry no GIT from here).

pounard’s picture

Sorry, wrong patch attached, here is the right one.

rszrama’s picture

Title:commerce_order_uri() does not call commerce_order_uri() for the commerce-order:customer-url token» commerce_order_ui_tokens() should use commerce_order_uri() for its customer-url token
Version:7.x-1.3» 7.x-1.x-dev
Status:Needs work» Fixed

I've committed the fix. I see what you're saying about putting the token in, 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.

pounard’s picture

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.

Status:Fixed» Closed (fixed)

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