当前位置: 首页>>代码示例>>PHP>>正文


PHP selled_count函数代码示例

本文整理汇总了PHP中selled_count函数的典型用法代码示例。如果您正苦于以下问题:PHP selled_count函数的具体用法?PHP selled_count怎么用?PHP selled_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了selled_count函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_index_best

/**
 * 获得推荐商品
 *
 * @access  public
 * @param   string      $type       推荐类型,可以是 best, new, hot
 * @return  array
 */
function get_index_best($limit = '')
{
    $time = gmtime();
    //取出所有符合条件的商品数据,并将结果存入对应的推荐类型数组中
    $sql = 'SELECT g.goods_id, g.goods_name,g.click_count, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' ";
    $sql .= ' WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.is_best = "best" ';
    $sql .= ' ORDER BY g.sort_order, g.last_update DESC';
    $sql .= " {$limit}";
    $result = $GLOBALS['db']->getAll($sql);
    foreach ($result as $idx => $row) {
        if ($row['promote_price'] > 0) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
            $goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
        } else {
            $goods[$idx]['promote_price'] = '';
        }
        $goods[$idx]['id'] = $row['goods_id'];
        $goods[$idx]['name'] = $row['goods_name'];
        $goods[$idx]['brief'] = $row['goods_brief'];
        $goods[$idx]['brand_name'] = isset($goods_data['brand'][$row['goods_id']]) ? $goods_data['brand'][$row['goods_id']] : '';
        $goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
        $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
        $goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
        $goods[$idx]['market_price'] = price_format($row['market_price']);
        $goods[$idx]['shop_price'] = price_format($row['shop_price']);
        $goods[$idx]['thumb'] = '../' . get_image_path($row['goods_id'], $row['goods_thumb'], true);
        $goods[$idx]['goods_img'] = '../' . get_image_path($row['goods_id'], $row['goods_img']);
        $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
        $goods[$idx]['sell_count'] = selled_count($row['goods_id']);
        $goods[$idx]['pinglun'] = get_evaluation_sum($row['goods_id']);
        $goods[$idx]['count'] = selled_count($row['goods_id']);
        $goods[$idx]['click_count'] = $row['click_count'];
    }
    return $goods;
}
开发者ID:firsteam,项目名称:falcons,代码行数:42,代码来源:index_bestgoods.php

示例2: get_promote_goods_group

/**
 * 获得促销商品
 *
 * @access  public
 * @return  array
 */
function get_promote_goods_group($cats = '')
{
    $time = gmtime();
    $order_type = $GLOBALS['_CFG']['recommend_order'];
    /* 取得促销lbi的数量限制 */
    $num = get_library_number("recommend_promotion");
    $sql = 'SELECT g.goods_id, g.goods_name,g.goods_brief, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.original_img, goods_img, b.brand_name, " . "g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . 'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ' . " AND g.is_promote = 1 AND promote_start_date <= '{$time}' AND promote_end_date >= '{$time}' ";
    $sql .= $order_type == 0 ? ' ORDER BY g.sort_order, g.last_update DESC' : ' ORDER BY rnd';
    $sql .= " LIMIT 15 ";
    $result = $GLOBALS['db']->getAll($sql);
    $goods = array();
    foreach ($result as $idx => $row) {
        if ($row['promote_price'] > 0) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
            $goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
        } else {
            $goods[$idx]['promote_price'] = '';
        }
        $goods[$idx]['id'] = $row['goods_id'];
        $goods[$idx]['name'] = $row['goods_name'];
        $goods[$idx]['valid_goods'] = selled_count($row['goods_id']);
        $goods[$idx]['brief'] = $row['goods_brief'];
        $goods[$idx]['brand_name'] = $row['brand_name'];
        $goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
        $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
        $goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
        $goods[$idx]['market_price'] = price_format($row['market_price']);
        $goods[$idx]['shop_price'] = price_format($row['shop_price']);
        $goods[$idx]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
        $goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
        $goods[$idx]['original_img'] = get_image_path($row['goods_id'], $row['original_img']);
        $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
    }
    return $goods;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:41,代码来源:pro_goods.php

