模板API说明


1、商城首页
URL样例:/index.html
对应模板:/user_case/default/index.html

接口 $ {newsMgr.getNewsByTopicByCount("商城快讯",10)}
作用 获得某个栏目下的新闻
参数
"商城快讯" 新闻栏目  
10 数量  
应用示例

#foreach ( $news in $ {newsMgr.getNewsByTopicByCount("商城快讯",10)} )
<li>
<a href="news/detail-$ {news.getString("nid")}.html" title="$ {news.getString("ntitle")}">$ {StringUtil.cutString($ {news.getString("ntitle")},11,"...")}</a>
</li>
#end


接口 $ {productMgr.getDetailAdvByFlag(7)}
作用 通过flag值获得站内广告
参数
7 flag  
应用示例

#set ($adv = $ {productMgr.getDetailAdvByFlag(7)})
#if ( $ {adv.get("used",0)}==1 )
addInfo("$ {productMgr.getDetailAdvByFlag(7).getString("title")}","$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {productMgr.getDetailAdvByFlag(7).getString("path")}","$ {productMgr.getDetailAdvByFlag(7).getString("link")}");
#end


接口 $ {productMgr.getNewProductByPgTitleByCount("本周热卖",2)}
作用 获得某个商品群组下的商品
参数
"本周热卖" 商品群组名字  
2 商品数量  
应用示例

#foreach ( $hotweeksell in $ {productMgr.getNewProductByPgTitleByCount("本周热卖",2)} )
<div class="richItem">
<div class="itemPic"><a href="product/detail-$ {hotweeksell.getString("pid")}.html"><img src="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {hotweeksell.getString("img_s")}" alt="$ {hotweeksell.getString("name")}" width="60" height="60" border="0" /></a></div>
<div class="itemInfo">
<div class="title">$ {hotweeksell.getString("name")}</div>
<div class="price">$ {productMgr.getProductPriceStr($hotweeksell)}</div>
<div class="moreLink"><img src="imgs/arrow2.png" width="10" height="14" align="absmiddle" /><a href="catalog/list-s-$ {hotweeksell.getString("cparentid")}-$ {hotweeksell.getString("cid")}.html" target="_blank">$ {hotweeksell.getString("ctitle")}</a></div>
</div>
</div>

#end


接口 $ {catalogMgr.getCatalogByParentIdByCount($ {StringUtil.getLongType()},9)}
作用 获得所有子货架
参数
$ {StringUtil.getLongType()} 父货架ID  
9 数量  
应用示例

#foreach ( $mainCatalog in $ {catalogMgr.getCatalogByParentIdByCount($ {StringUtil.getLongType()},9)} )
<div class="catelogName"><a href="catalog/list-p-0-$ {mainCatalog.getString("id")}.html">$ {mainCatalog.getString("title")}</a></div>
<div class="catelogContent">
#foreach ( $catalog in $ {catalogMgr.getCatalogByParentIdByCount($ {mainCatalog.get("id",$ {StringUtil.getLongType()})},6)} )
<a href='catalog/list-s-$ {catalog.getString("parentid")}-$ {catalog.getString("id")}.html'>
$ {catalog.getString("title")}</a>
#end
</div>
#end


接口 $ {productMgr.getHotSellProductByCount(10)}
作用 获得热卖商品
参数
10 商品数量  
应用示例

#foreach ( $hotsellPro in $ {productMgr.getHotSellProductByCount(10)} )

<div class="richItem">
<div class="itemPic" style="overflow:hidden;height:60px;">
<a href="product/detail-$ {hotsellPro.getString("pid")}.html"><img src="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {hotsellPro.getString("img_s")}" alt="$ {hotsellPro.getString("name")}" width="60" border="0"></a></div>
<div class="itemInfo">
<div class="title" style="width:110px;height:46px;overflow:hidden"><a href="product/detail-$ {hotsellPro.getString("pid")}.html">$ {hotsellPro.getString("name")}</a></div>
<div class="price">$ {productMgr.getProductPriceStr($hotsellPro)}</div>
</div>
</div>

#end


接口 $ {productMgr.getHotClickProductByCount(10)}
作用 获人气商品
参数
10 商品数量  
应用示例

