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.
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.
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.
7. Click on Save changes, go into your application and check out the results.