ecshop首页如何调用指定分类下的推荐热销最新商品

其实这个在ecshop中预留这个函数,不知道是不是开发者特意留下,但不想让所有人知道而已,函数在includes/lib_goods.php里面。

下面开始教你如何添加指定分类的下热销产品:

1.在首页index.php中找到

[php]

/* 页面中的动态内容 */
assign_dynamic('index');

[/php]

2.在上面添加如下代码

[php]
$children = get_children(1);
$smarty->assign('index_hot_goods_1', get_category_recommend_goods("hot", $children)); // 热销商品

[/php]

其中分类编号1,根据你想调用分类而填写

如果是最新产品就再加上

[php]
$children = get_children(1);
$smarty->assign('index_new_goods_1', get_category_recommend_goods("new", $children)); // 最新商品

[/php]

若果是精品产品

[php]
$children = get_children(1);
$smarty->assign('index_best_goods_1', get_category_recommend_goods("best", $children)); // 精品商品

[/php]

3.然后再模板库文件中新建index_hot_goods_1.lbi。文件内容如下:

[php]

<!--{foreach from=$index_hot_goods_1 item=goods}-->
<li><a href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.name|escape:html}" class="goodsimg" border="0" width="160" height="200" /></a>
<h1><a href="{$goods.url}" title="{$goods.name|escape:html}">{$goods.short_name|escape:html}</a></h1>
<!-- {if $goods.promote_price neq ""} -->
<span>一口价 <b>{$goods.promote_price}</b></span>
<!-- {else}-->
<span>一口价 <b>{$goods.shop_price}</b></span>
<!--{/if}-->
</li>
<!--{/foreach}-->

[/php]

4.然后在首页模板index.dwt中调用index_hot_goods_1.lbi。

[php]

<!-- #BeginLibraryItem "/library/index_hot_goods_19.lbi" --><!-- #EndLibraryItem -->

[/php]

5.如果有多个分类要调用,可以重复1-3的步骤

至于每个调用的商品的数量 ,在后台》》模板设置》》

 

下载说明: 帮助教程
1.资源失效请联系QQ:1138166071补发;寻课加QQ联系
2.资源均为网络收集,仅供参考研究,请在下载后24小时内删除。不要商用和非法用途,否则后果自己承担。
3.默认解压密码:blog.qdql.net
4.购买本站资源即代表同意本站免责协议
5.提示:本站资源属虚拟商品,购买后恕不退款。
6.特别声明本站资源部分来源于网络,如有侵权,请联系站长进行删除处理!
本文地址:http://blog.qdql.net/1472/

发表评论


表情