ecshop首页如何调用指定分类下的推荐热销最新商品
其实这个在ecshop中预留这个函数,不知道是不是开发者特意留下,但不想让所有人知道而已,函数在includes/lib_goods.php里面。
下面开始教你如何添加指定分类的下热销产品:
1.在首页index.php中找到
1 2 3 4 | /* 页面中的动态内容 */ assign_dynamic('index') ; |
2.在上面添加如下代码
1 2 3 | $children = get_children(1); $smarty->assign('index_hot_goods_1', get_category_recommend_goods("hot", $children)); // 热销商品 |
其中分类编号1,根据你想调用分类而填写
如果是最新产品就再加上
1 2 3 | $children = get_children(1); $smarty->assign('index_new_goods_1', get_category_recommend_goods("new", $children)); // 最新商品 |
若果是精品产品
1 2 3 | $children = get_children(1); $smarty->assign('index_best_goods_1', get_category_recommend_goods("best", $children)); // 精品商品 |
3.然后再模板库文件中新建index_hot_goods_1.lbi。文件内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <!--{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}--> |
4.然后在首页模板index.dwt中调用index_hot_goods_1.lbi。
1 | <!-- #BeginLibraryItem "/library/index_hot_goods_19.lbi" --><!-- #EndLibraryItem --> |
.如果有多个分类要调用,可以重复1-3的步骤
至于每个调用的商品的数量 ,在后台》》模板设置》》
来源:邦林织梦(微信/QQ号:909912499),欢迎分享本文,转载请保留出处!部分内容来自网络,如有侵权请联系删除处理!
本站提供代码修改,dedecms,WordPress仿站二次开发 / PHP网站建设以及SEO优化等网络营销推广等服务。
如有需要请加QQ: 909912499