0

I've created a link that should look like this:

www.mystore.com/yourorder?order_id=12345678&email=youremail@example.com

The user will be taken to an order tracking page.

But the url ends up looking like this:

http://www.mystore.com/yourorder?order_id=%7b%7bvar%20order.increment_id/&email=youremail%40hotmail.com%27%7d%7d

The template code looks like this:

<a href="{{store url='yourorder?order_id={{var order.increment_id}}&email={{var order.getCustomerEmail()}}'}}">here</a>

The {{var order.increment_id}} is getting mangled there, but works fine in the email subject and elsewhere in the body. But the email address is turning out sort of ok (except for those trailing strange characters).

I had double quotes around the url value at first and thought single quotes inside might help with parsing, but single quotes made no difference.

Solution:

  1. Fixed unnecessary nesting of variables. (Thanks to Peter O'Callaghan's answer)
  2. Changed {{store url='yourorder'}} to {{config path='web/secure/base_url'}}. Otherwise, http redirected to https and (for some reason) lost the url parameters I was trying to pass.

    <a href="{{config path='web/secure/base_url'}}yourorder?order_id={{var order.increment_id}}&email={{var order.getCustomerEmail()}}">here</a>

2

The simplest solution in this instance is probably to move the var substitution outside of the url generation so you don't have nested directives.

<a href="{{store url='yourorder'}}?order_id={{var order.increment_id}}&email={{var order.getCustomerEmail()}}">here</a>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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