Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the automatic confirmation function of ecshop background order

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to realize the automatic confirmation function of ecshop backstage order. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Ecshop column introduces the development of automatic order confirmation in ecshop background.

CREATE TABLE `order_auto_ Secretm` (`id` INT (10) UNSIGNED NOT NULL AUTO_INCREMENT, `order_ id` INT (10) UNSIGNED NOT NULL DEFAULT '0mm, `order_ SN` VARCHAR (20) NOT NULL, `execute_ time` INT (10) UNSIGNED NOT NULL DEFAULT' 0mm, `order_ status` TINYINT (3) UNSIGNED NOT NULL DEFAULT'0' COMMENT'0 is not determined 1 has been determined', `addtime` INT (10) UNSIGNED NOT NULL DEFAULT '0confirmation, `update_ time` INT (10) UNSIGNED NOT NULL DEFAULT' 0recording mastering primary KEY (`id`), UNIQUE INDEX `order_ id` (`execute_ id`), INDEX `timetime` (`execute_ time`) COMMENT=' orders are automatically determined on a regular basis' COLLATE='utf8_general_ci'ENGINE=MyISAM'

I.

/ admin/order.php adds the following code:

Elseif ($_ REQUEST ['act'] = =' order_cron') {$act1 = empty ($_ POST ['act1'])? 0: $_ POST [' act1']; if (empty ($act1) |! in_array ($act1, array ('add',' cancel')) make_json_response (',-1, 'unknown request act1'); $order_id = intval ($_ POST [' order_id']); $order = order_info ($order_id) If (empty ($order)) make_json_response ('',-2,'no order ID'); if ($order ['order_status']) make_json_response ('',-3, 'this order has been confirmed without automatic confirmation'); if ($order ['pay_status']) make_json_response ('',-4, 'this order payment status has been changed and tasks cannot be added') If ($act1 = = 'add') {$order_cron_time = empty ($_ POST [' order_cron_time'])? 0: $_ POST ['order_cron_time']; if (empty ($order_cron_time)) make_json_response ('',-10, 'request time error'); $sql = 'select order_id from'. $ecs- > table ('order_auto_confirm'). Where order_id='.$order_id;$rs = $db- > getRow ($sql); if ($rs ['order_id'] = = $order_id) {make_json_response (',-30, 'this order task already exists and cannot be added repeatedly');} $execute_time = local_strtotime ($order_cron_time) $sql = "insert into". $ecs- > table ('order_auto_confirm'). (order_id, order_sn, execute_time, order_status, addtime) values (". $order_id.",'. $order ['order_sn']. ",". $execute_time. ", 0," .local _ gettime (). "); $result = $db- > query ($sql); if ($result) {make_json_response (', 0,') } make_json_response (',-9, 'failed to add task schedule');} elseif ($act1 = = 'cancel') {$sql =' delete from'. $ecs- > table ('order_auto_confirm'). Where order_id='.$order_id.' And order_status=0'; $db- > query ($sql); make_json_response (', 0,');}}

II.

Add the following in elseif ($_ REQUEST ['act'] = =' info'):

/ / fetch automatically determined order information $sql = 'select order_status, execute_time, addtime, update_time from'. $ecs- > table ('order_auto_confirm'). Where order_id='.$order ['order_id']; $cron= $db- > getRow ($sql); if (! empty ($cron)) {if ($cron [' order_status'] = = 1) $cron ['update_time'] = sprintf ($_ LANG [' order_auto_croned'], local_date ('Y-m-d sprintf, $cron [' update_time'])) Else$cron ['execute_time'] = sprintf ($_ LANG [' order_auto_cron'], local_date ('Y-m-d Hlav isprintf slots, $cron [' execute_time']));} $smarty- > assign ('cron', $cron)

3.

/ includes/modules/cron/order_auto_confirm.php

If (! defined ('IN_ECS')) {die (' Hacking attempt');} require_once (ROOT_PATH. 'includes/lib_order.php'); $cron_lang = ROOT_PATH. 'languages/'. $GLOBALS [' _ CFG'] ['lang']. '/ cron/order_auto_confirm.php';if (file_exists ($cron_lang)) {global $_ LANG; include_once ($cron_lang);} / * basic information of the module * / if (isset ($set_modules) & & $set_modules = = TRUE) {$I = isset ($modules)? Count ($modules): 0; / * Code * / $modules [$I] ['code'] = basename (_ _ FILE__,' .php'); / * describe the corresponding language entry * / $modules [$I] ['desc'] =' order_auto_confirm_desc'; / * author * / $modules [$I] ['author'] =' wjzhhr' / * URL * / $modules [$I] ['website'] =' http://www.wodeqingchun.com'; / * version number * / $modules [$I] ['version'] =' 1.0.0"; / * configuration information * / $modules [$I] ['config'] = array (' name' = > 'order_auto_confirm_count',' type' = > 'select',' value' = > '10'),); return } $time = gmtime (); / / $time = local_gettime (); $limit = empty ($cron ['order_auto_confirm_count'])? 5: $cron [' order_auto_confirm_count']; $sql = "SELECT * FROM". $GLOBALS ['ecs']-> table (' order_auto_confirm'). "WHERE execute_time

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report