Hi, I want to create a link in the order confirmation template (post checkout) that will pick up some variables to pass to own script. As a minimum I need to pick up the order number i.e.
If you use this link on the order landing page or order details page in the storefront, you will need to use the {$order_info.order_id} Smarty variable to get an order ID. Please check it.
Since original post I have decided a better way is to scrub the above in terms of link location - I would rather place the link in the 'Account Info' block as something like 'My Config' which just passes the user id to the script. I assume (although perhaps a dangerous assumption!) that user ids never get re-used if a user is deleted…!
I have successfully added a link as list item within a smarty {if $auth.user_id && $auth.user_id==2} so that it only displays for my 'test user' for the moment. I can pass the variables via GET or POST (if I make a little form with hidden fields) so this is all ok.
My only issue now is that I am using a custom block/template on the target page which detects if user logged in etc. so they get a nice system message rather than a '404' error. The custom block loads my script into an iframe if the $auth.user_id condition is true.
My challenge now is to get the variables passed by my link in the my_account.tpl template link though the custom block to the script which loads in the iframe!!!
The process will need to be:
Link in 'My Account' clicked > passes variables to 2) the 'content page' which contains the custom block/template and then pass the variables on to 3) the script.php that that is called into the iframe.
I think it's quite simple but just need to know what smarty variables are available to the custom page at stage 2 i.e. $auth.user_id etc. If user id, firstname, lastname etc. are available then I won't even need to include any variables in the my_account.tpl link.
Ok, so I found the answer myself and posting back as, although it may seem really obvious, er, kind of took me a while to get it… and it might help someone else looking for the same answer.
```php
{foreach from=$user_info key=k item=v}
{$k}: {$v}
{/foreach}
```
outputs:
[list]
[*]user_id: 2
[*]user_login: user_2
[*]company_id: 0
[*]firstname: Bilbo
[*]lastname: Baggins
[*]email: bilbo.baggins@middle.earth
[*]user_type: C
[/list]
So, there I have it... {$user_info.firstname} blah blah...