$smarty->assign('attr_cat_id', $attr_cat_id); $smarty->assign('ur_here', $_LANG['category_edit']); $smarty->assign('action_link', array('text' => $_LANG['03_category_list'], 'href' => 'category.php?act=list')); //分类是否存在首页推荐 $res = $db->getAll("SELECT recommend_type FROM " . $ecs->table("cat_recommend") . " WHERE cat_id=" . $cat_id); if (!empty($res)) { $cat_recommend = array(); foreach ($res as $data) { $cat_recommend[$data['recommend_type']] = 1; } $smarty->assign('cat_recommend', $cat_recommend); } $smarty->assign('cat_info', $cat_info); $smarty->assign('form_act', 'update'); $smarty->assign('cat_select', cat_list(0, $cat_info['parent_id'], true)); $smarty->assign('goods_type_list', goods_type_list(0)); // 取得商品类型 /* 显示页面 */ assign_query_info(); $smarty->display('category_info.htm'); } elseif ($_REQUEST['act'] == 'add_category') { $parent_id = empty($_REQUEST['parent_id']) ? 0 : intval($_REQUEST['parent_id']); $category = empty($_REQUEST['cat']) ? '' : json_str_iconv(trim($_REQUEST['cat'])); if (cat_exists($category, $parent_id)) { make_json_error($_LANG['catname_exist']); } else { $sql = "INSERT INTO " . $ecs->table('category') . "(cat_name, parent_id, is_show)" . "VALUES ( '{$category}', '{$parent_id}', 1)"; $db->query($sql); $category_id = $db->insert_id(); $arr = array("parent_id" => $parent_id, "id" => $category_id, "cat" => $category); clear_cache_files();
admin_priv('attr_manage'); /* 添加还是编辑的标识 */ $is_add = $_REQUEST['act'] == 'add'; $smarty->assign('form_act', $is_add ? 'insert' : 'update'); /* 取得属性信息 */ if ($is_add) { $goods_type = isset($_GET['goods_type']) ? intval($_GET['goods_type']) : 0; $attr = array('attr_id' => 0, 'cat_id' => $goods_type, 'attr_name' => '', 'attr_input_type' => 0, 'attr_index' => 0, 'attr_values' => '', 'attr_type' => 0, 'is_linked' => 0); } else { $sql = "SELECT * FROM " . $ecs->table('attribute') . " WHERE attr_id = '{$_REQUEST['attr_id']}'"; $attr = $db->getRow($sql); } $smarty->assign('attr', $attr); $smarty->assign('attr_groups', get_attr_groups($attr['cat_id'])); /* 取得商品分类列表 */ $smarty->assign('goods_type_list', goods_type_list($attr['cat_id'])); /* 模板赋值 */ $smarty->assign('ur_here', $is_add ? $_LANG['10_attribute_add'] : $_LANG['52_attribute_add']); $smarty->assign('action_link', array('href' => 'attribute.php?act=list', 'text' => $_LANG['09_attribute_list'])); /* 显示模板 */ assign_query_info(); $smarty->display('attribute_info.htm'); } elseif ($_REQUEST['act'] == 'insert' || $_REQUEST['act'] == 'update') { /* 检查权限 */ admin_priv('attr_manage'); /* 插入还是更新的标识 */ $is_insert = $_REQUEST['act'] == 'insert'; /* 检查名称是否重复 */ $exclude = empty($_POST['attr_id']) ? 0 : intval($_POST['attr_id']); if (!$exc->is_only('attr_name', $_POST['attr_name'], $exclude, " cat_id = '{$_POST['cat_id']}'")) { sys_msg($_LANG['name_exist'], 1);
if ($rank_goods_start_num[$k]['user_rank'] == $user_rank_list[$k]['rank_id']) { $user_rank_list[$k]['def_rank_start_num'] = $rank_goods_start_num[$k]['rank_goods_start_num'] ? 0 : $user_rank_list[$k]['rank_start_num']; $user_rank_list[$k]['rank_start_num'] = $rank_goods_start_num[$k]['rank_goods_start_num']; } } } } $smarty->assign('user_rank_list', $user_rank_list); if (!$is_add) { $smarty->assign('member_price_list', get_member_price_list($_REQUEST['goods_id'])); } $smarty->assign('link_goods_list', $link_goods_list); $smarty->assign('group_goods_list', $group_goods_list); $smarty->assign('goods_article_list', $goods_article_list); $smarty->assign('img_list', img_list($img_list)); $smarty->assign('goods_type_list', goods_type_list($goods['goods_type'])); $smarty->assign('gd', gd_version()); $smarty->assign('thumb_width', $_CFG['thumb_width']); $smarty->assign('thumb_height', $_CFG['thumb_height']); $smarty->assign('goods_attr_html', build_attr_html($goods['goods_type'], $goods['goods_id'])); $volume_price_list = ''; if (isset($_REQUEST['goods_id'])) { $volume_price_list = get_volume_price_list($_REQUEST['goods_id']); } if (empty($volume_price_list)) { $volume_price_list = array('0' => array('number' => '', 'price' => '')); } $smarty->assign('volume_price_list', $volume_price_list); /* 显示商品信息页面 */ assign_query_info(); $smarty->display('goods_info.htm');
// 权限检查 $cat_info = get_cat_info(intval($_REQUEST['cat_id'])); // 查询分类信息数据 $attr_list = get_attr_list(); if ($cat_info['filter_attr']) { $attr_cat_id = $db->getOne("SELECT cat_id FROM " . $ecs->table('attribute') . " WHERE attr_id = '{$cat_info['filter_attr']}'"); $attr_option = array(); foreach ($attr_list[$attr_cat_id] as $val) { $attr_option[key($val)] = current($val); } $smarty->assign('attr_option', $attr_option); } else { $attr_cat_id = 0; } /* 模板赋值 */ $smarty->assign('goods_type_list', goods_type_list($attr_cat_id)); // 取得商品类型 $smarty->assign('attr_list', $attr_list); // 取得商品属性 $smarty->assign('attr_cat_id', $attr_cat_id); $smarty->assign('ur_here', $_LANG['category_edit']); $smarty->assign('action_link', array('text' => $_LANG['03_category_list'], 'href' => 'category.php?act=list')); $smarty->assign('cat_info', $cat_info); $smarty->assign('form_act', 'update'); $smarty->assign('cat_select', cat_list(0, $cat_info['parent_id'], true)); /* 显示页面 */ assign_query_info(); $smarty->display('category_info.htm'); } elseif ($_REQUEST['act'] == 'add_category') { $parent_id = empty($_REQUEST['parent_id']) ? 0 : intval($_REQUEST['parent_id']); $category = empty($_REQUEST['cat']) ? '' : json_str_iconv(trim($_REQUEST['cat']));