我试图在opencart中实现ajax quickcheckout的订单短信验证。 http://www.opencart.com/index.php?route=extension/extension/info&extension_id=15580
扩展程序在默认结帐模板上正常运行。弹出一个窗口输入收到的代码。当输入正确的代码时,结账功能完成并下订单。 但是,如果我想让它与AJAX快速结账一起工作,我该怎么办呢。 我提供了vQmod xml文件,该文件是默认模板,我需要使用它来执行ajax checkout。
这是sms验证模块的vQmod xml。默认结帐。
<modification>
<id><![CDATA[sms-confirmation-of-payment-methods-oc2-extension]]></id>
<version><![CDATA[3.2.0]]></version>
<author><![CDATA[dev@smshare.fr - http://www.smshare.fr]]></author>
<vqmver><![CDATA[2.5.1]]></vqmver>
<file name="catalog/view/theme/*/template/checkout/checkout.tpl">
<operation info="Intercept clicks on the button that validate payment method choice">
<search position="before" offset="1"><![CDATA[url: 'index.php?route=checkout/confirm',]]></search>
<add><![CDATA[
var wait_for_confirmation = false;
$.ajax({
async: false,
url : 'index.php?route=checkout/smshare_scpm/payment_method_chosen',
type : 'post',
dataType: 'json',
success: function(json) {
console.log(json['scpm_code_status']);
if(json['scpm_code_status'] === 'scpm_code_sent'){
wait_for_confirmation = true;
//show the popup to confirm the code.
//$.magnificPopup.open({
// modal: true,
// items: {
// src: '#smshare-popup', // can be a HTML string, jQuery object, or CSS selector
// type: 'inline'
// }
//});
$.magnificPopup.open({
modal: true,
items: {
src: 'index.php?route=checkout/smshare_scpm/load_popup_content',
type: 'ajax'
}
});
}
}
});
if(wait_for_confirmation) return;
]]></add>
</operation>
</file>
<file name="catalog/controller/checkout/checkout.php">
<operation info="Inject somewhere popup scripts">
<search position="after"><![CDATA[$this->document->addStyle('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css');]]></search>
<add><![CDATA[
//SCPM: popup
$this->document->addScript('catalog/view/javascript/smshare/popup/jquery.magnific-popup.js');
$this->document->addStyle('catalog/view/javascript/smshare/popup/magnific-popup.css');
//SCPM: ladda
$this->document->addScript('catalog/view/javascript/smshare/ladda/spin.min.js');
$this->document->addScript('catalog/view/javascript/smshare/ladda/ladda.min.js');
$this->document->addStyle('catalog/view/javascript/smshare/ladda/ladda-themeless.min.css');
]]></add>
</operation>
</file>
答案 0 :(得分:0)
对于订单短信,我之前已经这样做了。而是使用JavaScript解决方案,使用Native opencart解决方案。
catalog/model/checkout/order.php
在addOrderHistory
功能
寻找以下行
// If order status is 0 then becomes greater than 0 send main html email
if (!$order_info['order_status_id'] && $order_status_id) {
此后此行调用您的方法
可能是这样的
$this->load->model('module/sms');
$this->model_module_sms->on_order_add($order_id, $order_info['total']);
我不建议直接修改原始文件。改用vqmod。