Example #1
0
/**
 * 生成过滤条件:用于 get_goodslist 和 get_goods_list
 * @param   object  $filter
 * @return  string
 */
function get_where_sql($filter)
{
    $time = date('Y-m-d');
    $where = isset($filter->is_delete) && $filter->is_delete == '1' ? ' WHERE is_delete = 1 ' : ' WHERE is_delete = 0 ';
    $where .= isset($filter->real_goods) && $filter->real_goods > -1 ? ' AND is_real = ' . intval($filter->real_goods) : '';
    $where .= isset($filter->cat_id) && $filter->cat_id > 0 ? ' AND ' . get_children_supplier($filter->cat_id) : '';
    $where .= isset($filter->brand_id) && $filter->brand_id > 0 ? " AND brand_id = '" . $filter->brand_id . "'" : '';
    $where .= isset($filter->intro_type) && $filter->intro_type != '0' ? ' AND ' . $filter->intro_type . " = '1'" : '';
    $where .= isset($filter->intro_type) && $filter->intro_type == 'is_promote' ? " AND promote_start_date <= '{$time}' AND promote_end_date >= '{$time}' " : '';
    $where .= isset($filter->keyword) && trim($filter->keyword) != '' ? " AND (goods_name LIKE '%" . mysql_like_quote($filter->keyword) . "%' OR goods_sn LIKE '%" . mysql_like_quote($filter->keyword) . "%' OR g.goods_id LIKE '%" . mysql_like_quote($filter->keyword) . "%') " : '';
    $where .= isset($filter->suppliers_id) && trim($filter->suppliers_id) != '' ? " AND (g.suppliers_id = '" . $filter->suppliers_id . "') " : '';
    //$where .= isset($filter->in_ids) ? ' AND goods_id ' . db_create_in($filter->in_ids) : '';
    //$where .= isset($filter->exclude) ? ' AND goods_id NOT ' . db_create_in($filter->exclude) : '';
    $where .= isset($filter->in_ids) ? ' AND g.goods_id ' . db_create_in($filter->in_ids) : '';
    //jx
    $where .= isset($filter->exclude) ? ' AND g.goods_id NOT ' . db_create_in($filter->exclude) : '';
    //jx
    $where .= isset($filter->stock_warning) ? ' AND goods_number <= warn_number' : '';
    return $where;
}
Example #2
0
//-- PROCESSOR
/*------------------------------------------------------ */
/* 页面的缓存ID */
$cache_id = sprintf('%X', crc32($cat_id . '-' . $display . '-' . $sort . '-' . $order . '-' . $page . '-' . $size . '-' . $_SESSION['user_rank'] . '-' . $_CFG['lang'] . '-' . $brand . '-' . $price_max . '-' . $price_min . '-' . $filter_attr_str . '-' . $_GET['suppId']));
if (!$smarty->is_cached('category.dwt', $cache_id)) {
    assign_template();
    assign_template_supplier();
    $position = assign_ur_here();
    //$hereinfo = get_categories_tree($cat_id);
    //$ur_here = "<a href='supplier.php?suppId=".$_GET['suppId']."'>店铺首页</a> <code>&gt;</code> <a href='".$hereinfo[$cat_id]['url']."'>".$hereinfo[$cat_id]['name']."</a>";
    $smarty->assign('page_title', $position['title']);
    // 页面标题
    //$smarty->assign('ur_here',         $ur_here);  // 当前位置
    $smarty->assign('categories', get_categories_tree_supplier());
    // 分类树
    $children = get_children_supplier($cat_id);
    $cat = get_cat_info_supplier($cat_id);
    // 获得分类的相关信息
    if (!empty($cat)) {
        $smarty->assign('keywords', htmlspecialchars($cat['keywords']));
        $smarty->assign('description', htmlspecialchars($cat['cat_desc']));
        $smarty->assign('cat_style', htmlspecialchars($cat['style']));
    } else {
        /* 如果分类不存在则返回首页 */
        ecs_header("Location: index.php");
        exit;
    }
    if ($cat['is_show'] > 0 && $cat['is_show_cat_pic'] > 0) {
        $smarty->assign('cat_pic', $cat['cat_pic']);
        $smarty->assign('cat_pic_url', $cat['cat_pic_url']);
    } else {