默认情况下,客户不可能从其帐户中取消订单。商店的管理员可以在管理面板中执行此操作。
我们要p取消客户的订单
<file path="catalog/view/theme/default/template/account/order_list.twig">
<operation>
<search><![CDATA[ <td class="text-right">{{ order.total }}</td>]]></search>
<add position="after"><![CDATA[
<td class="text-right">
取消订单,nr {{order.order_id}}
]]></add>
</operation>
</file>
php取消
<?php session_start(); ?>
<?php
$customer_id = $_SESSION['default']['customer_id'];
if ($customer_id == ''){
exit;
}
//echo $customer_id;
$order_id = mysql_escape_string($_GET['order_id']);
if ($order_id == ''){
exit;
}
include 'config.php';
$link = mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
mysql_select_db(DB_DATABASE);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$updateSQL = mysql_query("UPDATE oc_order SET order_status_id = '7' where order_id = '$order_id;' and customer_id = '$customer_id'");
?>
<script>alert("The order was canceled!");
window.location.replace('/')
</script>
结果
注意:未定义索引:第3行的C:\ xampp \ htdocs \ 3020 \ cancel-order.php中的默认值
答案 0 :(得分:0)
替换
$customer_id = $_SESSION['default']['customer_id'];
与
$customer_id = $this->customer->getId();
$order_id = $this->request->get['order_id']
$this->db->query('...');
真的,整个代码不是OpenCart友好的。您应该尝试阅读documentation,以了解有关MVC之类的知识以及OpenCart注册表的方法
如果您需要任何开发人员帮助,请通过https://dreamvention.ee/support
向我发送请求