Action
Predefined action
Predefined action
Print order bill:
$this->get('action','order_bill')->setPage($Order)->execute();
Run action with given parameters. Page->getAction() and Pages->getAction() creates new action and sets the page(s) calling it:
$OrderPage->getAction('send_order')
->setParameters(Array(
'message'=>'Here is your order'
))->execute();
Run action in background after 10 sec delay.
$OrderPage->getAction('send_order')->executeAsync(10);
Set parameters and additional execute settings:
$OrderPage->getAction('send_order')
->setParameters(Array(
'message' => 'Here is your order'
))
->executeAsync(Array(
'delay' => 10,
'COPY_TO_SENDER' => true
));
// In executed script:
// $_GET[COPY_TO_SENDER] === true
// $this->getParameter('message') === 'Here is your order'
Get PDF -file
$Pdf = $Order->getAction('order_confirmation')->getPdf();
Save file to tiedosto -field
$Client->order_confirmations->addValue(Array(
'filename' => $Pdf->getFilename(),
'content' => $Pdf->getContent()
));
Save to file
$Pdf->saveToFile($filename);
Send 'Order confirmation' -mail:
$this->get('action','order_confirmation_mail')->send($Order);
Or get email from $Order Page::getAction() -class:
$OrderPage->getAction('order_confirmation_mail')->send();
Modify email created by action before sending it:
$this->get('action','order_confirmation_mail')
->getMail($sivu)
->setTo('my.name@email.com')
->send($Order);
If you have an integration -action that uses Action Webservice -object, you can get information of the request after it is executed:
$Webservice = $Action->getWebservice();
if ( $Webservice->getSuccess() ){
$response = $Webservice->getResponse();
}
else {
$messages = $Webservice->getMessages(); // All messages
}
Method | Return | Description |
---|---|---|
setPage(var) | this | Set page(s) to be used inside action: Pages, Page, array of Page, int. |
setParameters(array) | this | Set additional variables |
getParameters() | array | Get additional variables |
getParameter(name[,default]) | mixed | Get additional variable. You can get subvalue using slash: 'employee/title' --> employee['title']. If not set, return default (version 2025.1) |
getPreferences() | array | Get action preferences |
getPreference(name) | array | Get action preferences. You can get subvalue using slash. |
execute() | Run action -specific action. | |
executeAsync([settings]) | Run action in background. | |
send([page,param]) | Send email. Override values with values in param array. | |
getLink() | eLink | Return eLink object with pages set in action. |
getWebservice() | ActionWebservice | Integration -action: Return action Webservice object. |
getPdf() | ActionPdf | Print -action: Return action PDF object. |
getMail([page]) | Mail -action: Return eMail object with data defined in action. | |
getSms([page]) | eSms | Sms action: Return eSms -object with data defined in action. |
getUrl([valid=7]) | string | Return url to public page |
Use
$Action->setPage($Page)->execute();
instead of
$Action->runAction($Page);