#foreach ( $hotsellPro in $ {productMgr.getHotClickProductByCount(10)} )

<div class="richItem">
<div class="itemPic" style="overflow:hidden;height:60px;"><a href="product/detail-$ {hotsellPro.getString("pid")}.html"><img src="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {hotsellPro.getString("img_s")}" alt="$ {hotsellPro.getString("name")}" width="60" border="0"></a></div>
<div class="itemInfo">
<div class="title" style="width:110px;height:46px;overflow:hidden"><a href="product/detail-$ {hotsellPro.getString("pid")}.html">$ {hotsellPro.getString("name")}</a></div>
<div class="price">$ {productMgr.getProductPriceStr($hotsellPro)}</div>
</div>
</div>

#end


接口 $ {memberMgr.getFriendLinkByType(0,null)}
作用 获得友情链接
参数
0 友情链接类型  
null 翻页参数 null表示所有
应用示例

#foreach ( $friendLink in $ {memberMgr.getFriendLinkByType(0,null)} )

<a target="_blank" href="$ {friendLink.getString("link")}"><img src="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {friendLink.getString("img")}" border="0"></a>
<br><br>

#end




2、详细商品信息页面
URL样例:/product/detail-20344.html
对应模板:/user_case/default/product/detail.html

接口 $ {productMgr.getRelationProduct($pid,$ {detailPro.getString("keywords")},8)}
作用 获得某个商品的相关商品
参数
$pid 商品ID 当前浏览商品ID
$ {detailPro.getString("keywords")} 关键字串 当前浏览商品关键字串,形式:关键字1,关键字2,关键字3
8 数量 获得多少个相关商品
应用示例 #set ($orgRelationRows = $ {productMgr.getRelationProduct($pid,$ {detailPro.getString("keywords")},8)})

#foreach ( $relaProductRows in $orgRelationRows )
<li>
<ul class="item">
<li class="itemPic"><a href="detail-$ {relaProductRows.getString("pid")}.html"><img src="$ {systenFolder}.$ {upload_pro_img}$ {relaProductRows.getString("img_s")}" width="70" height="70" /></a></li>
<li class="itemName" style="height:50px;overflow:hidden;"><a href="detail-$ {relaProductRows.getString("pid")}.html">$ {relaProductRows.getString("name")}</a>
#if($ {productMgr.relationDiscountTag($relaProductRows)}!="")
<span style="color:#FF0000">($ {productMgr.relationDiscountTag($relaProductRows)}折)</span>
#end </li>
<li class="rate star$ {relaProductRows.getString("star_avg")}">&nbsp;</li>
<li class="price">
$ {productMgr.getProductPriceStr($relaProductRows)}</li>
</ul>
</li>

#end


接口 $ {productMgr.getPacketsByPid($pid,null)}
作用 获得某个商品所有捆绑促销组合
参数
$pid 商品ID 当前浏览商品ID
null 翻页参数 null表示获得所有捆绑商品
应用示例 #foreach ( $packetProM in $ {productMgr.getPacketsByPid($pid,null)} )

<div title="$ {packetPro.getString("name")}">
<b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>
<div class="xboxcontent">
<table width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">
<div style="width:150px;float:left">
#foreach ( $packetPro in $ {productMgr.getAllProductsByPpid($ {packetProM.get("ppid",$ {StringUtil.getLongType()})})} )
<a href="detail-packet-$ {packetProM.getString("ppid")}.html"><img src="$ {systenFolder}.$ {upload_pro_img}$ {packetPro.getString("img_s")}" width="50" height="50" align="absmiddle" /></a>&nbsp;&nbsp;
#if ( $ {velocityCount}%2==0 )
<a href="detail-packet-$ {packetProM.getString("ppid")}.html"><img src="../imgs/+.png" width="12" height="12" vspace="10"/></a>&nbsp;&nbsp;#end
#end</div>
<div style="width:60px;padding-top:10px; float:left;r">
<a href="detail-packet-$ {packetProM.getString("ppid")}.html">只需<span class="price1">¥$ {packetProM.getString("pprice")}</span></div></a></td> </tr>
</table>
</div>
</div>


<b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b><br />
</div>
#end


