Jump to content

HelperList with delete button


Recommended Posts

  • 1 year later...
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

  • 5 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...