第一步,找到根目录下category.php,搜索以下代码:
$smarty->assign('top_goods', get_top10()); // 销售排行
第二步:将以上代码替换为:
$smarty->assign('top_goods', get_top10($cats="$_REQUEST[id]")); // 销售排行
“$_REQUEST[id]”的作用就是获取通过地址栏传过来的id (如:category.php?id=xxx)
第三步:在category.dwt需要调用的地方调用:
<!-- {foreach name=top_goods from=$top_goods item=goods}--> <ul> <li class="img"><a href="{$goods.url}" title="{$goods.name|escape:html}"><img src="{$goods.goods_thumb}" title="{$goods.name|escape:html}"/></a></li> <li class="txt"> <p class="til"><a href="{$goods.url}" title="{$goods.name|escape:html}"> {$goods.short_name}</a></p> <p>{$lang.market_price}<small>{$goods.market_price}</small></p> <!--{if $goods.promote_price neq "" } --> <p class="pri">{$lang.promote_price}{$goods.promote_price}</p> <!--{else}--> <p class="pri">{$lang.shop_price}{$goods.shop_price}</p> <!--{/if}--> </li> <div class="clear"></div> </ul> <!--{/foreach}-->
完全支持你,大家都会顶你