将付款字段从订单付款移至结帐页面

时间:2017-03-02 21:32:52

标签: php wordpress iframe

我有一个叫做epay的网关,它通过这个插件(https://github.com/ePay/woocommerce)集成到woocommerce中。

它使用iframe显示的表单,在woocommerce页面order-pay上。我希望iframe显示在woocommerce结帐页面上,而不是:

<div id="order_review" class="woocommerce-checkout-review-order">
    <?php do_action( 'woocommerce_checkout_order_review' ); ?>
</div>

<?php do_action( 'woocommerce_checkout_after_order_review' ); ?>

我确实有这个功能:

 public function generate_epay_form($order_id)
        {
            $order = new WC_Order($order_id);
            $minorUnits = EpayHelper::getCurrencyMinorunits($order->get_order_currency());
            $epay_args = array
            (
                'encoding' => "UTF-8",
                'cms' => $this->getModuleHeaderInfo(),
                'windowstate' => $this->windowstate,
                'mobile' => $this->enablemobilepaymentwindow === 'yes' ? 1 : 0,
                'merchantnumber' => $this->merchant,
                'windowid' => $this->windowid,
                'currency' => $order->get_order_currency(),
                'amount' => EpayHelper::convertPriceToMinorUnits($order->get_total(), $minorUnits),
                'orderid' => str_replace(_x( '#', 'hash before order number', 'woocommerce'), "", $order->get_order_number()),
                'accepturl' => $this->fix_url($this->get_return_url($order)),
                'cancelurl' => $this->fix_url($order->get_cancel_order_url()),
                'callbackurl' => $this->fix_url(add_query_arg ('wooorderid', $order_id, add_query_arg ('wc-api', 'WC_Gateway_EPayDk', $this->get_return_url( $order )))),
                'mailreceipt' => $this->authmail,
                'instantcapture' => $this->yesnotoint($this->instantcapture),
                'group' => $this->group,
                'language' => EpayHelper::get_language_code(get_locale()),
                'ownreceipt' => $this->yesnotoint($this->ownreceipt),
                'timeout' => "60",
                'invoice' => $this->createInvoice($order, $minorUnits),
            );

            if($this->woocommerce_subscription_plugin_is_active() && wcs_order_contains_subscription($order))
            {
                $epay_args['subscription'] = 1;
            }


            if(strlen($this->md5key) > 0)
            {
                $hash = "";
                foreach($epay_args as $value)
                {
                    $hash .= $value;
                }
                $epay_args["hash"] = md5($hash . $this->md5key);
            }

            $epay_args_array = array();
            foreach ($epay_args as $key => $value)
            {
                $epay_args_array[] = "'" . esc_attr($key) . "':'" . $value . "'";
            }

            $paymentScript = '<script type="text/javascript">
            function PaymentWindowReady() {
                paymentwindow = new PaymentWindow({
                    ' . implode(',', $epay_args_array) . '
                });
                paymentwindow.open();
            }
            </script>
    <script type="text/javascript" src="https://ssl.ditonlinebetalingssystem.dk/integration/ewindow/paymentwindow.js" charset="UTF-8"></script>
            <a class="button" onclick="javascript: paymentwindow.open();" id="submit_epay_payment_form" />' . __('Pay via ePay', 'woocommerce-gateway-epay-dk') . '</a>
            <a class="button cancel" href="' . esc_url($order->get_cancel_order_url()) . '">' . __('Cancel order &amp; restore cart', 'woocommerce-gateway-epay-dk') . '</a>';

            return $paymentScript;
        }

上面的功能来自付费整合插件,我可以看到,它是显示iframe的功能。

在form-checkout.php模板中。我试过回声没有成功。怎么办呢?

由于

0 个答案:

没有答案