想要在ecshop首页调用某个指定分类,方法如下:
<ul class="lh style3">
<?php $children1=g et_children(391); $this->
assign('cat1_promote_goods', get_category_recommend_goods('promote',$children1,8));
?>
<!--{foreach from=$cat1_promote_goods item=goods name=gcurn}-->
//ecshop
<li class="fore{$smarty.foreach.gcurn.iteration}">
<div class="p-img ld">
<a href="{$goods.url}" title="{$goods.name|escape:html}" class="litpic"
target="_blank">
<img src="{$goods.goods_thumb_category}" alt="{$goods.name|escape:html}"
height="150" width="150">
</a>
</div>
<div class="p-name">
<a href="{$goods.url}" title="{$goods.name|escape:html}" target="_blank">
{$goods.name|escape:html}
</a>
</div>
<div class="p-price">
<!-- {if $goods.promote_price neq ""} -->
{$goods.promote_price}
<!-- {else}-->
{$goods.shop_price}
<!--{/if}-->
</div>
</li>
<!--{/foreach}-->
</ul>
关键部分: <?php $children1 = get_children(391); $this->assign('cat1_promote_goods', get_category_recommend_goods('promote',$children1,8)); ?>
391就是调用的分类ID,替换即可!如果要其他属性,请替换promote未new hot best 等属性!