|
@@ -84,8 +84,9 @@ if ($customer_result && mysqli_num_rows($customer_result) > 0) {
|
|
|
if (empty($item['product_id'])) continue;
|
|
|
|
|
|
$product_id = (int)$item['product_id'];
|
|
|
-
|
|
|
- // 获取产品详情,包括nosale字段
|
|
|
+
|
|
|
+ if($product_id <= 0) continue; // 跳过无效的产品ID
|
|
|
+
|
|
|
$product_query = "SELECT ProductName, nosale FROM products WHERE id = $product_id LIMIT 1";
|
|
|
$product_result = mysqli_query($conn, $product_query);
|
|
|
|
|
@@ -144,8 +145,8 @@ if ($isedit) {
|
|
|
// 添加新的订单项
|
|
|
foreach ($items as $item) {
|
|
|
if (empty($item['product_id'])) continue; // 跳过没有选择产品的行
|
|
|
-
|
|
|
$product_id = (int)$item['product_id'];
|
|
|
+ if($product_id <= 0) continue; // 跳过无效的产品ID
|
|
|
$quantity = (int)$item['quantity'];
|
|
|
$unit = mysqli_real_escape_string($conn, htmlspecialchars($item['unit'], ENT_QUOTES, 'UTF-8'));
|
|
|
$total_price = (float)$item['total_price'];
|
|
@@ -190,8 +191,8 @@ if ($isedit) {
|
|
|
// 添加订单项
|
|
|
foreach ($items as $item) {
|
|
|
if (empty($item['product_id'])) continue; // 跳过没有选择产品的行
|
|
|
-
|
|
|
$product_id = (int)$item['product_id'];
|
|
|
+ if($product_id <= 0) continue; // 跳过无效的产品ID
|
|
|
$quantity = (int)$item['quantity'];
|
|
|
$unit = mysqli_real_escape_string($conn, htmlspecialchars($item['unit'], ENT_QUOTES, 'UTF-8'));
|
|
|
$total_price = (float)$item['total_price'];
|