2017-05-03 4 views
0

Ich entwickle Payment Gateway für Woo und versuchen woocommerce_receipt_ Haken zu verwenden, um benutzerdefinierte Formular einreichen und Kunden dritten Teilbahn Zahlungsservice umleiten. Irgendjemand mit der Idee, warum Haken nicht funktioniert. Danke fürs Helfen!! Prost!WooCommerce Empfang Haken funktionieren nicht richtig

Dies ist meine Zahlung Klassencode:

class my_vpos extends WC_Payment_Gateway { 
    function __construct() { 

     // The global ID for this Payment method 
     $this->id = "my_vpos"; 


     $this->method_title = __("my_vpos", 'my_vpos'); 


     $ this->method_description = __("Payment Gateway Plug-in for 
     WooCommerce", 'my_vpos'); 
     $this->title = __("my_vpos", 'my_vpos'); 


     $this->has_fields = false; 

     // This basically defines your settings which are then loaded with 
     init_settings() 
    $this->init_form_fields(); 

    $this->title = $this->get_option('title'); 
    $this->init_settings(); 


    $this->testurl = 'https://www.exaple-payment.com/pay-gw-t/vpos'; 
    $this->liveurl = 'https://www.exaple-payment.com/pay-gw-t/vpos'; 

    // Actions 


    add_action('woocommerce_receipt_' . $this->id, array($this, 
    'receipt_page')); 
} // End __construct() 


    function receipt_page($order){ 
     echo '<form action="' . $this->testurl . '" method="post" 
     id="submit_payment_form"> 
      <input type="hidden" name="type" value="PAYLOGIN"/> 
      </form>'; 
    } 
} 

Antwort

0

Code unten in function.php Datei hinzufügen

<?php 
    add_action('plugins_loaded', 'woocommerce_my_vpos_init', 0); 
    function woocommerce_my_vpos_init(){ 
     if(!class_exists('WC_Payment_Gateway')) return; 

     class WC_My_Vpos extends WC_Payment_Gateway{ 
     public function __construct(){ 
      $this -> id = 'my_vpos'; 
      $this -> medthod_title = 'My Vpos'; 
      $this -> has_fields = false; 

      $this -> init_form_fields(); 
      $this -> init_settings(); 

      $this -> title = "My Vpos"; 
      $this -> description = "Payment Gateway Plug-in for WooCommerce"; 

      $this -> testurl = 'https://www.exaple-payment.com/pay-gw-t/vpos'; 
      $this -> liveurl = 'https://www.exaple-payment.com/pay-gw-t/vpos'; 

      add_action('woocommerce_receipt_my_vpos', array(&$this, 'receipt_page')); 
      } 




     /** 
     * Receipt Page 
     **/ 
     function receipt_page($order){ 
      echo '<form action="' . $this->testurl . '" method="post" 
       id="submit_payment_form"> 
        <input type="hidden" name="type" value="PAYLOGIN"/> 
        </form>'; 
     } 

     } 
     /** 
     * Add the Gateway to WooCommerce 
     **/ 
     function woocommerce_add_my_vpos_gateway($methods) { 
      $methods[] = 'WC_My_Vpos'; 
      return $methods; 
     } 

     add_filter('woocommerce_payment_gateways', 'woocommerce_add_my_vpos_gateway'); 
    } 
    ?> 
+0

ich Plugin-Struktur haben, aber 'woocommerce_receipt_my_vpos' nicht funktionieren. Thaks um zu helfen. – htmlbrewery

+0

versuchen Sie diesen Code add_action ('woocommerce_receipt_my_vpos', Array (& $ this, 'receipt_page'), 10, 1); –

+0

Kein Erfolg, nachdem ich 'Stelle Auftrag' Knopfweb site geklickt habe, gebe Fehler 'Internal Server Error' – htmlbrewery

Verwandte Themen