Я нашел его, и, возможно, он мог бы быть полезен для других: прежде всего я добавил два хука к моей установке и два константы:
const HOOK_NEW_ORDER = 1;
const HOOK_ACTION_ORDER_STATUS_POST_UPDATE = 2;
actionValidateOrder & actionOrderStatusPostUpdate
if (!parent::install() ||
!$this->registerHook('actionValidateOrder') ||
!$this->registerHook('actionOrderStatusPostUpdate') ||
!Configuration::updateValue('AR_ADMIN_CLUB', 'customer club') ||
!$this->installModuleTab() ||
!$this->installDB() ||
!$this->registerHook("displayBackOfficeHeader") ||
!$this->insertInitData() ||
!$this->createFolders()
)
затем я добавил два метода для обработки этих хуков:
public function hookActionValidateOrder($params)
{
if (Module::isEnabled($this->name)) {
$this->hookOrderProcess(self::HOOK_NEW_ORDER, $params);
}
}
и
public function hookActionOrderStatusPostUpdate($params)
{
if (Module::isEnabled($this->name) && (!isset($GLOBALS['hookNewOrder']) || $GLOBALS['hookNewOrder'] != 1)) {
$this->hookOrderProcess(self::HOOK_ACTION_ORDER_STATUS_POST_UPDATE, $params);
}
}
наконец я добавил метод для выполнения необходимых действий на основе каждого изменения статуса заказа:
private function hookOrderProcess($hook, $params)
{
if ($hook == self::HOOK_NEW_ORDER) {
$id_shop = $params['order']->id_shop;
$shop_name = $shop_info->name;
$GLOBALS['hookNewOrder'] = 1;
} elseif ($hook == self::HOOK_ACTION_ORDER_STATUS_POST_UPDATE) {
$order_id = $params['id_order'];
$order_info = new Order($params['id_order']);
$id_shop = $order_info->id_shop;
$shop_info = new Shop($id_shop);
$order_status = $order_info->getCurrentState();
$customer_id = $order_info->getCustomer()->id;
$group_id = $order_info->getCustomer()->id_default_group;
if($order_status == 5){
$this->actoin_first($order_id, $group_id, $customer_id);
} elseif($order_status == 6){
$this->actoin_second($order_id, $group_id, $customer_id,'all');
}elseif($order_status == 7){
$this->actoin_third($order_id, $group_id, $customer_id);
}
}
}