} elseif ($action == 'drop_consignee') { include_once 'includes/lib_transaction.php'; $consignee_id = intval($_GET['id']); if (drop_consignee($consignee_id)) { ecs_header("Location: user.php?act=address_list\n"); exit; } else { show_message($_LANG['del_address_false']); } } elseif ($action == 'collection_list') { include_once ROOT_PATH . 'includes/lib_clips.php'; $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('collect_goods') . " WHERE user_id='{$user_id}' ORDER BY add_time DESC"); $pager = get_pager('user.php', array('act' => $action), $record_count, $page); $smarty->assign('pager', $pager); $smarty->assign('goods_list', get_collection_goods($user_id, $pager['size'], $pager['start'])); $smarty->assign('url', $ecs->url()); $lang_list = array('UTF8' => $_LANG['charset']['utf8'], 'GB2312' => $_LANG['charset']['zh_cn'], 'BIG5' => $_LANG['charset']['zh_tw']); $smarty->assign('lang_list', $lang_list); $smarty->assign('user_id', $user_id); $smarty->display('user_clips.dwt'); } elseif ($action == 'delete_collection') { include_once ROOT_PATH . 'includes/lib_clips.php'; $collection_id = isset($_GET['collection_id']) ? intval($_GET['collection_id']) : 0; if ($collection_id > 0) { $db->query('DELETE FROM ' . $ecs->table('collect_goods') . " WHERE rec_id='{$collection_id}' AND user_id ='{$user_id}'"); } ecs_header("Location: user.php?act=collection_list\n"); exit; } elseif ($action == 'add_to_attention') { $rec_id = (int) $_GET['rec_id'];
function action_collection_list() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; include_once ROOT_PATH . 'includes/lib_clips.php'; $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('collect_goods') . " WHERE user_id='{$user_id}' ORDER BY add_time DESC"); $pager = get_pager('user.php', array('act' => $action), $record_count, $page); $smarty->assign('pager', $pager); $smarty->assign('goods_list', get_collection_goods($user_id, $pager['size'], $pager['start'])); $smarty->assign('url', $ecs->url()); $lang_list = array('UTF8' => $_LANG['charset']['utf8'], 'GB2312' => $_LANG['charset']['zh_cn'], 'BIG5' => $_LANG['charset']['zh_tw']); $smarty->assign('lang_list', $lang_list); $smarty->assign('user_id', $user_id); $smarty->display('user_clips.dwt'); }
include_once ROOT_PATH . 'include/lib_clips.php'; $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('collect_goods') . " WHERE user_id='{$user_id}' ORDER BY add_time DESC"); $pager = get_pager('user.php', array('act' => $action), $record_count, $page); $smarty->assign('pager', $pager); $smarty->assign('goods_list', get_collection_goods($user_id, $pager['size'], $pager['start'])); $smarty->assign('url', $ecs->url()); $lang_list = array('UTF8' => $_LANG['charset']['utf8'], 'GB2312' => $_LANG['charset']['zh_cn'], 'BIG5' => $_LANG['charset']['zh_tw']); $smarty->assign('lang_list', $lang_list); $smarty->assign('user_id', $user_id); $smarty->display('user_clips.dwt'); } elseif ($action == 'async_collection_list') { include_once ROOT_PATH . 'include/lib_clips.php'; $start = $_POST['last']; $limit = $_POST['amount']; $collections = get_collection_goods($user_id, $limit, $start); if (is_array($collections)) { foreach ($collections as $vo) { $img = $db->getOne("SELECT goods_thumb FROM " . $ecs->table('goods') . " WHERE goods_id = " . $vo['goods_id']); $t_price = empty($vo['promote_price']) ? $_LANG['shop_price'] . $vo['shop_price'] : $_LANG['promote_price'] . $vo['promote_price']; $asyList[] = array('collection' => '<a href="' . $vo['url'] . '"><table width="100%" border="0" cellpadding="5" cellspacing="0" class="ectouch_table_no_border"> <tr> <td><img src="' . $config['site_url'] . $img . '" width="50" height="50" /></td> <td>' . $vo['goods_name'] . '<br>' . $t_price . '</td> <td align="right"><a href="' . $vo['url'] . '" style="color:#1CA2E1">' . $_LANG['add_to_cart'] . '</a><br><a href="javascript:if (confirm(\'' . $_LANG['remove_collection_confirm'] . '\')) location.href=\'user.php?act=delete_collection&collection_id=' . $vo['rec_id'] . '\'" style="color:#1CA2E1">' . $_LANG['drop'] . '</a></td> </tr> </table></a>'); } } echo json_encode($asyList); } elseif ($action == 'delete_collection') {
/* 如果是一步购物,跳到结算中心 */ if ($_CFG['one_step_buy'] == '1') { ecs_header("Location: flow.php?step=checkout\n"); exit; } /* 取得商品列表,计算合计 */ $cart_goods = get_cart_goods(); $smarty->assign('goods_list', $cart_goods['goods_list']); $smarty->assign('total', $cart_goods['total']); //购物车的描述的格式化 $smarty->assign('shopping_money', sprintf($_LANG['shopping_money'], $cart_goods['total']['goods_price'])); $smarty->assign('market_price_desc', sprintf($_LANG['than_market_price'], $cart_goods['total']['market_price'], $cart_goods['total']['saving'], $cart_goods['total']['save_rate'])); // 显示收藏夹内的商品 if ($_SESSION['user_id'] > 0) { require_once ROOT_PATH . 'includes/lib_clips.php'; $collection_goods = get_collection_goods($_SESSION['user_id']); $smarty->assign('collection_goods', $collection_goods); } /* 取得优惠活动 */ $favourable_list = favourable_list($_SESSION['user_rank']); usort($favourable_list, 'cmp_favourable'); $smarty->assign('favourable_list', $favourable_list); /* 计算折扣 */ $discount = compute_discount(); $smarty->assign('discount', $discount['discount']); $favour_name = empty($discount['name']) ? '' : join(',', $discount['name']); $smarty->assign('your_discount', sprintf($_LANG['your_discount'], $favour_name, price_format($discount['discount']))); /* 增加是否在购物车里显示商品图 */ $smarty->assign('show_goods_thumb', $GLOBALS['_CFG']['show_goods_in_cart']); /* 增加是否在购物车里显示商品属性 */ $smarty->assign('show_goods_attribute', $GLOBALS['_CFG']['show_attr_in_cart']);
die($json->encode($result)); } else { $result['error'] = 0; $result['message'] = "该商品已经成功地加入了您的收藏夹。"; die($json->encode($result)); } } } } elseif ($act == 'collection_list') { include_once ROOT_PATH . 'includes/lib_clips.php'; $GLOBALS['smarty']->assign('info', get_user_default($_SESSION['user_id'])); //888 if ($rank = get_rank_info()) { $GLOBALS['smarty']->assign('rank_name', $rank['rank_name']); } $smarty->assign('goods_data', get_collection_goods($_SESSION['user_id'], 20, 0)); $smarty->display('favorites.html'); } elseif ($act == 'del_attention') { $rec_id = (int) $_GET['rec_id']; if ($rec_id) { $db->query('DELETE FROM ' . $ecs->table('collect_goods') . " WHERE rec_id='{$rec_id}' AND user_id ='{$user_id}'"); } ecs_header("Location: user.php?act=collection_list\n"); exit; } elseif ($act == 'profile') { include_once ROOT_PATH . 'includes/lib_transaction.php'; $user_info = get_profile($user_id); /* 取出注册扩展字段 */ $sql = 'SELECT * FROM ' . $ecs->table('reg_fields') . ' WHERE type < 2 AND display = 1 ORDER BY dis_order, id'; $extend_info_list = $db->getAll($sql); $sql = 'SELECT reg_field_id, content ' . 'FROM ' . $ecs->table('reg_extend_info') . " WHERE user_id = {$user_id}";