Jump to content

How To Add An Action To The B.o Product List ?


Rulian

Recommended Posts

Hey Guys,

 

In the Back Office Product List,  I'd like to add an action like Edit, delete, duplicate or preview.

just like the Duplicate one, it wouldn't lead to another page but just do some database stuff and refresh the product list.

Let's call this action "Patate Update".

 

JPIyVuP.jpg

 

1) Adding the button:

 

I just override the renderList function of AdminProductController.php and add the following statement:

$this->addRowAction('patateupdate');

2) Managing to display a nice button:

 

I also added a displayPatateUpdateLink to HelperList.php and created a list_action_patateupdate.tpl file

    public function displayPatateUpdateLink($token = null, $id)
    {
        $tpl = $this->createTemplate('list_action_patateupdate.tpl');
        $patateupdate = $this->currentIndex.'&'.$this->identifier.'='.$id.'&patateupdate';
...

3) Coding the actual stuff I want to do with my product:

 

Just like the processDuplicate() function, I created a public function processPatateUpdate() in my AdminProductController
 

 

Now: How the hell could I bind the click on the "Patate Update" button to the  processPatateUpdate() function of my controller ?

 

Is there any implicit stuff (ie. naming convention) to achieve such a thing ?

 

For example, when I search in all Prestashop's php files for "processDuplicate(" I only find the function definition.

If I use FirePHP in this function, I see it's actaully called when I click the "duplicate" button on the product list.

 

 

 

 

Please help me, 'cause it's starting to drive me crazy ! :)

 

 

 

 

 

Link to comment
Share on other sites

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