nicolas.espiau Posted January 21, 2013 Share Posted January 21, 2013 Hi everyone, I'm developing a module for which I need to generate a link to an action of the admin controller of the module. I did not found documentation that helps me. I don't know the rules I have to follow to write an admin controller (name, syntax, ...), and mostly I don't know how to generate a secure link in an admin template. More precisely, I've added a block on the admin order page in which I need to insert a link that execute an action of the module admin controller (this action has no view) and then refreshes (or redirects the user to) the admin order page. The action calls a webservice to get information about the order (fraud screening system), and then update the score (fraud risk level) of the order in the database module table. Obviously, i'd like this link to be secure (with token, or anything). I tried with the LynkCore class (methods getModuleLink and getAdminLink) but it does not work, I did not understand how to use it properly. Thanks a lot for your help. PS : you will see attached a screenshot of the admin order page, on which I circled in red the link that has to execute the action described above. Link to comment Share on other sites More sharing options...
axi Posted February 11, 2014 Share Posted February 11, 2014 Hi, I used this to create a link inside admin $link = new LinkCore; [...] <a href="'.$link->getAdminLink('NameOfController').'"> Don't know if it can help Link to comment Share on other sites More sharing options...
Martin Uker K Posted September 13, 2016 Share Posted September 13, 2016 I know i'm late (2 years late actually...) I love your answer Axi, it works, but goes against Prestashop Architecture (In PS 1.6 and 1.5 I think, I don't know your version) The access to Link class must be done via the context class. Creating multiple class of context's attribute is a bad pratice and goes against the "Context Pattern". To get the link class in a controller : $link = $this->context->link; Best regards, 1 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