
Events
The following events are available:
PasOnBeforeChangeStatusPasOnChangeStatus— entity status changeinstance— entity objectstatus— status ID
PasOnBeforeChangeTermPasOnChangeTerm— subscription term changesubscription— subscription objectaction— actionterm— term
PasOnClientBeforeSavePasOnClientSave— save clientclient— client object
PasOnSubscriptionBeforeSavePasOnSubscriptionSave— save subscriptionsubscription— subscription object
PasOnRateBeforeSavePasOnRateSave— save raterate— rate object
PasOnGetRateCost— get rate costrate— rate objectdata— data array
PasOnContentBeforeSavePasOnContentSave— save contentcontent— content object
PasOnGetContentRate— get content ratecontent— content objectrate— rate objectdata— data array
PasOnBeforeAddToOrderPasOnAddToOrder— add order fieldkey— field keyvalue— field value
PasOnBeforeValidateOrderValuePasOnValidateOrderValue— validate order fieldkey— field keyvalue— field value
PasOnBeforeRemoveFromOrderPasOnRemoveFromOrder— remove order fieldkey— field keyorder— order object
PasOnBeforeEmptyOrderPasOnEmptyOrder— clear orderorder— order object
PasOnBeforeGetOrderCostPasOnGetOrderCost— get order costorder— order objectcost— cost
PasOnSubmitOrder— process orderorder— order objectdata— data array
PasOnBeforeCreateOrderPasOnCreateOrder— create ordermsOrder— order objectorder— order object
Examples
Create a rate for content with 2-day term and cost 100:
php
<?php
switch ($modx->event->name) {
case 'PasOnGetContentRate':
/** @var PasContent $content */
/** @var PasRate $rate */
if ($content AND !$rate) {
$rate = $modx->newObject('PasRate');
$rate->fromArray(array(
'content' => $content->get('id'),
'cost' => '100',
'term_value' => '2',
'term_unit' => 'd',
'active' => 1,
));
$scriptProperties['rate'] = $rate;
}
break;
}
?>Change order cost and return values from a plugin. This example overrides the order cost:
php
<?php
switch ($modx->event->name) {
case 'PasOnGetOrderCost':
$values = $modx->event->returnedValues;
$values['cost'] = 5000;
$modx->event->returnedValues = $values;
break;
}
?>