I'm trying to develop my first module, it should detect when an user processes more than 200$ of orders and generate a voucher.
I was checking if the hook was being called but it's not.
## solved
I'm trying to develop my first module, it should detect when an user processes more than 200$ of orders and generate a voucher.
I was checking if the hook was being called but it's not.
## solved
I'm trying to develop my first module, it should detect when an user processes more than 200$ of orders and generate a voucher.
I was checking if the hook was being called but it's not. What am i doing wrong? Here's the code:
<?php if (!defined('_PS_VERSION_')) exit; class BlockPromo extends Module { public function __construct() { $this->name = 'blockpromo'; $this->tab = 'front_office_features'; $this->version = '1.0.0'; $this->author = 'Alessandro Gessa'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Block Promo'); $this->description = $this->l('Permette l\'inserimento di una promozione specifica.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('MYMODULE_NAME')) $this->warning = $this->l('No name provided'); } public function install() { if (parent::install() == false) { return false; } $this->registerHook('actionOrderStatusPostUpdate'); return true; } public function hookActionOrderStatusPostUpdate($params) { $id_order = $params['order']->id; $status = $params['orderStatus']->id; $result = $id_order.' - '.$status; file_put_contents('./modules/blockpromo/results.txt', $result, LOCK_EX); $this->errors[] = Tools::displayError("Your error"); } }