点击"下订单按钮"在Woocommerce中创建新窗口

时间:2017-02-22 02:52:31

标签: php wordpress woocommerce payment gateway

现在我使用Woocommerce - wordpress购物中心 对不起,我的英语不好,但我需要你的帮助。

首先,我想创建新的支付网关。它完成了   - 复制其他支付网关后,将我的网关名称粘贴到代码

但我遇到了很大的问题。   - 我没有方法可以添加

<script>window.open()</script>
点击&#34; PLACE ORDER&#34>上的代码按钮

在我的源代码下面

/* class.wc-gateway-mine.php */
if(!defined('ABSPATH')){
 exit;
}
//Description ..
class WC_gatewqy_mine extend WC_Payment_Gatewqy{

 //function __construct()..
 //function init_form_fields()..
 //function thankyou_page()..
 //function email_instructions()..

 function process_payment($order_id){

    $order = wc_get_order( $order_id );

    /* I want add new Javascript code here for create new window.
       After that child window submit "success" value to parent(or Parent window received "success" value from child window),
       I hope that the following processes will proceed as well(payment_process).
     */

    // Mark as processing (we're awaiting the cinfirm checkout)
    $order->update_status( 'processing', _x( 'Awaiting check payment', 'Check payment method', 'woocommerce' ) );

    // Reduce stock levels
    $order->reduce_order_stock();

    // Remove cart
    WC()->cart->empty_cart();

    // Return thankyou redirect
    return array(
        'result'    => 'success',
        'redirect'  => $this->get_return_url( $order )
    );


 }
}

我该怎么办?

0 个答案:

没有答案