Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Know When A Hook Fires ?

 
  • ugo
  • Newbie
  • Trial users
  • Join Date: 02-Feb 21
  • 6 posts

Posted 05 February 2021 - 10:55 AM #1

I need to confirm if I have selected the right hook from the hooks database. I need to auto order a vehicle on confirming an order. I chose the change_order_status and registered it in my init.php using

 

fn_register_hooks(
'change_order_status'
);
 
now in my func.php I have
if (!defined('AREA')) {die('Access denied');}

function fn_dellyman_change_order_status(&$status_to,&$status_from,&$order_info,&$force_notification,&$order_statuses,&$place_order) {
//Getting authentication data to identify user
$auth = $_SESSION['auth'];
var_dump($auth);
}

 

when I go to orders and switch the order from say open to complete, I expect to see the contents of auth rendered to the page at least as part of the request response. However I see no indication that the hook selected is the right one. How can i ensure the hook called is correct.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21567 posts

Posted 05 February 2021 - 01:29 PM #2

Since order is updated by ajax, try the following code

fn_set_notification('W', 'W', var_export($auth, true));

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • ugo
  • Newbie
  • Trial users
  • Join Date: 02-Feb 21
  • 6 posts

Posted 05 February 2021 - 02:40 PM #3

Thanks for the suggestion but nothing happens when I add the line to the func.php. I expected a notification to pop up and then to inspect that through mu browser console



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21567 posts

Posted 08 February 2021 - 01:18 PM #4

Have you cleared cache after new hook was added? Try to delete the var/cache directory manually


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • ugo
  • Newbie
  • Trial users
  • Join Date: 02-Feb 21
  • 6 posts

Posted 15 February 2021 - 05:27 AM #5

Have you cleared cache after new hook was added? Try to delete the var/cache directory manually

worked like  a charm thanks



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21567 posts

Posted 15 February 2021 - 07:34 AM #6

You are welcome! :)


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)