接口 $ {productMgr.getAllProductsByPpid($ {packetProM.get("ppid",$ {StringUtil.getLongType()})})}
作用 获得捆绑促销组合里面的商品
参数
$ {packetProM.get("ppid",$ {StringUtil.getLongType()})} 捆绑组合ID  
应用示例 #foreach ( $packetPro in $ {productMgr.getAllProductsByPpid($ {packetProM.get("ppid",$ {StringUtil.getLongType()})})} )
<a href="detail-packet-$ {packetProM.getString("ppid")}.html"><img src="$ {systenFolder}.$ {upload_pro_img}$ {packetPro.getString("img_s")}" width="50" height="50" align="absmiddle" /></a>&nbsp;&nbsp;
#if ( $ {velocityCount}%2==0 )
<a href="detail-packet-$ {packetProM.getString("ppid")}.html"><img src="../imgs/+.png" width="12" height="12" vspace="10"/></a>&nbsp;&nbsp;#end
#end


接口 $ {catalogMgr.getCatalogByParentId($ {detailPro.get("parentid",$ {StringUtil.getLongType()})},null)}
作用 获得当前商品所属货架同级货架
参数
$ {detailPro.get("parentid",$ {StringUtil.getLongType()})} 货架父ID  
null 翻页参数 null表示获得所有货架
应用示例 #foreach ( $mainCatalog in $ {catalogMgr.getCatalogByParentId($ {detailPro.get("parentid",$ {StringUtil.getLongType()})},null)} )
<li><a href="../catalog/list-s-$ {mainCatalog.getString("parentid")}-$ {mainCatalog.getString("id")}.html">$ {mainCatalog.getString("title")}</a></li>
#end


接口 $ {productMgr.getProductNewsByPid($pid)}
作用 获得当前商品相关新闻
参数
$pid 商品ID  
应用示例 #foreach ( $news in $ {productMgr.getProductNewsByPid($pid)} )
<li><a href="../news/detail-$ {news.getString("nid")}.html" target="_blank" title="$ {news.getString("title")}">
$ {StringUtil.cutString($ {news.getString("title")}, 14, "...")}
</a></li>
#end


接口 $ {productMgr.getCatalogCommendProductsByCid($ {detailPro.get("cid",$ {StringUtil.getLongType()})},5)}
作用 获得当前商品所属货架推荐商品
参数
$ {detailPro.get("cid",$ {StringUtil.getLongType()})} 货架ID  
5 获得商品数量  
应用示例 #foreach ( $recommand in $ {productMgr.getCatalogCommendProductsByCid($ {detailPro.get("cid",$ {StringUtil.getLongType()})},5)} )
<div class="richItem">
<div class="itemPic" style="overflow:hidden;height:60px;"><a href="detail-$ {recommand.getString("pid")}.html"><img src="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {recommand.getString("img_s")}" alt="$ {recommand.getString("name")}" width="60" border="0"></a></div>
<div class="itemInfo">
<div class="title" style="width:100px;height:30px;overflow:hidden;"><a href="detail-$ {recommand.getString("pid")}.html">$ {recommand.getString("name")}</a></div>
<div class="price">$ {productMgr.getProductPriceStr($recommand)}</div>
</div>
</div>

#end


接口 $ {productMgr.getProductsByBidByCount($pid,$ {detailPro.get("brand_id",$ {StringUtil.getLongType()})},8)}
作用 获得某个品牌下的商品
参数
$pid 商品ID  
$ {detailPro.get("brand_id",$ {StringUtil.getLongType()})} 品牌ID  
8 获得商品数量  
应用示例 #foreach ( $otherBrandPro in $ {productMgr.getProductsByBidByCount($pid,$ {detailPro.get("brand_id",$ {StringUtil.getLongType()})},8)} )
<li>
<ul class="item">
<li class="itemPic"><a href="detail-$ {otherBrandPro.getString("pid")}.html"><img src="$ {systenFolder}.$ {upload_pro_img}$ {otherBrandPro.getString("img_s")}" width="70" height="70" /></a></li>
<li class="itemName" style="height:50px;overflow:hidden;"><a href="detail-$ {otherBrandPro.getString("pid")}.html">$ {otherBrandPro.getString("name")}</a></li>
<li class="rate star$ {otherBrandPro.getString("star_avg")}">&nbsp;</li>
<li class="price">
$ {productMgr.getProductPriceStr($otherBrandPro)}</li>
</ul>
</li>
#end




