问题描述
OpenCart 3.0不支持客户端的订单取消所以
我正在尝试制作一个用于取消客户订单的php页面
i只需在订单信息页面上添加一个按钮即可取消订单,我只是想更新order_status_id所以它会相应地显示我
我正在尝试此代码而不修改OpenCart 3.0的核心文件
但是我的代码没有工作
我尝试了什么:
< pre><?php
包括'config.php';
//创建连接
$ conn = new mysqli(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
//检查连接
if($ conn-> connect_error){
die(Connection failed:。$ conn-> connect_error);
}
echo已成功连接;
$ sql =UPDATE order SET order_status_id = 8 WHERE customer_id = 2;
if($ conn-> query($ sql)=== TRUE){
echo记录更新成功;
} else {
echo错误更新记录:。 $ conn->误差;
}
$ conn-> close();
?>
< script> alert(订单已被取消!);
window.location.replace('/')
< / script>
显示错误
更新记录时出错:您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以便在第1行订单SET order_status_id = 8 WHERE customer_id = 2附近使用正确的语法
如果有人是OpenCart 3.0 MVC编程专家那么请帮助我
谢谢
Hi,
OpenCart 3.0 does not support order cancellation from customer side so
I am trying to make one php page for canceling order by customer side
i just add one button on order info page for order cancellation and I am just trying to update order_status_id so it will be show me accordingly
I am trying this code without modifying core file of OpenCart 3.0
But my code is not working
What I have tried:
<pre><?php include 'config.php'; // Create connection $conn = new mysqli(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD,DB_DATABASE); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected successfully"; $sql = "UPDATE order SET order_status_id =8 WHERE customer_id= 2 "; if ($conn->query($sql) === TRUE) { echo "Record updated successfully"; } else { echo "Error updating record: " . $conn->error; } $conn->close(); ?> <script>alert("The order was canceled!"); window.location.replace('/') </script>
it show error
Error updating record: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order SET order_status_id =8 WHERE customer_id= 2' at line 1
If anybody is expert in OpenCart 3.0 MVC Programming then plz help me
Thanks
这篇关于如何在opencart 3.0中从客户端为cancle命令制作PHP页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!