1

I'm trying to create a link from the Order view back to the product page so a customer can order it again. I've added a field to the view to load commerce_display_path (and set it as hidden) then another field that is some metadata about the original purchase (the line item is customised and I'll get the product page to read that url and repeat the customisation). That field uses rewrite rules for display like so

<a href="[commerce_display_path]?bundleId=[econecom_bundle_id-value]">Reorder</a>

However the commerce_display_path is relative so I end up with a URL like node/6?bundleId=71398558 and when used from the orders page the browser sees http://127.0.0.1:8080/drupal/user/142/orders/node/6?bundleId=71398558, which is useless.

If I manually put a / at the beginning of the a tag it will get the wrong url because in my test environment drupal is running as /drupal. I could put /drupal in but I think there should be a better way to get the sites base url into the rewrite rules.

1 Answer 1

0

I'm not sure where your second token is coming from, but assuming that's part of the View as well, why are you rewriting the link directly with HTML instead of using the "Output this field as a link" code that's designed to accept Drupal paths and generate appropriate absolute URLs from them? That's what I'd do or else I'd look into rewriting the commerce_display_path field as well to make it work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.