3、主货架列表
URL样例:/catalog/list-p-0-10286.html
对应模板:/user_case/default/catalog/list_p.html

接口 $ {productMgr.getNewProductByCidByCount($ {catalog.get("id",$ {StringUtil.getLongType()})},4)}
作用 获得某个货架下的商品
参数
$ {catalog.get("id",$ {StringUtil.getLongType()})} 货架ID  
4 商品数量  
应用示例

#foreach ( $product in $ {productMgr.getNewProductByCidByCount($ {catalog.get("id",$ {StringUtil.getLongType()})},4)} )
<li>
<ul class="item">
<li class="itemPic"><a href="../product/detail-$ {product.getString("pid")}.html"><img src="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {product.getString("img_s")}" width="80" height="80" alt="$ {product.getString("name")}" onmouseover="showImage(this)" onmouseout="hidePreview(event)" longdesc="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {product.getString("img_b")}"/></a></li>
<li class="itemName"><a href="../product/detail-$ {product.getString("pid")}.html">$ {product.getString("name")}</a></li>
<li class="rateNoLabel star$ {product.get("star_avg",0)}">&nbsp;</li>
<li class="price">$ {productMgr.getProductPriceStr($product)}</li>
</ul>
</li>
#end




4、子货架列表
URL样例:/catalog/list-s-10286-10287.html
对应模板:/user_case/default/catalog/list_p.html

接口 $ {productMgr.getNewProductByCid($price_st,$price_en,$cid,$type,$pc)}
作用 获得某个货架下的商品
参数
$price_st 起点价格  
$price_en 终点价格  
$cid 货架ID  
$type 排序类型  
$pc 翻页参数  
应用示例 #foreach ( $newPro in $ {productMgr.getNewProductByCid($price_st,$price_en,$cid,$type,$pc)} )
#set ( $isOnDiscount = $ {productMgr.isOnDiscount($ {newPro.get("discount",$ {StringUtil.getDoubleType()})},$ {newPro.getString("discount_st")},$ {newPro.getString("discount_en")})})
<li>
<ul class="item">
<li class="itemPic"><a href="../product/detail-$ {newPro.getString("pid")}.html"><img src="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {newPro.getString("img_s")}" width="90" height="90" hspace="5" vspace="5" onmouseover="showImage(this)" onmouseout="hidePreview(event)" longdesc="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {newPro.getString("img_b")}"/></a></li>
<li class="itemName" style="overflow:hidden;width:100px;height:32px;margin-top:5px;">
<a href="../product/detail-$ {newPro.getString("pid")}.html"> $ {newPro.getString("name")}</a>
</li>
<li class="rate star$ {newPro.get("star_avg",0)}">&nbsp;</li>
<li class="price" style="margin-bottom:15px;">$ {productMgr.getProductPriceStr($newPro)}
#if($isOnDiscount=="true")<img src='../imgs/discount.gif' alt='正在打折' align='absmiddle'>#end
#if( $ {newPro.get("flag_packet",0)}==1)&nbsp;<img src='../imgs/packet_p.gif' alt='正在捆绑促销' align='absmiddle'>#end
</li><div id="cls"></div>
</ul>
</li>
#end



5、捆绑促销
URL样例:/product/packet.html
对应模板:/user_case/default/product/packet.html

接口 $ {productMgr.getAlivePackets($pc)}
作用 获得捆绑促销
参数
$pc 翻页参数  
应用示例

#foreach ( $packets in $ {productMgr.getAlivePackets($pc)} )
#set ($save = $ {packets.get("org_price",$ {StringUtil.getDoubleType()})}-$ {packets.get("pprice",$ {StringUtil.getDoubleType()})})
#set ($save = $ {StringUtil.formatNumber("#.00",$save)})
<div class="packet-bg">

