Pass order no. in a link to external script

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.



Now go to the blah blah configuration




I've only used psuedo examples above, not real CS-Cart variables!



Help would be appreciated - tight timeline…

Hello Wilko,



Thank you for your message.



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.



Thank you.





Pavel Zyukin

CS-Cart Support team

Thanks Pavel,



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:


  1. 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, to simplify my need - I think that I just need a template hook to declare in my custom template to pull in the user info variables - is it

{hook name=“profiles:my_account_menu”}?



Could do with a list somewhere of what to call and variable names?



I need to access the logged-in user's profile data - at least id, firstname, lastname, email address/username



Your help is always appreciated!

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...

    ```php
    My Link To Custom Non CS-Cart Script
    ```

    Does the job...

    Hello Wilko,



    I am glad to hear you managed to resolve the problem. Thank you for keeping me informed.





    Pavel Zyukin

    CS-Cart Support team