wppizza_on_order_execute

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #30175
    sshd
    Participant

      Hello,

      atm I’ve this snippet in my class.wppizza.order_execute.php:

      do_action(‘wppizza_on_order_execute’, ‘sendFAX’);
      function sendFAX($order_id) {
      fopen(“https://xxx.de/gateway.php?oid=” . $order_id, “r”);
      }

      Problem: This hook doesn’t call my function ‘sendFAX’. What’s wrong here?
      The “fopen” part does work. (tested in a other project)

      #30176
      sshd
      Participant

        I don’t know, why my code is so bad formatted – right one:

        	do_action('wppizza_on_order_execute', 'sendFAX');
        function sendFAX($order_id) {
        fopen("https://xxx.de/gateway.php?oid=" . $order_id, "r");
        }
        #30186
        Olly
        Admin & Mod

          >I don’t know, why my code is so bad formatted
          because you did not put it into code tags

          >This hook doesn’t call my function
          because it’s wrong
          you need to add_action , not do_action

          https://developer.wordpress.org/reference/functions/add_action/

          #30219
          sshd
          Participant
            		/**************************************************************
            wppizza_on_order_execute - action hook
            action hook - add order formatted and templates output(if set)
            **************************************************************/
            $order_for_templates = WPPIZZA()->order->results_formatted('order_templates', $order_for_templates);
            /*  filter , depending on parameters set,  returns array(with order id, order deails , order formatted , selected print template output) */
            $template_ids = apply_filters('wppizza_on_order_execute_get_print_templates_by_id', array());
            /** get print templates array to add to on order execute if set above */
            $print_templates = $this->get_print_templates($template_ids, $order_id, $order_details['localization'], $order_for_templates);
            /** do action */
            add_action('wppizza_on_order_execute', 'sendFAX');
            function sendFAX($order_id) {
            fopen("https://xxx.de/gateway.php?oid=" . $order_id, "r");
            }
            

            The same result … :/

            #30220
            Olly
            Admin & Mod

              are you editing the core files ?????

              #30221
              sshd
              Participant

                erm… i don’t know, i just found “wppizza_on_order_execute” in this f ile so i thought, that i have to add my snippet there.
                filename: /plugins/wppizza/classes/class.wppizza.order_execute.php

                #30222
                Olly
                Admin & Mod

                  i did not even take this in:
                  >atm I’ve this snippet in my class.wppizza.order_execute.php:……

                  please, please, please, learn how to use action and filter hooks
                  do not EVER edit core/plugin/wp files . thats PRECISLEY why filters and action hooks exist

                  may i suggest: https://pippinsplugins.com/quick-introduction-to-action-hooks/
                  or indeed
                  https://www.google.co.uk/search?q=introduction+to+wordpress+hooks

                  you MUST learn about how WP actions and filters work if you want to do *any* kind of customisation of WP

                Viewing 7 posts - 1 through 7 (of 7 total)
                • The topic ‘wppizza_on_order_execute’ is closed to new replies.