Jurgen Rutten Posted August 31, 2021 Share Posted August 31, 2021 (edited) Goodmorning all, I'm trying to create a costum link in a costum tpl file Example: <a href='https://example.com/?uid={$customer.firstname}'>outsidelink</a> Sadly, the element 'customer.firstname' (or any other smarty variables) do not seem to be working. I'm on 1.7 in a multistore context; and I need to save a token somewhere to put into a field to send as a token to an external platform of ours as a reference. If anyone has an idea on how to fix this, and which parameters would work that would be great, I was thinking about writing costum php but I don't think that's the right practice in this case. And I don't have a lot of experience in php, it's not my daily thing. Edited August 31, 2021 by Jurgen Rutten (see edit history) Link to comment Share on other sites More sharing options...
endriu107 Posted August 31, 2021 Share Posted August 31, 2021 To your tpl file add {debug} then visit page you want to add this, new window should popup with variables you have access on that page. Link to comment Share on other sites More sharing options...
Jurgen Rutten Posted August 31, 2021 Author Share Posted August 31, 2021 5 minutes ago, endriu107 said: To your tpl file add {debug} then visit page you want to add this, new window should popup with variables you have access on that page. Thank you! This clearly shows I'm missing the fields I want. How can I add these as an option? Link to comment Share on other sites More sharing options...
endriu107 Posted August 31, 2021 Share Posted August 31, 2021 In controller of this custom file you need to pass data to smarty, you can check how it is done in few modules for example ps_customersignin should pass this data so check in it. Link to comment Share on other sites More sharing options...
Jurgen Rutten Posted August 31, 2021 Author Share Posted August 31, 2021 I'm struggling, can anyone provide an example? Or a guide for reference? Link to comment Share on other sites More sharing options...
endriu107 Posted August 31, 2021 Share Posted August 31, 2021 How did you create custom tpl file? You create module or new controller? Link to comment Share on other sites More sharing options...
Jurgen Rutten Posted August 31, 2021 Author Share Posted August 31, 2021 1 minute ago, endriu107 said: How did you create custom tpl file? You create module or new controller? It's created as a costum for the front-end, in the module AP Pagebuilder, I don't think it has a file reference. As far as I know it's a standalone element that's loaded onto each page that has the shortcode. Link to comment Share on other sites More sharing options...
endriu107 Posted August 31, 2021 Share Posted August 31, 2021 I think in this case you should ask AP Pagebuilder module developer. Link to comment Share on other sites More sharing options...
Jurgen Rutten Posted August 31, 2021 Author Share Posted August 31, 2021 3 minutes ago, endriu107 said: I think in this case you should ask AP Pagebuilder module developer. What would be the normal way of using a tpl to create a link? Any documentation on that? Link to comment Share on other sites More sharing options...
endriu107 Posted August 31, 2021 Share Posted August 31, 2021 Here is link to official documentation: https://devdocs.prestashop.com/1.7/modules/concepts/controllers/front-controllers/ 1 Link to comment Share on other sites More sharing options...
Jurgen Rutten Posted August 31, 2021 Author Share Posted August 31, 2021 2 minutes ago, endriu107 said: Here is link to official documentation: https://devdocs.prestashop.com/1.7/modules/concepts/controllers/front-controllers/ This can work, slamming some code in a file now Link to comment Share on other sites More sharing options...
endriu107 Posted August 31, 2021 Share Posted August 31, 2021 You also supposed to have acces in javascript to customer try in console prestashop.customer.firstname Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now