在COD付款模块重定向链接中获取Opencart订单ID [英] Get Opencart Order ID in COD Payment Module Redirect Link

查看:285
本文介绍了在COD付款模块重定向链接中获取Opencart订单ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先感谢您给予您宝贵的时间来帮助我.

First of all thank you for giving your valuable time to help me.

我的处境-

我正在使用Opencart 2.1.0.1

I am using Opencart 2.1.0.1

货到付款付款方式

自定义OnePageCheckout

Custom OnePageCheckout

自定义主题

我实现了一个自定义流程,该流程通过每分钟运行的cron作业从我们自己的数据库中验证客户.

I have implemented a custom process which verifies the customer from our own database via a cron job running every minute.

这是Opencart中的默认代码 目录/视图/主题/模板/付款/cod.tpl

<div class="buttons">
  <div class="pull-right">
    <input type="button" value="<?php echo $button_confirm; ?>" id="button-confirm" class="btn btn-primary" data-loading-text="<?php echo $text_loading; ?>" />
  </div>
</div>
<script type="text/javascript"><!--
$('#button-confirm').on('click', function() {
    $.ajax({
        type: 'get',
        url: 'index.php?route=payment/cod/confirm',
        cache: false,
        beforeSend: function() {
            $('#button-confirm').button('loading');
        },
        complete: function() {
            $('#button-confirm').button('reset');
        },
        success: function() {
            location = '<?php echo $continue; ?>';
        }
    });
});
//--></script>

我想在成功结帐后将客户重定向到下一页. https://www.myopencartstore.com/ confirm.php?order_id = $ order_id

As I want to redirect the customer to the following page after successful checkout. https://www.myopencartstore.com/confirm.php?order_id=$order_id

必需的操作:我要传递url参数中的 order_id 变量,如上面以粗体突出显示的

Required Action : I want to pass on the order_id variable in the url parameter as highlighted in bold above.

我的修改代码-

<div class="buttons">
  <div class="pull-right">
    <input type="button" value="<?php echo $button_confirm; ?>" id="button-confirm" class="btn btn-primary" data-loading-text="<?php echo $text_loading; ?>" />
  </div>
</div>
<script type="text/javascript"><!--
$('#button-confirm').on('click', function() {
    $.ajax({
        type: 'get',
        url: 'index.php?route=payment/cod/confirm',
        cache: false,
        beforeSend: function() {
            $('#button-confirm').button('loading');
        },
        complete: function() {
            $('#button-confirm').button('reset');
        },
        success: function() {
            location = '<?php echo 'confirm-success.php'; ?>';
        }
    });
});
//--></script>

请帮助执行相同操作.

我要跳过 结帐/成功 页面.

I want to bye-pass the checkout/success page.

我尝试实现 $ this-> session-> data ['order_id']; 以获取订单ID参数.

I've tried implementing $this->session->data['order_id']; to get the Order ID parameter.

我已经尽力了,因此,我最大的能力就是 just 重定向到所需的页面,但是没有任何参数.

I've tried all my efforts and thus maximum I could do is to just redirect to the desired page but without any parameters.

推荐答案

我希望这对您有用

请将该文件替换为 目录/控制器/扩展名/付款/cod.php

Kindly Replace in this file as catalog/controller/extension/payment/cod.php

$data['continue'] = $this->url->link('checkout/success'); 

$data['continue'] = HTTP_SERVER.'confirm.php?order_id='.$this->session->data['order_id'];

这篇关于在COD付款模块重定向链接中获取Opencart订单ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