专注ECSHOP第九年
始自2007,服务二千多商户,不断为您增光溢彩

ecshop商品分类调用热销商品

第一步,找到根目录下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}-->

 

 

未经允许不得转载:阿牛ECSHOP » ecshop商品分类调用热销商品
1

Parse error: syntax error, unexpected '}' in /www/wwwroot/blog2018.uuecs.com/wp-content/themes/DUX/comments.php on line 31