Quentin Goinaud Posted September 26, 2016 Share Posted September 26, 2016 Hello everyone I have a HelperList with a "delete" action. But i don't know how to assing an action when you click on it. Can you help me ? Thanks ! Link to comment Share on other sites More sharing options...
Quentin Goinaud Posted September 27, 2016 Author Share Posted September 27, 2016 Thanks ! It work as expected PS: You have to look inside the "href" of the button to get the values Link to comment Share on other sites More sharing options...
beginner1 Posted November 27, 2017 Share Posted November 27, 2017 On 9/26/2016 at 8:53 PM, ndiaga said: Hi, You can do it inside the getContent() function Here is an exemple: public function getContent() { $output = null; if (Tools::isSubmit('deleteobjecttodelete') && Tools::isSubmit('id')) { $object=new ObjectToDelete((int)Tools::getValue('id')); $object->delete(); } return $output; } //deleteobjecttodelete is just an exemple so you should have delete+yourname //id also is jus an exemple Use it according to your object. public function getContent() { $output = null; // part above this line? if (Tools::isSubmit('deleteobjecttodelete') && Tools::isSubmit('id')) { $object=new ObjectToDelete((int)Tools::getValue('id')); $object->delete(); } // part below this line? return $output; } The area between the comments have to be changed only right? I have created a helperList with a delete button inside a controller. I am using prestashop 1.7 and it doesn't get called when I use the getContent() function inside the controller. Link to comment Share on other sites More sharing options...
beginner1 Posted November 28, 2017 Share Posted November 28, 2017 1 hour ago, ndiaga said: So, the problem should be in your template or the submitted form. but it works if I use initContent() function. It just doesn't work with getContent(). Any ideas? Link to comment Share on other sites More sharing options...
Guillaume77 Posted April 14, 2023 Share Posted April 14, 2023 I have the same problem. It doesn't work in getContent function. Can someome help me please ? Thanks 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