其实这个在ecshop中预留这个函数,不知道是不是开发者特意留下,但不想让所有人知道而已,函数在includes/lib_goods.php里面。
下面开始教你如何添加指定分类的下热销产品:
1.在首页index.php中找到
2
|
assign_dynamic('index');
|
2.在上面添加如下代码
1
|
$children= get_children(1);
|
2
|
$smarty->assign('index_hot_goods_1', get_category_recommend_goods("hot",$children));// 热销商品
|
其中分类编号1,根据你想调用分类而填写
如果是最新产品就再加上
1
|
$children= get_children(1);
|
2
|
$smarty->assign('index_new_goods_1', get_category_recommend_goods("new",$children));// 最新商品
|
若果是精品产品
1
|
$children= get_children(1);
|
2
|
$smarty->assign('index_best_goods_1', get_category_recommend_goods("best",$children));// 精品商品
|
3.然后再模板库文件中新建index_hot_goods_1.lbi。文件内容如下:
1
|
<!--{foreachfrom=$index_hot_goods_1item=goods}-->
|
2
|
<li><a href="{$goods.url}"><img src="{$goods.thumb}"alt="{$goods.name|escape:html}"class="goodsimg"border="0"width="160"height="200"/></a>
|
3
|
<h1><a href="{$goods.url}"title="{$goods.name|escape:html}">{$goods.short_name|escape:html}</a></h1>
|
4
|
<!-- {if$goods.promote_price neq""} -->
|
5
|
<span>一口价 <b>{$goods.promote_price}</b></span>
|
7
|
<span>一口价 <b>{$goods.shop_price}</b></span>
|
4.然后在首页模板index.dwt中调用index_hot_goods_1.lbi。
1
|
<!-- #BeginLibraryItem"/library/index_hot_goods_19.lbi"--><!-- #EndLibraryItem -->
|
5.如果有多个分类要调用,可以重复1-3的步骤
至于每个调用的商品的数量 ,在后台》》模板设置》》