Jump to content

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

Problem Using Two Specific Hooks Rate Topic   - - - - -

 
  • sioulisn
  • Junior Member
  • Members
  • Join Date: 06-Apr 09
  • 94 posts

Posted 30 November 2021 - 02:00 PM #1

Hi!

 

i am registering these 2 hooks:

<?php

if (!defined('BOOTSTRAP')) { die('Access denied'); }

fn_register_hooks(
    'change_order_status',
    'place_order_manually_post'
);

the change_order_status hook function returns results correctly,

but when I am trying to add another function: 

function fn_myaddon_place_order_manually_post($cart, $params, $customer_auth, $action, $issuer_id, $force_notification, $order_info, $edp_data, $is_order_placed_notification_required){
    fn_print_die($order_info);
}

the fn_print_die($order_info); result is empty.

 

When I delete the 'change_order_status' from registered hooks and I let only the 'place_order_manually_post' I get results  from  fn_print_die($order_info);

 

What do I miss?



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

Posted 01 December 2021 - 04:49 AM #2

So what is content of the fn_myaddon_change_order_status function?


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 1210     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 4025     CS-Cart + YOUPI      USD 1459      Multi-Vendor Ultimate       USD 7500 (6000)


 
  • sioulisn
  • Junior Member
  • Members
  • Join Date: 06-Apr 09
  • 94 posts

Posted 01 December 2021 - 07:34 AM #3

in a  clean cs cart installation is working as it should, so i need more digging to maybe another addon conflict.

Thank you for the answer eComLabs



 
  • sioulisn
  • Junior Member
  • Members
  • Join Date: 06-Apr 09
  • 94 posts

Posted 01 December 2021 - 12:16 PM #4

in case someone need,
the solution was to make the functions that were related into hooks, to run only in the controller I needed them.

(change_order_status) -> if (Tygh\Registry::get("runtime.controller") == "checkout"){...}...

(place_order_manually_post) ->  if (Tygh\Registry::get("runtime.controller") == "order_management") {...}...



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12139 posts

Posted 01 December 2021 - 11:24 PM #5

Wouldn't it be a bit cleaner/easier to do:

if( !empty($order_info) } {
  // do your code
}

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.