0
我正在爲Woo開發支付網關,並嘗試使用woocommerce_receipt_
掛鉤提交自定義表單並將客戶重定向到第三方網絡支付服務。任何人都知道爲什麼鉤子不起作用。感謝您的幫助!乾杯!Woocommerce收據掛鉤無法正常工作
這是我的支付類代碼:
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>';
}
}
我有插件結構,但'woocommerce_receipt_my_vpos'不行。 Thaks幫助。 – htmlbrewery
嘗試此代碼 add_action('woocommerce_receipt_my_vpos',array(&$ this,'receipt_page'),10,1); –
沒有成功,點擊'下訂單'按鈕網站後出現錯誤'Internal Server Error' – htmlbrewery