示例3: floatval

     $goods['bonus_money'] = floatval($db->getOne($sql));
     if ($goods['bonus_money'] > 0) {
         $goods['bonus_money'] = price_format($goods['bonus_money']);
     }
 }
 /* 检查是否已经存在于用户的收藏夹 */
 $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('collect_goods') . " WHERE user_id='{$_SESSION['user_id']}' AND goods_id = '{$goods_id}'";
 $collect = $GLOBALS['db']->GetOne($sql);
 if ($collect) {
     $goods['is_collet'] = 1;
     $goods['collect_id'] = $collect['rec_id'];
 } else {
     $goods['is_collet'] = 0;
     $goods['collect_id'] = '';
 }
 $goods['count'] = selled_count($goods['goods_id']);
 //商品销量    lw 2015-1-21
 $goods_volume_price = get_goods_volume($goods_id);
 //查询商品的优惠数量和价格    jx 2015-1-1
 //计算购买该商品赠送的消费积分
 $goods['give_integral_2'] = $goods['give_integral'];
 if ($goods['give_integral'] > -1) {
     $goods['give_integral'] = $goods['give_integral'];
 } else {
     if ($goods['promote_price'] != 0) {
         $goods['give_integral'] = intval($goods['promote_price']);
     } else {
         $goods['give_integral'] = intval($goods['shop_price']);
     }
 }
 //$smarty->assign('url',              $_SERVER["REQUEST_URI"]);
开发者ID:firsteam,项目名称:falcons,代码行数:31,代码来源:goods.php

示例4: category_get_goods

/**
 * 获得分类下的商品
 *
 * @access  public
 * @param   string  $children
 * @return  array
 */
function category_get_goods($children, $brand, $min, $max, $ext, $size, $page, $sort, $order)
{
    $filter = isset($_REQUEST['filter']) ? intval($_REQUEST['filter']) : 0;
    $display = $GLOBALS['display'];
    $where = "g.is_on_sale = 1 AND g.is_alone_sale = 1 AND " . "g.is_delete = 0 AND ({$children} OR " . get_extension_goods($children) . ')';
    if ($filter == 1) {
        $where .= ' AND g.supplier_id=0 ';
    } elseif ($filter == 2) {
        $where .= ' AND g.supplier_id>0 ';
    } else {
    }
    if ($brand > 0) {
        /* 代码修改_start  By  www.68ecshop.com */
        if (strstr($brand, '_')) {
            $brand_sql = str_replace("_", ",", $brand);
            $where .= "AND g.brand_id in ({$brand_sql}) ";
        } else {
            $where .= "AND g.brand_id={$brand} ";
        }
        /* 代码修改_end  By  www.68ecshop.com */
    }
    if ($min > 0) {
        $where .= " AND g.shop_price >= {$min} ";
    }
    if ($max > 0) {
        $where .= " AND g.shop_price <= {$max} ";
    }
    if ($sort == goods_number) {
        $where .= " AND g.goods_number != 0 ";
    }
    /* 获得商品列表 */
    $sort = $sort == 'shop_price' ? 'shop_p' : $sort;
    $sql = "SELECT g.goods_id, g.goods_name, g.goods_name_style, g.click_count, g.goods_number, g.market_price, " . " g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, " . " IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, " . " IF(g.promote_price != '' " . " AND g.promote_start_date < " . gmtime() . " AND g.promote_end_date > " . gmtime() . ", g.promote_price, shop_price) " . " AS shop_p, g.goods_type, " . " g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img " . " FROM " . $GLOBALS['ecs']->table('goods') . " AS g " . " LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . " ON mp.goods_id = g.goods_id " . " AND mp.user_rank = '{$_SESSION['user_rank']}' " . " WHERE {$where} {$ext} " . " ORDER BY {$sort} {$order}";
    if ($sort == 'salenum') {
        $sql = "SELECT IFNULL(o.num,0) AS salenum, g.goods_id, g.goods_name, g.click_count, g.goods_number, g.goods_name_style, " . " g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, " . " IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, g.goods_type, " . " g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img " . " FROM " . $GLOBALS['ecs']->table('goods') . " AS g " . " LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . " ON mp.goods_id = g.goods_id " . " AND mp.user_rank = '{$_SESSION['user_rank']}' " . " LEFT JOIN " . " (SELECT " . " SUM(og.`goods_number`) " . " AS num,og.goods_id " . " FROM " . " ecs_order_goods AS og, " . " ecs_order_info AS oi " . " WHERE oi.pay_status = 2 " . " AND oi.order_status >= 1 " . " AND oi.order_id = og.order_id " . " GROUP BY og.goods_id) " . " AS o " . " ON o.goods_id = g.goods_id " . " WHERE {$where} {$ext} " . " ORDER BY {$sort} {$order}";
    }
    $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
    $arr = array();
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        if ($row['promote_price'] > 0) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
        } else {
            $promote_price = 0;
        }
        /* 处理商品水印图片 */
        $watermark_img = '';
        if ($promote_price != 0) {
            $watermark_img = "watermark_promote_small";
        } elseif ($row['is_new'] != 0) {
            $watermark_img = "watermark_new_small";
        } elseif ($row['is_best'] != 0) {
            $watermark_img = "watermark_best_small";
        } elseif ($row['is_hot'] != 0) {
            $watermark_img = 'watermark_hot_small';
        }
        if ($watermark_img != '') {
            $arr[$row['goods_id']]['watermark_img'] = $watermark_img;
        }
        $arr[$row['goods_id']]['goods_id'] = $row['goods_id'];
        if ($display == 'grid') {
            $arr[$row['goods_id']]['goods_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
        } else {
            $arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
        }
        $arr[$row['goods_id']]['goods_number'] = $row['goods_number'];
        $arr[$row['goods_id']]['name'] = $row['goods_name'];
        $arr[$row['goods_id']]['is_promote'] = $row['is_promote'];
        $arr[$row['goods_id']]['is_new'] = $row['is_new'];
        $arr[$row['goods_id']]['is_hot'] = $row['is_hot'];
        $arr[$row['goods_id']]['is_best'] = $row['is_best'];
        $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief'];
        $arr[$row['goods_id']]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
        $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']);
        $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
        $arr[$row['goods_id']]['type'] = $row['goods_type'];
        $arr[$row['goods_id']]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
        $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
        $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
        $arr[$row['goods_id']]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
        $arr[$row['goods_id']]['comment_count'] = get_comment_count($row['goods_id']);
        $arr[$row['goods_id']]['count'] = selled_count($row['goods_id']);
        $arr[$row['goods_id']]['click_count'] = $row['click_count'];
        /* 检查是否已经存在于用户的收藏夹 */
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('collect_goods') . " WHERE user_id='{$_SESSION['user_id']}' AND goods_id = " . $row['goods_id'];
        if ($GLOBALS['db']->GetOne($sql) > 0) {
            $arr[$row['goods_id']]['is_collet'] = 1;
        } else {
            $arr[$row['goods_id']]['is_collet'] = 0;
        }
    }
    return $arr;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:99,代码来源:category.php

