首先第一步,找到category.php这个文件,然后搜索到“// 销售排行”这几个字,然后我们就可以看到有这么一句话:
纵然走过那么多城市,对于未知的风景,还是好奇。
$smarty->assign(‘top_goods’, get_top10()); // 销售排行
get_top10()这个括号里头是可以填上自己所指定的分类,由于我们现在要做的是调用当前分类的排行,那么只需要把这句话改成:
$smarty->assign(‘top_goods’, get_top10($cat_id)); // 销售排行
第二步,你需要在category.dwt需要调用的地方调用:
<!– {foreach name=top_goods from=$top_goods item=goods}–><li class=”li_nobroder”><a href=”{$goods.url}” title=”{$goods.name|escape:html}”><img src=”{$goods.goods_thumb}” title=”{$goods.name|escape:html}”/></a><p><strong><a href=”{$goods.url}” title=”{$goods.name|escape:html}” >{$goods.short_name}</a></strong></p><p>本店价:{$goods.shop_price}</p><p>市场价:{$goods.market_price}元</p></li><!–{/foreach}–>
当然里面的样式你们可以自己控制的。