<div class="mored"><a href="detail-packet-$ {packets.getString("ppid")}.html" target="_blank">了解详情>></a></div><div class="save">$ {save}元</div><div class="clearFloat"></div>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td style="font-size:14px;padding-left:10px;">$ {packets.getString("name")}</td>
</tr>
<tr>
<td align="center" valign="middle">
#foreach ( $products in $ {productMgr.getAllProductsByPpid($ {packets.get("ppid",$ {StringUtil.getLongType()})})} )
<div class="pic">
<a target="_blank" href="../product/detail-$ {products.getString("pid")}.html"><img src="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {products.getString("img_s")}" alt="$ {products.getString("name")}" width="75" height="75" border="0"></a></div>
#end
</td>
</tr>
<tr>
<td align="center" valign="middle">&nbsp;</td>
</tr>
<tr>
<td align="center" valign="middle"><span class="oldprice">原价:¥$ {packets.getString("org_price")}</span> &nbsp;&nbsp; 现在只需:<span class="STYLE2">¥$ {packets.getString("pprice")}</span></td>
</tr>
<tr>
<td align="center" valign="middle"><img src="../imgs/clock2.gif" width="16" height="16" align="absmiddle" /> $ {packets.getString("st")} - $ {packets.getString("en")}</td>
</tr>
</table>
</div>

#end



6、打折专区
URL样例:/product/discount.html
对应模板:/user_case/default/product/discount.html

接口 $ {productMgr.getDiscountProductByDiscount($disst,$disen,$cid,$pc)}
作用 获得打折商品
参数
$disst 起点折扣  
$disen 终点折扣  
$cid 货架ID  
$pc 翻页参数  
应用示例

#foreach ( $newPro in $newPros )
<li>
<ul class="offItem">
<li class="itemPic"><span>$ {productMgr.getDiscountStr($ {newPro.get("discount",$ {StringUtil.getDoubleType()})})}折 </span><a target="_blank" href="detail-$ {newPro.getString("pid")}.html"><img src="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {newPro.getString("img_s")}" width="90" height="90" /></a></li>
<li class="itemName" style="height:46px;overflow:hidden;"><a href="detail-$ {newPro.getString("pid")}.html">$ {newPro.getString("pname")}</a></li>
<li class="rate star$ {newPro.get("star_avg",0)}">&nbsp;</li>
<li class="category"><a href="product-brand-$ {newPro.getString("brand_id")}.html">$ {newPro.getString("bname")}</a> </li>
<li class="category"><a href="../catalog/list-s-$ {newPro.getString("cparentid")}-$ {newPro.getString("cid")}.html">$ {newPro.getString("ctitle")}</a> </li>
<li class="price" style="color:#999999"> 原价 <span class="oldPrice">
¥$ {newPro.getString("shop_price")}</span>
现价 <span class="newPrice">$ {productMgr.getProductPriceStr($newPro)}</span></li>
<li class="offTime">$ {newPro.getString("discount_st")} - $ {newPro.getString("discount_en")}</li>
</ul>
</li>
#end



7、所有品牌
URL样例:/product/brand.html
对应模板:/user_case/default/product/brand.html

接口 $ {productMgr.getBrandByParentId($ {StringUtil.getLongType()},$ {StringUtil.getNullType()})}
作用 获得品牌
参数
$ {StringUtil.getLongType()} 父ID  
$ {StringUtil.getNullType()} 翻页参数  
应用示例

#foreach ( $fbrand in $ {productMgr.getBrandByParentId($ {StringUtil.getLongType()},$ {StringUtil.getNullType()})} )
#if ($bid==0)
<div class="title">·$ {fbrand.getString("name")}</div>
<ul class="itemList">
#foreach ( $brand in $ {productMgr.getBrandByParentId($ {fbrand.get("id",$ {StringUtil.getLongType()})},$ {StringUtil.getNullType()})} )
<li style="height:140px;">
<ul >
<li class="itemPic" style="padding-top:10px;"><a target="_blank" href="product-brand-$ {brand.getString("id")}.html"><img src="$ {ConfigBean.getStringValue("systenFolder")}.$ {ConfigBean.getStringValue("upload_pro_img")}$ {brand.getString("img")}" width="100" /></a></li>
<li class="itemName"><a target="_blank" href="product-brand-$ {brand.getString("id")}.html">$ {brand.getString("name")}</a></li>
<div id="cls" style="padding-bottom:10px;"></div>
</ul>
</li>
#end
</ul>
#end

posted on 2012-07-27 11:55  TurboShop官方博客  阅读(200)  评论(0编辑  收藏  举报

导航