示例5: get_image_path

     $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
     $arr[$row['goods_id']]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
     $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief'];
     $arr[$row['goods_id']]['is_best'] = $row['is_best'];
     $time = gmtime();
     if ($time >= $row['promote_start_date'] && $time <= $row['promote_end_date']) {
         $arr[$row['goods_id']]['gmt_end_time'] = local_date('M d, Y H:i:s', $row['promote_end_date']);
     } else {
         $arr[$row['goods_id']]['gmt_end_time'] = 0;
     }
     if ($row['shop_price'] != 0) {
         //dqy add start 2011-8-24
         $arr[$row['goods_id']]['zhekou'] = number_format(number_format($row['promote_price'], 2) / number_format($row['shop_price'], 2), 2) * 10;
     }
     $arr[$row['goods_id']]['jiesheng'] = $row['shop_price'] - $row['promote_price'];
     $arr[$row['goods_id']]['count1'] = selled_count($row['goods_id']);
 }
 if ($display == 'grid') {
     if (count($arr) % 2 != 0) {
         $arr[] = array();
     }
 }
 $smarty->assign('goods_list', $arr);
 $smarty->assign('category', $category);
 $smarty->assign('keywords', htmlspecialchars(stripslashes($_REQUEST['keywords'])));
 $smarty->assign('search_keywords', stripslashes(htmlspecialchars_decode($_REQUEST['keywords'])));
 $smarty->assign('brand', $_REQUEST['brand']);
 $smarty->assign('min_price', $min_price);
 $smarty->assign('max_price', $max_price);
 $smarty->assign('outstock', $_REQUEST['outstock']);
 /* 分页 */
