An'im Fahmy Posted November 5, 2015 Share Posted November 5, 2015 How to check the hook is works? This is my code <?php if (!defined('_PS_VERSION_')) exit; class InagataModule extends Module { public function __construct() { $this->name = 'inagatamodule'; $this->tab = 'billing_invoicing'; $this->version = '1.0.0'; $this->author = "Achmad An'im Fahmy "; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Inagata Module'); $this->description = $this->l('Mengirim push notification ketika status order berubah.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('INAGATAMODULE')) $this->warning = $this->l('No name provided'); } #displayBackOfficeHeader public function install() { if (Shop::isFeatureActive()) Shop::setContext(Shop::CONTEXT_ALL); if (!parent::install() || !$this->registerHook('actionOrderStatusPostUpdate') || !Configuration::updateValue('INAGATAMODULE', 'my friend') ) return false; return true; } public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('INAGATAMODULE') ) return false; return true; } public function hookactionOrderStatusPostUpdate($params) { $file = 'coba'; // Open the file to get existing content $current = file_get_contents($params); // Append a new person to the file $current .= "$params\n"; // Write the contents back to the file file_put_contents($file, $current); echo "<pre>".print_r($params)."</pre>";die(); } } in function hookactionOrderStatusPostUpdate not write anything to coba file and not print anything. But, when I use standard hooks, it's showing in website (displayHeader) Thank you Link to comment Share on other sites More sharing options...
An'im Fahmy Posted November 5, 2015 Author Share Posted November 5, 2015 you can open Hook table in mysql database, if your module is there, hook will loaded. How to print or write value of $params? Link to comment Share on other sites More sharing options...
JoelWebsites Posted November 5, 2015 Share Posted November 5, 2015 Go to Back office admin panel and then go to module >> positions you should see your module under the respective look if its linked to the hook correctly... Link to comment Share on other sites More sharing options...
coeos.pro Posted November 5, 2015 Share Posted November 5, 2015 1- it's just "coba" ? not coba.txt or else ?2- $params is an array, in my opinion $current is "empty", you should test with $current = 'test';3- you can change echo "<pre>".print_r($params)."</pre>";die(); by: ppp($params);die(); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now