How to add actions on buttons

This tutorial shows you how to add actions on buttons. In our example we will add button Delete product promotion and add action on it. Action will delete selected product promotion from database.

ACtion on button

1. Login into developer panel of application.

2. Click on Pages menu item.

3. Select page pageProductOnPromotion.

4.  Drag and drop Button component from all components list to data table products on promotion.

5. Drag and drop Action component from all components list to button for registration named ButtonDeleteProductPromotion.

action on button

6. In dropped action component properties, for Action type property choose PHP Code. Click on Action code text field and enter your PHP code. Variable result is an instance of AjaxProxy class. This variable is already instantiated. Attribute status of result variable ($result->status) can be true or false. At the end of your PHP code, attribute status should be set to true. Click on Save button.

action php

7. Click on Save changes, go into your application and check out the results.