开发者ID:moonlight-wang,项目名称:feilun,代码行数:31,代码来源:pro_search.php

示例6: get_virtual_goods_list

/**
 * 获取虚拟商品列表
 * @param type $search
 * @return type
 */
function get_virtual_goods_list($search)
{
    $page = !empty($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1;
    $size = !empty($_CFG['page_size']) && intval($_CFG['page_size']) > 0 ? intval($_CFG['page_size']) : 8;
    $sort = empty($_REQUEST['sort']) ? $search['list_default_sort'] : trim($_REQUEST['sort']);
    $order = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
    $cat_id = $search['cat_id'];
    $catch_id = $search['catch_id'];
    $city_id = $search['city_id'];
    $county_id = $search['county_id'];
    $district_id = $search['district_id'];
    $where = '';
    $wherecat = '';
    //    if($cat_id != 0){
    //        $wherecat = " and cat_id = '$cat_id'";
    //    }
    //    if($cat_id != 0 && $catch_id != 0){
    //        $wherecat = " and cat_id = '$catch_id'";
    //    }
    if ($cat_id != 0) {
        if ($catch_id != 0) {
            $wherecat = " and cat_id = '{$catch_id}'";
        } else {
            $sql = "select distinct cat_id  from " . $GLOBALS['ecs']->table("category") . " where parent_id={$cat_id}";
            $cat_ids = $GLOBALS['db']->getCol($sql);
            if (empty($cat_ids)) {
                $cat_ids = array(0);
            }
            $wherecat = " and (cat_id = '{$cat_id}' or cat_id in (" . implode(',', $cat_ids) . "))";
        }
    }
    if ($city_id != 0) {
        $where .= " and city = '{$city_id}'";
    }
    if ($county_id != 0) {
        $where .= " and county= '{$county_id}'";
    }
    if ($district_id != 0) {
        $where .= " and district_id = {$district_id}";
    }
    $sql = "select distinct district_id from " . $GLOBALS['ecs']->table("virtual_goods_district") . " where 1 " . $where;
    $district_ids = $GLOBALS['db']->getAll($sql);
    $district_ids_array = array();
    foreach ($district_ids as $k => $v) {
        $district_ids_array[] = $v['district_id'];
    }
    if (empty($district_ids_array)) {
        $district_ids_array = array(0);
    }
    $sql = "select goods_id from " . $GLOBALS['ecs']->table("virtual_district") . " where district_id in (" . implode(',', $district_ids_array) . ")";
    $goods_ids = $GLOBALS['db']->getAll($sql);
    $goods_ids_array = array();
    foreach ($goods_ids as $k => $v) {
        $goods_ids_array[] = $v['goods_id'];
    }
    if (empty($goods_ids_array)) {
        $goods_ids_array = array(0);
    }
    $sql = "select count(*) from " . $GLOBALS['ecs']->table("goods") . " where is_on_sale='1' and is_delete = '0' and is_real='0' and extension_code = 'virtual_good' " . $wherecat . "  and goods_id in (" . implode(',', $goods_ids_array) . ")";
    $count = $GLOBALS['db']->getOne($sql);
    $max_page = $count > 0 ? ceil($count / $size) : 1;
    if ($page > $max_page) {
        $page = $max_page;
    }
    //$sql = "select * from ".$GLOBALS['ecs']->table("goods")." where is_delete = '0' and is_real='0' and extension_code = 'virtual_good' ".$wherecat."  and goods_id in (".implode(',',$goods_ids_array).") ORDER BY $sort $order";
    $sql = "select g.goods_id,g.goods_name,g.goods_number,g.supplier_id,g.cat_id,g.add_time,g.valid_date,g.last_update,g.shop_price,g.goods_thumb,ifnull(salenum,0) as salenum from " . $GLOBALS['ecs']->table("goods") . " as g left join (select goods_id,order_id, count(*) as salenum from " . $GLOBALS['ecs']->table("order_goods") . " group by goods_id) as og on og.goods_id = g.goods_id \r\n            left join (select order_id from " . $GLOBALS['ecs']->table("order_info") . " where order_status = '5') as oi on oi.order_id = og.order_id" . " where g.is_on_sale='1' and g.is_delete = '0' and g.is_real='0' and g.extension_code = 'virtual_good' " . $wherecat . "  and g.goods_id in (" . implode(',', $goods_ids_array) . ") ORDER BY {$sort} {$order}";
    $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
    $virtual_goods = array();
    while ($goods_list = $GLOBALS['db']->fetchRow($res)) {
        $sql = "select supplier_id,supplier_name from " . $GLOBALS['ecs']->table("supplier") . " where supplier_id = " . $goods_list['supplier_id'];
        $supplier = $GLOBALS['db']->getRow($sql);
        $goods_list['supplier_name'] = $supplier['supplier_name'];
        $goods_list['add_time'] = date("Y-m-d H:i:s", $goods_list['add_time']);
        $goods_list['last_update'] = date("Y-m-d H:i:s", $goods_list['last_update']);
        $goods_list['valid_date'] = date("Y-m-d H:i:s", $goods_list['valid_date']);
        $goods_list['count1'] = selled_count($goods_list['goods_id']);
        $virtual_goods[] = $goods_list;
    }
    $pager = get_pager('virtual_group.php', array('act' => 'list', 'show' => 'goods'), $count, $page, $size);
    $pager['sort'] = $sort;
    $pager['order'] = $order;
    return array('pager' => $pager, 'virtual_goods' => $virtual_goods);
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:88,代码来源:virtual_group.php

示例7: brand_get_goods

/**
 * 获得品牌下的商品
 *
 * @access  private
 * @param   integer  $brand_id
 * @return  array
 */
function brand_get_goods($brand_id, $cate, $size, $page, $sort, $order)
{
    global $suppId;
    $cate_where = $cate > 0 ? 'AND ' . get_children($cate) : '';
    /* 获得商品列表 */
    /*$sql = 'SELECT g.goods_id, g.goods_name, g.click_count, g.market_price, g.shop_price AS org_price, ' .
          "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, " .
          'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' .
      'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
      'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' .
          "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' " .
      "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.supplier_id = '$suppId' AND g.brand_id = '$brand_id' $cate_where".
      "ORDER BY $sort $order";*/
    $sql = 'SELECT g.goods_id, g.goods_name, g.click_count, g.goods_number, g.market_price, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, " . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.brand_id = '{$brand_id}' {$cate_where}" . "ORDER BY {$sort} {$order}";
    /* 代码增加_start  By  www.68ecshop.com */
    if ($sort == 'salenum') {
        $sql = 'SELECT SUM(o.goods_number) as salenum, g.goods_id, g.goods_name, g.click_count, g.goods_number, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, g.goods_type, " . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "LEFT JOIN " . $GLOBALS['ecs']->table('order_goods') . " as o ON o.goods_id = g.goods_id " . " where g.brand_id = '{$brand_id}' {$ext} group by g.goods_id ORDER BY {$sort} {$order}";
    }
    /* 代码增加_end  By  www.68ecshop.com */
    $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
    $arr = array();
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        if ($row['promote_price'] > 0) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
        } else {
            $promote_price = 0;
        }
        $arr[$row['goods_id']]['goods_id'] = $row['goods_id'];
        if ($GLOBALS['display'] == 'grid') {
            $arr[$row['goods_id']]['goods_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
        } else {
            $arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
        }
        $arr[$row['goods_id']]['name'] = $row['goods_name'];
        $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']);
        $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
        $arr[$row['goods_id']]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
        $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief'];
        $arr[$row['goods_id']]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
        $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
        $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
        $arr[$row['goods_id']]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
        $arr[$row['goods_id']]['comment_count'] = get_comment_count($row['goods_id']);
        $arr[$row['goods_id']]['count'] = selled_count($row['goods_id']);
        $arr[$row['goods_id']]['click_count'] = $row['click_count'];
        $arr[$row['goods_id']]['goods_number'] = $row['goods_number'];
        /* 检查是否已经存在于用户的收藏夹 */
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('collect_goods') . " WHERE user_id='{$_SESSION['user_id']}' AND goods_id = " . $row['goods_id'];
        if ($GLOBALS['db']->GetOne($sql) > 0) {
            $arr[$row['goods_id']]['is_collet'] = 1;
        } else {
            $arr[$row['goods_id']]['is_collet'] = 0;
        }
    }
    return $arr;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:63,代码来源:brand.php

示例8: get_goods_fittings

 // 关联文章
 $smarty->assign('fittings', get_goods_fittings(array($goods_id)));
 // 配件
 $smarty->assign('rank_prices', get_user_rank_prices($goods_id, $shop_price));
 // 会员等级价格
 $smarty->assign('pictures', get_goods_gallery($goods_id));
 // 商品相册
 $smarty->assign('bought_goods', get_also_bought($goods_id));
 // 购买了该商品的用户还购买了哪些商品
 $smarty->assign('goods_rank', get_goods_rank($goods_id));
 // 商品的销售排名
 //yyy添加start  //商品评价个数
 $count = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('comment') . " where comment_type=0 and id_value ='{$goods_id}' and status=1");
 $smarty->assign('review_count', $count);
 //yyy添加end
 $smarty->assign('order_num', selled_count($goods_id));
 $smarty->assign('pinglun', get_evaluation_sum($goods_id));
 $sql = "select * from " . $ecs->table('comment') . " where comment_type=0 and status=1 and comment_rank!=0 and id_value={$goods_id}";
 $comments = $db->getall($sql);
 $coun12t = count($comments);
 $yixing = 0;
 $erxing = 0;
 $sanxing = 0;
 $sixing = 0;
 $wuxing = 0;
 $haoping = 0;
 foreach ($comments as $value) {
     if ($value['comment_rank'] == 1) {
         $yixing = $yixing + 1;
         $haoping = $haoping + 1;
     }
开发者ID:seanguo166,项目名称:yinoos,代码行数:31,代码来源:pocking.php

示例9: assign_cat_goods

/**
 * 获得指定分类下的商品
 *
 * @access  public
 * @param   integer     $cat_id     分类ID
 * @param   integer     $num        数量
 * @param   string      $from       来自web/wap的调用
 * @param   string      $order_rule 指定商品排序规则
 * @return  array
 */
function assign_cat_goods($cat_id, $num = 0, $from = 'web', $order_rule = '')
{
    $children = get_children($cat_id);
    $sql = 'SELECT g.goods_id, g.goods_name,g.click_count,g.market_price, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . 'g.promote_price, promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img ' . "FROM " . $GLOBALS['ecs']->table('goods') . ' AS g ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . 'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND ' . 'g.is_delete = 0 AND (' . $children . 'OR ' . get_extension_goods($children) . ') ';
    $order_rule = empty($order_rule) ? 'ORDER BY g.sort_order, g.goods_id DESC' : $order_rule;
    $sql .= $order_rule;
    if ($num > 0) {
        $sql .= ' LIMIT ' . $num;
    }
    $res = $GLOBALS['db']->getAll($sql);
    $goods = array();
    foreach ($res as $idx => $row) {
        if ($row['promote_price'] > 0) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
            $goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
        } else {
            $goods[$idx]['promote_price'] = '';
        }
        $goods[$idx]['id'] = $row['goods_id'];
        $goods[$idx]['name'] = $row['goods_name'];
        $goods[$idx]['brief'] = $row['goods_brief'];
        $goods[$idx]['market_price'] = price_format($row['market_price']);
        $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
        $goods[$idx]['shop_price'] = price_format($row['shop_price']);
        $goods[$idx]['thumb'] = '../' . get_image_path($row['goods_id'], $row['goods_thumb'], true);
        $goods[$idx]['goods_img'] = '../' . get_image_path($row['goods_id'], $row['goods_img']);
        $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
        $goods[$idx]['count'] = selled_count($row['goods_id']);
        $goods[$idx]['click_count'] = $row['click_count'];
    }
    if ($from == 'web') {
        $GLOBALS['smarty']->assign('cat_goods_' . $cat_id, $goods);
    } elseif ($from == 'wap') {
        $cat['goods'] = $goods;
    }
    /* 分类信息 */
    $sql = 'SELECT cat_name FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '{$cat_id}'";
    $cat['name'] = $GLOBALS['db']->getOne($sql);
    $cat['url'] = build_uri('category', array('cid' => $cat_id), $cat['name']);
    $cat['id'] = $cat_id;
    return $cat;
}
开发者ID:firsteam,项目名称:falcons,代码行数:52,代码来源:lib_goods.php


注:本文中的selled_count函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。