无法添加的原因:因为在系统默认引用库项目的时候;商品详情页模版中没有引用热卖的库项目;
解决办法:
1:在goods.php中先添加
$smarty->assign('hot_goods', get_recommend_goods('hot')); // 热卖商品
2:在good.dwt中添加:
<!--调用猜你喜欢开始-->
<!-- TemplateBeginEditable name="为您推荐(调用热卖)" -->
<!-- #BeginLibraryItem "/library/recommend_hot.lbi" -->
<!-- {if $hot_goods} -->
<!--{if $script_name eq 'index'}-->
<div class="xm-plain-box">
<div class="box-hd">
<h2 class="title">
猜你喜欢
</h2>
<div class="more">
<div class="xm-controls xm-controls-line-small xm-carousel-controls">
<a class="control control-prev iconfont" href="javascript: void(0);"></a>
<a class="control control-next iconfont" href="javascript: void(0);"></a>
</div>
</div>
</div>
<div class="box-bd">
<div class="xm-carousel-wrapper J_carouselWrap">
<ul class="xm-carousel-list xm-carousel-col-5-list goods-list rainbow-list clearfix J_carouselList">
<!--{foreach from=$hot_goods item=goods name=hot_goods}-->
<li>
<a class="thumb" href="{$goods.url}" target="_blank">
<img src="{$goods.thumb}" />
</a>
<h3 class="title">
<a href="{$goods.url}" target="_blank">{$goods.short_style_name}</a>
</h3>
<p class="price"><!-- {if $goods.promote_price neq ""} -->{$goods.promote_price}<!-- {else}-->{$goods.shop_price}<!--{/if}--></p>
</li>
<!--{/foreach}-->
</ul>
</div>
</div>
</div>
<!--{else}-->
<div id="J_renovateWrap" class="xm-recommend-container container xm-carousel-container">
<h2 class="xm-recommend-title"><span>猜你喜欢</span></h2>
<div class="xm-recommend">
<div class="xm-carousel-wrapper">
<ul class="xm-carousel-col-5-list xm-carousel-list clearfix">
<!--{foreach from=$hot_goods item=goods name=hot_goods}-->
<li class="J_xm-recommend-list">
<dl>
<dt><a href="{$goods.url}" target="_blank"><img src="{$goods.thumb}" /></a></dt>
<dd class="xm-recommend-name"><a href="{$goods.url}" target="_blank" title="{$goods.short_style_name}">{$goods.short_style_name}</a></dd>
<dd class="xm-recommend-price"><!-- {if $goods.promote_price neq ""} -->{$goods.promote_price}<!-- {else}-->{$goods.shop_price}<!--{/if}--></dd>
<dd class="xm-recommend-tips"> </dd>
</dl>
</li>
<!--{/foreach}-->
</ul>
</div>
<div class="xm-pagers-wrapper">
<ul class="xm-pagers">
<!--{foreach from=$hot_goods item=goods name=hot_goods}-->
<!--{if $smarty.foreach.hot_goods.index mod 5 eq 0}-->
<li class="pager"><span class="dot">{ $smarty.foreach.hot_goods.iteration}</span></li>
<!-- {/if} -->
<!--{/foreach}-->
</ul>
</div>
</div>
</div>
<!-- {/if} -->
<!-- {/if} -->
<!-- #EndLibraryItem -->
<!-- TemplateEndEditable -->
<!--调用才你喜欢结束-->
第三(重点)
在admin/includes/lib_tenplate.php中
'goods' => array(
'/library/ur_here.lbi' => 0,
'/library/search_form.lbi' => 0,
'/library/promotion_info.lbi' => 0,
'/library/cart.lbi' => 0,
'/library/member.lbi' => 0,
'/library/category_tree.lbi' => 0,
'/library/goods_attrlinked.lbi' => 0,
'/library/recommend_hot.lbi' => 3,
'/library/history.lbi' => 0,
'/library/goods_fittings.lbi' => 0,
'/library/goods_gallery.lbi' => 0,
'/library/goods_tags.lbi' => 0,
'/library/comments.lbi' => 0,
'/library/bought_goods.lbi' => 5,
'/library/bought_note_guide.lbi' => 0,
'/library/goods_related.lbi' => 0,
'/library/goods_article.lbi' => 0,
'/library/relatetag.lbi' => 0,
),
默认的 goods详情页模版在添加默认的热卖库项目 默认控制条数为3