$setsqlarr['c_note'] = trim($_POST['c_note']); !$db->updatetable(table('category'), $setsqlarr, " c_id=" . intval($_POST['c_id'])) ? adminmsg("保存失败!", 0) : ""; $link[0]['text'] = "返回列表"; $link[0]['href'] = '?act=show_category&alias=' . $_POST['c_alias']; $link[1]['text'] = "查看修改结果"; $link[1]['href'] = "?act=edit_category&id=" . intval($_POST['c_id']); refresh_category_cache(); makejs_classify(); makejs_train_classify(); //填写管理员日志 write_log("后台成功修改分类", $_SESSION['admin_name'], 3); adminmsg("保存成功!", 2, $link); } elseif ($act == 'del_category') { check_token(); $id = $_REQUEST['id']; if ($num = del_category($id)) { refresh_category_cache(); makejs_classify(); makejs_train_classify(); adminmsg("删除成功!共删除" . $num . "行", 2); } else { adminmsg("删除失败!", 1); } } elseif ($act == 'district') { get_token(); $smarty->assign('navlabel', "district"); $smarty->assign('district', get_category_district()); $smarty->display('category/admin_category_district.htm'); } elseif ($act == 'district_all_save') { check_token(); if (is_array($_POST['save_id']) && count($_POST['save_id']) > 0) {
if (!del_category($category_id)) { php_call_jbox('error', '刪除項目時發生錯誤,請重新操作。', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type); } } //刪除類別 del_categoryarea($id) ? php_call_jbox('success', '刪除資料完成', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type) : php_call_jbox('error', '刪除失敗', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type); } if ($type == 'category') { $category_id[] = $id; //取得項目下的產品ID及刪除產品 $product_id = get_product_id($category_id); if ($product_id != null) { if (!del_product($product_id)) { php_call_jbox('error', '刪除產品時發生錯誤,請重新操作。', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type); } if (!del_product_meta($product_id)) { php_call_jbox('error', '刪除產品描述時發生錯誤,請重新操作。', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type); } } //刪除項目 del_category($category_id) ? php_call_jbox('success', '刪除資料完成', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type) : php_call_jbox('error', '刪除失敗', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type); } if ($type == 'product') { $product_id[] = $id; del_product($product_id) && del_product_meta($product_id) ? php_call_jbox('success', '刪除資料完成', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type) : php_call_jbox('error', '刪除失敗', URL_ADMIN_ROOT . 'product/?act=show&type=' . $type); } } ?> </body> </html>
{ $query = 'select `product_id` from product where `product_status` != "delete" and product_category_id IN (' . implode(',', $category_id) . ') ;'; $query = query_despace($query); $result = mysql_query($query); $product_id_list = array(); while ($row = mysql_fetch_assoc($result)) { $product_id_list[] = $row['product_id']; } return !empty($product_id_list) ? $product_id_list : null; } $category_id[] = $id; //取得項目下的產品ID及刪除產品 $product_id = get_product_id($category_id); if ($product_id != null) { if (!del_product($product_id)) { json_encode_return(0, '刪除產品時發生錯誤,請重新操作。', URL_ADMIN2_ROOT . 'category/'); } if (!del_product_meta($product_id)) { json_encode_return(0, '刪除產品描述時發生錯誤,請重新操作。', URL_ADMIN2_ROOT . 'category/'); } } //刪除項目 del_category($category_id) ? json_encode_return(1, '刪除資料完成', URL_ADMIN2_ROOT . 'category/') : json_encode_return(0, '刪除失敗', URL_ADMIN2_ROOT . 'category/'); break; default: json_encode_return(0, '流程異常,請重新操作[ACT#2]'); break; } } header('Content-type: text/html; charset=utf-8'); header('Location: http://' . $_SERVER['SERVER_NAME']);
return !empty($product_id_list) ? $product_id_list : null; } $categoryarea_id[] = $id; //取得類別下的項目ID $category_id = get_category_id($categoryarea_id); if ($category_id != null) { //取得項目下的產品ID及刪除產品 $product_id = get_product_id($category_id); if ($product_id != null) { if (!del_product($product_id)) { json_encode_return(0, '刪除產品時發生錯誤,請重新操作。', URL_ADMIN2_ROOT . 'categoryarea/'); } if (!del_product_meta($product_id)) { json_encode_return(0, '刪除產品描述時發生錯誤,請重新操作。', URL_ADMIN2_ROOT . 'categoryarea/'); } } //刪除項目 if (!del_category($category_id)) { json_encode_return(0, '刪除項目時發生錯誤,請重新操作。', URL_ADMIN2_ROOT . 'categoryarea/'); } } //刪除類別 del_categoryarea($id) ? json_encode_return(1, '刪除資料完成', URL_ADMIN2_ROOT . 'categoryarea/') : json_encode_return(0, '刪除失敗', URL_ADMIN2_ROOT . 'categoryarea/'); break; default: json_encode_return(0, '流程異常,請重新操作[ACT#2]'); break; } } header('Content-type: text/html; charset=utf-8'); header('Location: http://' . $_SERVER['SERVER_NAME']);