本文整理汇总了PHP中get_extension_goods函数的典型用法代码示例。如果您正苦于以下问题:PHP get_extension_goods函数的具体用法?PHP get_extension_goods怎么用?PHP get_extension_goods使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_extension_goods函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: index_get_cat_id_goods_best_list
/**
* 获得cat_id精品列表。
*
* @access private
* @param integer
* @return array
*/
function index_get_cat_id_goods_best_list($cat_id, $num)
{
$sql = 'Select g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price, g.promote_price, ' . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, " . "g.is_best, g.is_new, g.is_hot, g.is_promote " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "Where g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.is_best = 1 AND (" . $cat_id . " OR " . get_extension_goods($cat_id) . ")";
$cats = get_children($cat_id);
$where = !empty($cats) ? "AND ({$cats} OR " . get_extension_goods($cats) . ") " : '';
$sql .= $where . " LIMIT {$num}";
$res = $GLOBALS['db']->getAll($sql);
$goods = array();
foreach ($res as $idx => $row) {
$goods[$idx]['id'] = $row['article_id'];
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['name'] = $row['goods_name'];
$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'] = empty($row['goods_thumb']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_thumb'];
$goods[$idx]['goods_img'] = empty($row['goods_img']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_img'];
$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
}
return $goods;
}
开发者ID:hackjiyi,项目名称:maozishifa,代码行数:32,代码来源:allcate.php
示例2: gz_get_category_recommend_goods
function gz_get_category_recommend_goods($type = '', $cats = '', $brand = 0, $min = 0, $max = 0, $ext = '')
{
$brand_where = $brand > 0 ? " AND g.brand_id = '{$brand}'" : '';
$price_where = $min > 0 ? " AND g.shop_price >= {$min} " : '';
$price_where .= $max > 0 ? " AND g.shop_price <= {$max} " : '';
$sql = 'SELECT g.goods_id, g.goods_name, 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, goods_img, g.original_img, b.brand_name ' . '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 ' . $brand_where . $price_where . $ext;
$num = 0;
$type2lib = array('best' => 'recommend_best', 'new' => 'recommend_new', 'hot' => 'recommend_hot', 'promote' => 'recommend_promotion');
$num = get_library_number($type2lib[$type]);
switch ($type) {
case 'best':
$sql .= ' AND is_best = 1';
break;
case 'new':
$sql .= ' AND is_new = 1';
break;
case 'hot':
$sql .= ' AND is_hot = 1';
break;
case 'promote':
$time = gmtime();
$sql .= " AND is_promote = 1 AND promote_start_date <= '{$time}' AND promote_end_date >= '{$time}'";
break;
}
if (!empty($cats)) {
$sql .= " AND (" . $cats . " OR " . get_extension_goods($cats) . ")";
}
$order_type = $GLOBALS['_CFG']['recommend_order'];
$sql .= $order_type == 0 ? ' ORDER BY g.sort_order, g.last_update DESC' : ' ORDER BY RAND()';
$res = $GLOBALS['db']->selectLimit($sql, $num);
$idx = 0;
$goods = 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']);
$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'] = $row['brand_name'];
$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]['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']);
$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
$idx++;
}
return $goods;
}
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:55,代码来源:category.php
示例3: get_cat_goods
/**
* 获得分类下的商品
*
* @access public
* @param string $children
* @return array
*/
function get_cat_goods($cat = '', $size = 0, $brand = 0, $min = 0, $max = 0, $ext = '', $sort = '', $order = '')
{
$children = get_children($cat);
$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 ($brand > 0) {
$where .= "AND g.brand_id={$brand} ";
}
if ($min > 0) {
$where .= " AND g.shop_price >= {$min} ";
}
if ($max > 0) {
$where .= " AND g.shop_price <= {$max} ";
}
/* 获得商品列表 */
$sql = 'SELECT g.goods_id, g.goods_name, 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']}' " . "WHERE {$where} {$ext} ORDER BY {$sort} {$order} g.sort_order, g.last_update DESC";
$res = $GLOBALS['db']->selectLimit($sql, $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']]['id'] = $row['goods_id'];
$arr[$row['goods_id']]['name'] = $row['goods_name'];
$arr[$row['goods_id']]['brief'] = $row['goods_brief'];
$arr[$row['goods_id']]['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']]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$arr[$row['goods_id']]['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']]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$arr[$row['goods_id']]['short_style_name'] = add_style($arr[$row['goods_id']]['short_name'], $row['goods_name_style']);
}
return $arr;
}
开发者ID:qgz,项目名称:ecshop,代码行数:60,代码来源:lib_main.php
示例4: ceil
$price_grade *= 10;
}
//跨度
$dx = ceil(($row['max'] - $row['min']) / $cat['grade'] / $price_grade) * $price_grade;
if ($dx == 0) {
$dx = $price_grade;
}
for ($i = 1; $row['min'] > $dx * $i; $i++) {
}
for ($j = 1; $row['min'] > $dx * ($i - 1) + $price_grade * $j; $j++) {
}
$row['min'] = $dx * ($i - 1) + $price_grade * ($j - 1);
for (; $row['max'] >= $dx * $i; $i++) {
}
$row['max'] = $dx * $i + $price_grade * ($j - 1);
$sql = "SELECT (FLOOR((g.shop_price - {$row['min']}) / {$dx})) AS sn, COUNT(*) AS goods_num " . " FROM " . $ecs->table('goods') . " AS g " . " WHERE ({$children} OR " . get_extension_goods($children) . ') AND g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 ' . " GROUP BY sn ";
$price_grade = $db->getAll($sql);
foreach ($price_grade as $key => $val) {
$temp_key = $key + 1;
$price_grade[$temp_key]['goods_num'] = $val['goods_num'];
$price_grade[$temp_key]['start'] = $row['min'] + round($dx * $val['sn']);
$price_grade[$temp_key]['end'] = $row['min'] + round($dx * ($val['sn'] + 1));
$price_grade[$temp_key]['price_range'] = $price_grade[$temp_key]['start'] . ' - ' . $price_grade[$temp_key]['end'];
$price_grade[$temp_key]['formated_start'] = price_format($price_grade[$temp_key]['start']);
$price_grade[$temp_key]['formated_end'] = price_format($price_grade[$temp_key]['end']);
$price_grade[$temp_key]['url'] = build_uri('category', array('cid' => $cat_id, 'bid' => $brand, 'price_min' => $price_grade[$temp_key]['start'], 'price_max' => $price_grade[$temp_key]['end'], 'filter_attr' => $filter_attr_str), $cat['cat_name']);
/* 判断价格区间是否被选中 */
if (isset($_REQUEST['price_min']) && $price_grade[$temp_key]['start'] == $price_min && $price_grade[$temp_key]['end'] == $price_max) {
$price_grade[$temp_key]['selected'] = 1;
} else {
$price_grade[$temp_key]['selected'] = 0;
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:31,代码来源:price_range.php
示例5: 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 = '')
{
$sql = 'SELECT sort_order FROM ' . $GLOBALS['ecs']->table('template') . " WHERE filename = 'index' AND type = 1 AND remarks ='' AND id = {$cat_id} ";
$sort_order = $GLOBALS['db']->getOne($sql);
$cat['sort_order'] = $sort_order;
$children = get_children($cat_id);
$sql = 'SELECT g.goods_id, g.goods_name, 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'] = intval(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']);
}
$cat['goods_level2'] = $goods;
//print_r($goods);exit;
if ($from == 'web') {
$GLOBALS['smarty']->assign('cat_goods_' . $cat_id, $goods);
} elseif ($from == 'wap') {
$cat['goods'] = $goods;
}
/* 分类信息 */
$sql = 'SELECT cat_name,cat_desc,is_standalone FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = {$cat_id}";
$theRow = $GLOBALS['db']->getRow($sql);
$cat['name'] = $theRow['cat_name'];
$cat['des'] = $theRow['cat_desc'];
$cat['id'] = $cat_id;
$cat['cat_clild'] = get_clild_list($cat_id);
$cat['isalone'] = $theRow['is_standalone'];
if ($cat['isalone'] == 0) {
$cat['url'] = build_uri('category', array('cid' => $cat_id, 'isalone' => $cat['isalone']), $cat['name']);
} else {
$cat['url'] = build_uri('category', array('cid' => $cat_id, 'isalone' => $cat['isalone']), $cat['name']);
}
//获取二级分类下的商品
/*$cat_list_arr = cat_list($cat_id, 0 , false);
foreach($cat_list_arr as $key=>$value)
{
if($value['level'] == 1)
{
$sql = 'SELECT g.goods_id,g.cat_id, g.goods_name, 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 is_delete = 0 AND ' . get_children($value['cat_id']) . ' ORDER BY g.sort_order, g.goods_id DESC';
if ($num > 0)
{
$sql .= ' LIMIT ' . $num;
}
$goods_res = $GLOBALS['db']->getAll($sql);
foreach($goods_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_res[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
}
else
{
$goods_res[$idx]['promote_price'] = '';
}
$goods_res[$idx]['market_price'] = $row['market_price'];
$goods_res[$idx]['shop_price'] = price_format($row['shop_price'],false);
$goods_res[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price,false) : '';
$goods_res[$idx]['shop_price'] = price_format($row['shop_price'],false);
$goods_res[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$goods_res[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
//.........这里部分代码省略.........
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:101,代码来源:lib_goods.php
示例6: get_cagtegory_goods_count
/**
* 获得分类下的商品总数
*
* @access public
* @param string $cat_id
* @return integer
*/
function get_cagtegory_goods_count($children, $brand = 0, $other_has, $min = 0, $max = 0, $ext = '')
{
$filter = isset($_REQUEST['filter']) ? intval($_REQUEST['filter']) : 0;
$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) {
$where .= " AND g.brand_id = {$brand} ";
}
if ($min >= 0 && $max > $min) {
$where .= " AND (g.shop_price between {$min} AND {$max}) ";
}
// if ($max > 0)
// {
// $where .= " AND g.shop_price <= $max ";
// }
if ($other_has > 0) {
switch ($other_has) {
case 1:
break;
case 2:
$where .= " AND g.supplier_id = 0 ";
break;
case 3:
$where .= " AND g.supplier_id > 0 ";
break;
}
}
/* 返回商品总数 */
return $GLOBALS['db']->getOne('SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('goods') . " AS g WHERE {$where} {$ext}");
}
开发者ID:moonlight-wang,项目名称:feilun,代码行数:42,代码来源:category.php
示例7: cat_get_goods
function cat_get_goods($keywords, $children, $brand, $min, $max, $ext, $size, $page, $sort, $order)
{
$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 ($keywords != '') {
$where .= " AND g.goods_name LIKE '%{$keywords}%' ";
}
if ($brand > 0) {
$where .= "AND g.brand_id={$brand} ";
}
if ($min > 0) {
$where .= " AND g.shop_price >= {$min} ";
}
if ($max > 0) {
$where .= " AND g.shop_price <= {$max} ";
}
/* 获得商品列表 */
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_sn, 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, " . '(select AVG(r.comment_rank) from ' . $GLOBALS['ecs']->table('comment') . ' as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_rank, ' . '(select IFNULL(sum(og.goods_number), 0) from ' . $GLOBALS['ecs']->table('order_goods') . ' as og where og.goods_id = g.goods_id) AS sell_number, ' . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img, click_count ' . '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}";
$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']]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
}
$arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
$arr[$row['goods_id']]['name'] = $row['goods_name'];
$arr[$row['goods_id']]['goods_sn'] = $row['goods_sn'];
$arr[$row['goods_id']]['comment_rank'] = $row['comment_rank'];
$arr[$row['goods_id']]['sell_number'] = $row['sell_number'];
$arr[$row['goods_id']]['is_new'] = $row['is_new'];
$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']);
}
return $arr;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:62,代码来源:category.php
示例8: get_exchange_recommend_goods
/**
* 获得指定分类下的推荐商品
*
* @access public
* @param string $type 推荐类型,可以是 best, new, hot, promote
* @param string $cats 分类的ID
* @param integer $min 商品积分下限
* @param integer $max 商品积分上限
* @param string $ext 商品扩展查询
* @return array
*/
function get_exchange_recommend_goods($type = '', $cats = '', $min = 0, $max = 0, $ext = '')
{
$price_where = $min > 0 ? " AND g.shop_price >= {$min} " : '';
$price_where .= $max > 0 ? " AND g.shop_price <= {$max} " : '';
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, eg.exchange_integral, ' . 'g.goods_brief, g.goods_thumb, goods_img, b.brand_name ' . 'FROM ' . $GLOBALS['ecs']->table('exchange_goods') . ' AS eg ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = eg.goods_id ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' . 'WHERE eg.is_exchange = 1 AND g.is_delete = 0 ' . $price_where . $ext;
$num = 0;
$type2lib = array('best' => 'exchange_best', 'new' => 'exchange_new', 'hot' => 'exchange_hot');
$num = get_library_number($type2lib[$type], 'exchange_list');
switch ($type) {
case 'best':
$sql .= ' AND eg.is_best = 1';
break;
case 'new':
$sql .= ' AND eg.is_new = 1';
break;
case 'hot':
$sql .= ' AND eg.is_hot = 1';
break;
}
if (!empty($cats)) {
$sql .= " AND (" . $cats . " OR " . get_extension_goods($cats) . ")";
}
$order_type = $GLOBALS['_CFG']['recommend_order'];
$sql .= $order_type == 0 ? ' ORDER BY g.sort_order, g.last_update DESC' : ' ORDER BY RAND()';
$res = $GLOBALS['db']->selectLimit($sql, $num);
$idx = 0;
$goods = array();
while ($row = $GLOBALS['db']->fetchRow($res)) {
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['name'] = $row['goods_name'];
$goods[$idx]['brief'] = $row['goods_brief'];
$goods[$idx]['brand_name'] = $row['brand_name'];
$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]['exchange_integral'] = $row['exchange_integral'];
$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('exchange_goods', array('gid' => $row['goods_id']), $row['goods_name']);
$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
$idx++;
}
return $goods;
}
开发者ID:nirvana-info,项目名称:old_bak,代码行数:53,代码来源:exchange.php
示例9: get_exchange_recommend_goods
/**
* 获得指定分类下的推荐商品
*
* @access public
* @param string $type 推荐类型,可以是 best, new, hot, promote
* @param string $cats 分类的ID
* @param integer $min 商品积分下限
* @param integer $max 商品积分上限
* @param string $ext 商品扩展查询
* @return array
*/
function get_exchange_recommend_goods($type = '', $cats = '', $min = 0, $max = 0, $ext = '')
{
$price_where = $min > 0 ? " AND g.shop_price >= {$min} " : '';
$price_where .= $max > 0 ? " AND g.shop_price <= {$max} " : '';
$sql = 'SELECT g.goods_id, g.goods_name, eg.needed_money,eg.begin_time, g.shop_price, g.goods_name_style, eg.exchange_integral, ' . 'g.goods_brief, g.goods_thumb, goods_img, b.brand_name ' . 'FROM ' . $GLOBALS['ecs']->table('exchange_goods') . ' AS eg ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = eg.goods_id ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' . 'WHERE eg.is_exchange = 1 AND g.is_delete = 0 AND begin_time < ' . gmtime() . ' ' . $price_where . $ext;
$num = 0;
$type2lib = array('best' => 'exchange_best', 'new' => 'exchange_new', 'hot' => 'exchange_hot');
$num = get_library_number($type2lib[$type], 'exchange_list');
if (!empty($cats)) {
$sql .= " AND (" . $cats . " OR " . get_extension_goods($cats) . ")";
}
switch ($type) {
case 'best':
$sql .= ' AND eg.is_best = 1 ORDER BY eg.exchange_integral DESC';
break;
case 'new':
$sql .= ' AND eg.is_new = 1 ORDER BY eg.needed_money DESC';
break;
case 'hot':
$sql .= ' AND eg.is_hot = 1';
break;
}
$res = $GLOBALS['db']->selectLimit($sql, $num);
$idx = 0;
$goods = array();
while ($row = $GLOBALS['db']->fetchRow($res)) {
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['name'] = $row['goods_name'];
$goods[$idx]['shop_price'] = price_format($row['shop_price']);
$goods[$idx]['brief'] = $row['goods_brief'];
$goods[$idx]['brand_name'] = $row['brand_name'];
$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]['exchange_integral'] = $row['exchange_integral'];
$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('exchange', array('act' => 'view', 'id' => $row['goods_id']));
$goods[$idx]['needed_money'] = price_format($row['needed_money']);
$goods[$idx]['begin_date'] = gmdate('m-d', $row['begin_time']);
$goods[$idx]['begin_hour'] = gmdate('h:i', $row['begin_time']);
$goods[$idx]['integral_integer'] = floor($row['shop_price'] - $row['needed_money']);
$goods[$idx]['integral_decimal'] = end(explode('.', number_format($row['shop_price'] - $row['needed_money'], 1)));
$goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
$idx++;
}
return $goods;
}
开发者ID:norain2050,项目名称:benhu,代码行数:58,代码来源:exchange.php
示例10: get_cagtegory_goods_count
/**
* 获得分类下的商品总数
*
* @access public
* @param string $cat_id
* @return integer
*/
function get_cagtegory_goods_count($children, $brand = 0, $min = 0, $max = 0, $ext = '')
{
$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 ($brand > 0) {
$where .= " AND g.brand_id = {$brand} ";
}
if ($min > 0) {
$where .= " AND g.shop_price >= {$min} ";
}
if ($max > 0) {
$where .= " AND g.shop_price <= {$max} ";
}
/* 返回商品总数 */
return $GLOBALS['db']->getOne('SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('goods') . " AS g WHERE {$where} {$ext}");
}
开发者ID:norain2050,项目名称:benhu,代码行数:22,代码来源:category.php
示例11: get_pro_top10
/**
* ���ò�Ʒ������������а�
*
* @access public
* @param string $cats ��ѯ�ķ���
* @return array
*/
function get_pro_top10($cats)
{
$where = !empty($cats) ? "AND (g.cat_id = {$cats} OR " . get_extension_goods($cats) . ") " : '';
/* ����ͳ�Ƶ�ʱ�� */
switch ($GLOBALS['_CFG']['top10_time']) {
case 1:
// һ��
$top10_time = "AND o.order_sn >= '" . date('Ymd', gmtime() - 365 * 86400) . "'";
break;
case 2:
// ����
$top10_time = "AND o.order_sn >= '" . date('Ymd', gmtime() - 180 * 86400) . "'";
break;
case 3:
// �����
$top10_time = "AND o.order_sn >= '" . date('Ymd', gmtime() - 90 * 86400) . "'";
break;
case 4:
// һ����
$top10_time = "AND o.order_sn >= '" . date('Ymd', gmtime() - 30 * 86400) . "'";
break;
default:
$top10_time = '';
}
$sql = 'SELECT g.goods_id, g.goods_name,g.goods_brief, g.shop_price, g.goods_thumb, SUM(og.goods_number) as goods_number ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g, ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' . $GLOBALS['ecs']->table('order_goods') . ' AS og ' . "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 {$where} {$top10_time} ";
//�ж��Ƿ����ÿ�棬������Ƿ����0
if ($GLOBALS['_CFG']['use_storage'] == 1) {
$sql .= " AND g.goods_number > 0 ";
}
$sql .= ' AND og.order_id = o.order_id AND og.goods_id = g.goods_id ' . "AND o.order_status = '" . OS_CONFIRMED . "' " . "AND (o.pay_status = '" . PS_PAYED . "' OR o.pay_status = '" . PS_PAYING . "') " . "AND (o.shipping_status = '" . SS_SHIPPED . "' OR o.shipping_status = '" . SS_RECEIVED . "') " . 'GROUP BY g.goods_id ORDER BY goods_number DESC, g.goods_id DESC LIMIT ' . $GLOBALS['_CFG']['top_number'];
$arr = $GLOBALS['db']->getAll($sql);
for ($i = 0, $count = count($arr); $i < $count; $i++) {
$arr[$i]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($arr[$i]['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $arr[$i]['goods_name'];
$arr[$i]['url'] = build_uri('goods', array('gid' => $arr[$i]['goods_id']), $arr[$i]['goods_name']);
$arr[$i]['thumb'] = get_image_path($arr[$i]['goods_id'], $arr[$i]['goods_thumb'], true);
$arr[$i]['price'] = price_format($arr[$i]['shop_price']);
$arr[$i]['goods_brief'] = $arr[$i]['goods_brief'];
}
return $arr;
}
开发者ID:firsteam,项目名称:falcons,代码行数:47,代码来源:lib_category_index.php
示例12: prices
public function prices () {
global $ecs,$db;
$cat_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
if (!$cat_id) {
$result = rpcLang('category.php', 'goodslist_failure');
jsonExit("{\"status\":\"$result\"}");
}
$cat = get_cat_info($cat_id); // 获得分类的相关信息
$children = get_children($cat_id);
/* 获取价格分级 */
if ($cat['grade'] == 0 && $cat['parent_id'] != 0)
{
$cat['grade'] = get_parent_grade($cat_id); //如果当前分类级别为空,取最近的上级分类
}
if ($cat['grade'] > 1)
{
/* 需要价格分级 */
/*
算法思路:
1、当分级大于1时,进行价格分级
2、取出该类下商品价格的最大值、最小值
3、根据商品价格的最大值来计算商品价格的分级数量级:
价格范围(不含最大值) 分级数量级
0-0.1 0.001
0.1-1 0.01
1-10 0.1
10-100 1
100-1000 10
1000-10000 100
4、计算价格跨度:取整((最大值-最小值) / (价格分级数) / 数量级) * 数量级
5、根据价格跨度计算价格范围区间
6、查询数据库
可能存在问题:
1、由于价格跨度是由最大值、最小值计算出来的
然后再通过价格跨度来确定显示时的价格范围区间
所以可能会存在价格分级数量不正确的问题
该问题没有证明
2、当价格=最大值时,分级会多出来,已被证明存在
*/
//获得当前分类下商品价格的最大值、最小值
$sql = "SELECT min(g.shop_price) AS min, max(g.shop_price) as max ".
" FROM " . $ecs->table('goods'). " AS g ".
" WHERE ($children OR " . get_extension_goods($children) . ') AND g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 ';
$row = $db->getRow($sql);
// 取得价格分级最小单位级数,比如,千元商品最小以100为级数
$price_grade = 0.0001;
for($i=-2; $i<= log10($row['max']); $i++)
{
$price_grade *= 10;
}
//跨度
$dx = ceil(($row['max'] - $row['min']) / ($cat['grade']) / $price_grade) * $price_grade;
if($dx == 0)
{
$dx = $price_grade;
}
for($i = 1; $row['min'] > $dx * $i; $i ++);
for($j = 1; $row['min'] > $dx * ($i-1) + $price_grade * $j; $j++);
$row['min'] = $dx * ($i-1) + $price_grade * ($j - 1);
for(; $row['max'] >= $dx * $i; $i ++);
$row['max'] = $dx * ($i) + $price_grade * ($j - 1);
$sql = "SELECT (FLOOR((g.shop_price - $row[min]) / $dx)) AS sn, COUNT(*) AS goods_num ".
" FROM " . $ecs->table('goods') . " AS g ".
" WHERE ($children OR " . get_extension_goods($children) . ') AND g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 '.
" GROUP BY sn ";
$price_grade = $db->getAll($sql);
$price_arr = array();
foreach ($price_grade as $key=>$val)
{
$price_arr[$key]['goods_num'] = $val['goods_num'];
$price_arr[$key]['start'] = $row['min'] + round($dx * $val['sn']);
$price_arr[$key]['end'] = $row['min'] + round($dx * ($val['sn'] + 1));
}
} else {
$result = rpcLang('category.php', 'prices_empty');
jsonExit("{\"status\":\"$result\"}");
}
jsonExit($price_arr);
}
开发者ID:noikiy,项目名称:mdwp,代码行数:87,代码来源:category.action.php
示例13: get_hot_cat_goods
function get_hot_cat_goods($type = '', $cat_id, $num = 7)
{
$children = get_children($cat_id);
$sql = 'SELECT g.goods_id,g.cat_id, g.goods_name, 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';
switch ($type) {
case 'best':
$sql .= ' AND is_best = 1';
break;
case 'new':
$sql .= ' AND is_new = 1';
break;
case 'hot':
$sql .= ' AND is_hot = 1';
break;
case 'promote':
$time = gmtime();
$sql .= " AND is_promote = 1 AND promote_start_date <= '{$time}' AND promote_end_date >= '{$time}'";
break;
}
$sql .= ' AND (' . $children . 'OR ' . get_extension_goods($children) . ') ' . 'ORDER BY g.sort_order, g.goods_id DESC';
if ($num > 0) {
$sql .= ' LIMIT ' . $num;
}
//echo $sql;
$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'] = '';
}
$temp = $row['cat_id'];
$cat_info = get_hot_cat_info($temp);
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['cat_id'] = $row['cat_id'];
$goods[$idx]['cat_name'] = $cat_info['name'];
$goods[$idx]['cat_url'] = $cat_info['url'];
$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'] = empty($row['goods_thumb']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_thumb'];
$goods[$idx]['goods_img'] = empty($row['goods_img']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_img'];
$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
}
return $goods;
}
开发者ID:moonlight-wang,项目名称:feilun,代码行数:50,代码来源:index.php
示例14: get_cagtegory_goods_count
/**
* 获得分类下的商品总数
*
* @access public
* @param string $cat_id
* @return integer
*/
function get_cagtegory_goods_count($children, $brand = 0, $min = 0, $max = 0, $ext = '')
{
$where = "g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND ({$children} OR " . get_extension_goods($children) . ')';
global $smarty;
if ($brand > 0) {
$where .= " AND g.brand_id = {$brand} ";
}
if ($min > 0) {
$where .= " AND g.shop_price >= {$min} ";
}
if ($max > 0) {
$where .= " AND g.shop_price <= {$max} ";
}
$bindusercardme = $smarty->get_template_vars("bindusercardme");
if (empty($_SESSION['user_id'])) {
$where .= " and g.is_bind_card!='2' ";
}
/* 返回商品总数 */
return $GLOBALS['db']->getOne('SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('goods') . " AS g WHERE {$where} {$ext}");
}
开发者ID:nanhuacrab,项目名称:ecshop,代码行数:27,代码来源:category.php
示例15: get_top10_supplier
/**
* 调用当前分类的销售排行榜
*
* @access public
* @param string $cats 查询的分类
* @return array
*/
function get_top10_supplier($cats = '')
{
$suppid = isset($_GET['suppId']) && intval($_GET['suppId']) > 0 ? intval($_GET['suppId']) : $_SESSION['supplier_id'];
$cats = get_children($cats);
$where = "AND g.supplier_id=" . $suppid;
$where .= !empty($cats) ? " AND ({$cats} OR " . get_extension_goods($cats) . ") " : '';
/* 排行统计的时间 */
switch ($GLOBALS['_CFG']['top10_time']) {
case 1:
// 一年
$top10_time = "AND o.order_sn >= '" . date('Ymd', gmtime() - 365 * 86400) . "'";
break;
case 2:
// 半年
$top10_time = "AND o.order_sn >= '" . date('Ymd', gmtime() - 180 * 86400) . "'";
break;
case 3:
// 三个月
$top10_time = "AND o.order_sn >= '" . date('Ymd', gmtime() - 90 * 86400) . "'";
break;
case 4:
// 一个月
$top10_time = "AND o.order_sn >= '" . date('Ymd', gmtime() - 30 * 86400) . "'";
break;
default:
$top10_time = '';
}
$sql = 'SELECT g.goods_id, g.goods_name, g.shop_price, g.market_price, g.original_img, g.goods_thumb, SUM(og.goods_number) as goods_number, g.supplier_id ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g, ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' . $GLOBALS['ecs']->table('order_goods') . ' AS og ' . "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 {$where} {$top10_time} ";
//判断是否启用库存,库存数量是否大于0
if ($GLOBALS['_CFG']['use_storage'] == 1) {
$sql .= " AND g.goods_number > 0 ";
}
$sql .= ' AND og.order_id = o.order_id AND og.goods_id = g.goods_id ' . "AND (o.order_status = '" . OS_CONFIRMED . "' OR o.order_status = '" . OS_SPLITED . "') " . "AND (o.pay_status = '" . PS_PAYED . "' OR o.pay_status = '" . PS_PAYING . "') " . "
|
请发表评论