ECSHOP获得指定栏目最新的商品列表
/**
* 获得指定栏目最新的商品列表。
*
* @access private
* @return array
*/
function index_get_class_goods($cat_aid, $cat_num)
{
$sql = "SELECT goods_id FROM " .$GLOBALS['ecs']->table('goods'). "WHERE (cat_id = ".$cat_aid." OR goods_id in (".good_cat_id($cat_aid).") ) and is_on_sale = 1 order by `last_update` desc LIMIT " . $cat_num;
$res = $GLOBALS['db']->getAll($sql);
$arr = array();
foreach ($res AS $idx => $row)
{
$arr[$idx]['id'] = $row['goods_id'];
$arr[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']));
}
return $arr;
}
function good_cat_id($cat_aid){
$sql = "SELECT goods_id FROM " .$GLOBALS['ecs']->table('goods_cat'). " WHERE cat_id = ".$cat_aid;
$res = $GLOBALS['db']->getAll($sql);
$arr = array();
foreach ($res AS $row)
{
$arr[] = $row['goods_id'];
}
$ck_explode=implode(',',$arr);
return $ck_explode;
}
在
$smarty->assign(’shop_notice’, $_CFG['shop_notice']); // 商店公告
加上
$smarty->assign(’news_goods’, index_get_class_goods(18,4)); // 新品快递
$smarty->assign(’design_recommend’, index_get_class_goods(35,4)); // 设计师推荐
指定函数定义放到HTML里就可以了
/**
* 获得指定栏目最新的商品列表。
*
* @access private
* @return array
*/
function index_get_class_goods($cat_aid, $cat_num)
{
$sql = "SELECT goods_id FROM " .$GLOBALS['ecs']->table('goods'). "WHERE (cat_id = ".$cat_aid." OR goods_id in (".good_cat_id($cat_aid).") ) and is_on_sale = 1 order by `last_update` desc LIMIT " . $cat_num;
$res = $GLOBALS['db']->getAll($sql);
$arr = array();
foreach ($res AS $idx => $row)
{
$arr[$idx]['id'] = $row['goods_id'];
$arr[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']));
}
return $arr;
}
function good_cat_id($cat_aid){
$sql = "SELECT goods_id FROM " .$GLOBALS['ecs']->table('goods_cat'). " WHERE cat_id = ".$cat_aid;
$res = $GLOBALS['db']->getAll($sql);
$arr = array();
foreach ($res AS $row)
{
$arr[] = $row['goods_id'];
}
$ck_explode=implode(',',$arr);
return $ck_explode;
}
在
$smarty->assign(’shop_notice’, $_CFG['shop_notice']); // 商店公告
加上
$smarty->assign(’news_goods’, index_get_class_goods(18,4)); // 新品快递
$smarty->assign(’design_recommend’, index_get_class_goods(35,4)); // 设计师推荐
指定函数定义放到HTML里就可以了
作者:noel@ECMall Ecmall二次开发 - PHP技术-
地址:http://www.laohucheng.com/post/408/
版权所有©转载时必须以链接形式注明作者和原始出处及本声明!
ECSHOP调用分类文章函数index_get_class_articles
修改ecshop后台的版权信息
2009
11:34
563
0


