ecshop仿站参考

<SCRIPT LANGUAGE=”JavaScript”>

function killErr(){
 return true;
}
window.onerror=killErr;
</SCRIPT>
//***********************************头部栏目菜单***************************//
 <SPAN {if $navigator_list.config.index eq 1}class=”select”{/if}><A href=”/”>首页</A></SPAN> 
  <!– {foreach name=nav_middle_list from=$navigator_list.middle item=nav } –>
  <!–{if $smarty.foreach.nav_middle_list.iteration<=6}–>
  <SPAN {if $nav.active eq 1}class=”select”{/if}><a href=”{$nav.url}” {if $nav.opennew eq 1}target=”_blank” {/if} >{$nav.name}</a></SPAN>
  <!– {if !$smarty.foreach.nav_middle_list.last} –><!– {/if} –>
  <!– {/if} –>
  <!– {/foreach} –>
 
  //************************首页多级树形菜单*******************************************//

//顶级栏目    <!–{foreach from=get_categories_tree(0) item=cat name=cat0}–>
                  {$smarty.foreach.cat0.iteration}  {$cat.url}  {$cat.name|escape:html}
//一级栏目           <!–{foreach from=$cat.cat_id item=child}–>
                           {$child.url}{$child.name|escape:html}
//二级栏目                  <!–{foreach from=$child.cat_id item=childer}–>
                                {$childer.url}{$childer.name|escape:html}
                            <!–{/foreach}–>
                    <!–{/foreach}–>
//推荐品牌          <!–{foreach from=get_brands1($GLOBALS[‘smarty’]->_var[‘cat’][‘id’]) item=bchilder}–>
                         {$bchilder.url}”>{$bchilder.brand_name|escape:html}
                    <!–{/foreach}–>
//促销活动          <!– {foreach from=$promotion_info1 item=item1 key=key} –>
                        <!– {if $item1.type eq “snatch”} –>
                                <a href=”snatch.php” title=”{$lang.$item1.type}”>{$lang.snatch_promotion}</a>
                        <!– {elseif $item1.type eq “group_buy”} –>
                                <a href=”group_buy.php” title=”{$lang.$item1.type}”>{$lang.group_promotion}</a>
                        <!– {elseif $item1.type eq “auction”} –>
                                <a href=”auction.php” title=”{$lang.$item1.type}”>{$lang.auction_promotion}</a>
                        <!– {elseif $item1.type eq “favourable”} –>
                                <a href=”activity.php” title=”{$lang.$item1.type}”>{$lang.favourable_promotion}</a>
                        <!– {elseif $item1.type eq “package”} –>
                                <a href=”package.php” title=”{$lang.$item1.type}”>{$lang.package_promotion}</a>
                         <!– {/if} –>
                        {$item1.url} {$item1.act_name} {$item1.time} {$item1.act_name}
                     <!– {/foreach} –> 
//顶级栏目结束<!–{/foreach}–>

 
//*******************************列表页变化多级树形菜单***************************************//
//顶级栏目循环 <!–{foreach from=get_categories_tree() item=cat}–>
//顶级栏目判断        <!–{if $current_cat_pr_id eq $cat.id}–>
                 {$cat.url}{$cat.name|escape:html}
//一级栏目循环                     <!–{foreach from=$cat.cat_id item=child}–>
                                               {$child.url}
//一级栏目样式切换                        <!–{if $current_cat_id eq $child.id}–> <!–{else}–><!–{/if}–>
                                               {$child.name|escape:html}
//一级栏目判断展开                     <!–{if $child.cat_id and $current_cat_t_id eq $child.id}–>
//二级栏目循环                                    <!–{foreach from=$child.cat_id item=childer}–>
                                                        {$childer.url}
 //二级栏目样式切换                                     <!–{if $current_cat_id eq $childer.id}–><!–{else}–><!–{/if}–>                                                        {$childer.name|escape:html}
                                           <!–{/foreach}–>
                                     <!–{/if}–>
                         <!–{/foreach}–>
                          <!–{/if}–>
                       <!–{if $current_cat_pr_id eq ”}–>
                  {$cat.url}{$cat.name|escape:html}
                          <!–{/if}–>
            <!–{/foreach}–>
              
注释:             
此段代码位于category.php中 “$smarty->assign(‘ur_here’,          $position[‘ur_here’]);  “// 当前位置下;
 //LSJ Begin
 $smarty->assign(‘current_cat_id’, $cat_id); //取得当前的id
 /*取得顶级ID*/
 $catlist = array();
 foreach(get_parent_cats($cat_id) as $k=>$v)
 {
  $catlist[] = $v[‘cat_id’];
 }
 $smarty->assign(‘current_cat_pr_id’,$catlist[count($catlist)-1]);/*取得顶级ID*/
 if (count($catlist)>=2){
 $smarty->assign(‘current_cat_t_id’,$catlist[count($catlist)-2]);/**/
 }
//LSJ End

 

//*******************************首页搜索参考*********************************//
搜索关键词
{if $searchkeywords}
   {foreach from=$searchkeywords item=val}
   <a href=”search.php?keywords={$val|escape:url}”>{$val}</a>
   {/foreach}
{/if}
//*****************************购物车参考*****************************//
{insert_scripts files=’transport.js’}
<div id=”ECS_CARTINFO”>
 {insert name=’cart_info’}
</div></div>
//************************************产品排列参考******************************//
(函数虚参考函数页)
$smarty->assign(‘top_goods_haoyue2′,    get_top10(1));           // 销售排行
$smarty->assign(‘click_goods_haoyue2′,   click_goods(1,11));           // 点击数排
$smarty->assign(‘haoyue_goods2′,  assign_cat_goods(1,10,’wap’));           // 商品输出
$smarty->assign(‘haoyue_tree2′,   get_child_tree(1));           // 栏目输出
   

//栏目输出      <!–{foreach from=$haoyue_tree2 item=tree name=tree}–>
//样式判断          {if $smarty.foreach.tree.first}{/if}>
                    {$tree.url}{$tree.name}
                <!–{/foreach}–>
           
//销售排行判断  <!– {if $top_goods_haoyue2} –>
//销售排行    <!–{foreach from=$top_goods_haoyue2 item=goods name=goods}–>
//样式判断         {if $smarty.foreach.goods.iteration eq 1}{/if}
                       {$smarty.foreach.goods.iteration}  {$goods.name|escape:html} 
                       {$goods.url}  {$goods.thumb}{$goods.short_name} {$goods.price}
           <!–{/foreach}–>
        <!–{/if}–>
             
//销售点击判断  <!– {if $click_goods_haoyue2} –>
//销售排行      <!–{foreach from=$click_goods_haoyue2 item=goods name=goods}–>
//样式判断         {if $smarty.foreach.goods.iteration eq 1}{/if}
                       {$smarty.foreach.goods.iteration} {$goods.name|escape:html}
                       {$goods.url} {$goods.thumb} {$goods.short_name} {$goods.shop_price}
              <!–{/foreach}–>
          <!–{/if}–>
               
//商品输出    <!–{foreach from=$haoyue_goods2.goods item=goods name=goods}–>
                {$goods.name|escape:html} {$goods.url}{$goods.goods_img}
                      {$goods.shop_price} {$goods.short_name} {$goods.goods_sn}
             <!–{/foreach}–>
//*******************************最新文章参考**********************************//

<!–{foreach from=$new_articles item=article name=new_articles}–>
     <!–{if $smarty.foreach.new_articles.iteration <=4}–>
            {$article.title|escape:html}{$article.url}{$article.short_title|truncate:12}
     <!–{/if}–>
<!–{/foreach}–>

//**************************************后台包含参考*****************************//
//简单包含
<!– #BeginLibraryItem “/library/page_footer.lbi” –><!– #EndLibraryItem –>
//广告包含
<!– TemplateBeginEditable name=”广告” –>
<!– #BeginLibraryItem “/library/ad_position.lbi” –>
{insert name=’ads’ id=$ads_id num=$ads_num}
<div></div>
<!– #EndLibraryItem –>
<!– TemplateEndEditable –>
//产品包含
<!– TemplateBeginEditable name=”商品区” –>
  <!– #BeginLibraryItem “/library/cat_goods.lbi” –>
     <!–{foreach from=$cat_goods item=goods}–>
         {$goods.thumb}  {$goods.url}  {$goods.name|escape:html}
   {$goods.short_name|escape:html} {$goods.goods_sn}{$goods.shop_price}
     <!–{/foreach}–>
  <!– #EndLibraryItem –>
<!– TemplateEndEditable –>
//文章包含
<!– TemplateBeginEditable name=”技术文献” –>
  <!– #BeginLibraryItem “/library/cat_articles.lbi” –>
      <!–{foreach from=$articles item=article_item}–>
          {$article_item.url} {$article_item.title|escape:html} {$article_item.short_title|truncate:14}
      <!–{/foreach}–>
  <!– #EndLibraryItem –>
<!– TemplateEndEditable –>
//**********************商品列表页参考*********************************//
//组合搜索
 <!–{if $brands.1 || $price_grade.1 || $filter_attr_list}–>
    <!–{if $brands.1}–>
            <!–{foreach from=$brands item=brand}–>
     <!– {if $brand.selected} –>{$brand.brand_name}<!– {else} –>{$brand.url} {$brand.brand_name}<!– {/if} –>
    <!–{/foreach}–>
   
 <!–{/if}–>
 <!–{if $price_grade.1}–>
            <!–{foreach from=$price_grade item=grade}–>
    <!– {if $grade.selected} –>{$grade.price_range}<!– {else} –>{$grade.url}{$grade.price_range}<!– {/if} –>
   <!–{/foreach}–>
     <!–{/if}–>
           
  <!–{foreach from=$filter_attr_list item=filter_attr}–>
         {$filter_attr.filter_attr_name|escape:html}:</strong>
   <!–{foreach from=$filter_attr.attr_list item=attr}–>
    <!– {if $attr.selected} –>{$attr.attr_value}<!– {else} –>{$attr.url}{$attr.attr_value}<!– {/if} –>
   <!–{/foreach}–>
      <!–{/foreach}–>
<!– {/if} –>

 //列表页商品排列
  <!–{foreach name=goods_list from=$goods_list item=goods}–>
   <!– {if $goods.goods_id} –>
           {$goods.url}  {$goods.goods_name} {$goods.brand_name} {$goods.goods_sn}  {$goods.goods_thumb}
            <!– {if $goods.goods_brief} –>{$goods.goods_brief}<!– {/if} –>{$goods.shop_price}
   <!–{else}–>
  
   <!–{/if}–>
 <!–{/foreach}–>
    
  
 //商品分类列表逻辑判断
     <!–{if $category lt 618 and $category gt 572 or ($category lt 631 and $category gt 626)}–>
           <!– #BeginLibraryItem “/library/category_tree_exchange.lbi” –><!– #EndLibraryItem –>
     <!–{else}–>
          <!– #BeginLibraryItem “/library/category_tree.lbi” –><!– #EndLibraryItem –>
     <!–{/if}–>
    
    
 //翻页效果参考  
{$smarty.server.PHP_SELF}

{$pager.record_count}{$pager.page_count}{$pager.page_first}”>{$pager.page_prev}{$pager.page_next}{$pager.page_last}
    <!–{foreach from=$pager.search key=key item=item}–>
      {if $key eq ‘keywords’}
          <input type=”hidden” name=”{$key}” value=”{$item|escape:decode_url}” />
        {else}
          <input type=”hidden” name=”{$key}” value=”{$item}” />
      {/if}
    <!–{/foreach}–>
    <select name=”page” id=”page” onchange=”selectPage(this)”>
    {html_options options=$pager.array selected=$pager.page}
    </select>
</div>

 

//*******************************产品详情页参考*************************************//  
    
//产品图片:            {$goods.goods_img}  {$goods.goods_name|escape:html}

//商品详情:            {$goods.goods_desc}

//显示商品品牌:      <!– {if $goods.goods_brand neq “” and $cfg.show_brand} –>
                       {$goods.goods_brand_url}{$goods.goods_brand}
                      <!–{/if}–>
      
//点击数               {$goods.click_count}
      
//市场价格           <!– {if $cfg.show_marketprice} –> {$goods.market_price}  <!– {/if} –>
      
//本店售价             {$goods.shop_price_formated}
      
//显示商品货号       <!– {if $cfg.show_goodssn} 显示商品货号–>  {$goods.goods_sn} <!– {/if} –>

 

//循环所有可选属性 
      <!– {foreach from=$specification item=spec key=spec_key} –>
      <li>
      <strong>{$spec.name}:</strong><br />
        <!– {* 判断属性是复选还是单选 *} –>
                    <!– {if $spec.attr_type eq 1} –>
                      <!– {if $cfg.goodsattr_style eq 1} –>
                        <!– {foreach from=$spec.values item=value key=key} –>
                        <label for=”spec_value_{$value.id}”>
                        <input type=”radio” name=”spec_{$spec_key}” value=”{$value.id}” id=”spec_value_{$value.id}” {if $key eq 0}checked{/if} onclick=”changePrice()” />
                        {$value.label} [{if $value.price gt 0}{$lang.plus}{elseif $value.price lt 0}{$lang.minus}{/if} {$value.format_price|abs}] </label><br />
                        <!– {/foreach} –>
                        <input type=”hidden” name=”spec_list” value=”{$key}” />
                        <!– {else} –>
                        <select name=”spec_{$spec_key}” onchange=”changePrice()”>
                          <!– {foreach from=$spec.values item=value key=key} –>
                          <option label=”{$value.label}” value=”{$value.id}”>{$value.label} {if $value.price gt 0}{$lang.plus}{elseif $value.price lt 0}{$lang.minus}{/if}{if $value.price neq 0}{$value.format_price}{/if}</option>
                          <!– {/foreach} –>
                        </select>
                        <input type=”hidden” name=”spec_list” value=”{$key}” />
                      <!– {/if} –>
                    <!– {else} –>
                      <!– {foreach from=$spec.values item=value key=key} –>
                      <label for=”spec_value_{$value.id}”>
                      <input type=”checkbox” name=”spec_{$spec_key}” value=”{$value.id}” id=”spec_value_{$value.id}” onclick=”changePrice()” />
                      {$value.label} [{if $value.price gt 0}{$lang.plus}{elseif $value.price lt 0}{$lang.minus}{/if} {$value.format_price|abs}] </label><br />
                      <!– {/foreach} –>
                      <input type=”hidden” name=”spec_list” value=”{$key}” />
                    <!– {/if} –>
      </li>
      <!– {/foreach} –>
      <!– {* 结束循环可选属性 *} –>
     
 //购物车收藏推荐    
       <a href=”javascript:addToCart({$goods.goods_id})”><img src=”images/bnt_cat.gif” /></a>
       <a href=”javascript:collect({$goods.goods_id})”><img src=”images/bnt_colles.gif” /></a>
      <!– {if $affiliate.on} –>
      <a href=”user.php?act=affiliate&goodsid={$goods.goods_id}”><img src=’images/bnt_recommend.gif’></a>
      <!– {/if} –>
    
//购物车需要函数
 
    <script type=”text/javascript”>
   //<![CDATA[
   var process_request = “{$lang.process_request}”;
   //]]>
   </script>
     

     
     
//商品属性  <!– {foreach from=$properties item=property_group key=key} –>
                 {$key|escape}
                 <!– {foreach from=$property_group item=property} –>
                      {$property.name|escape:html}  {$property.value}
                 <!– {/foreach}–>
            <!– {/foreach}–>

//关联商品
   <!–{foreach from=$related_goods item=related}–>
          {$related.url}{$related.goods_thumb}{$related.goods_name}{$related.goods_sn}{$related.shop_price}
   <!–{/foreach}–>   
       
       
//属性关联商品
<!– #BeginLibraryItem “/library/goods_attrlinked.lbi” –>
<!–{foreach from=$attribute_linked item=linked}–>
<!– {if $linked.goods} –>
     {$linked.title}{$linked.title|truncate:11:”…”:true}
      <!– {foreach from=$linked.goods item=linked_goods_data} –>
        {$linked_goods_data.url}  {$linked_goods_data.goods_thumb}    {$linked_goods_data.name|escape:html}
        {$goods.linked_goods_data_name|escape:html}   {$linked_goods_data.short_name|escape:html}
        {$linked_goods_data.shop_price}
      <!– {/foreach} –>
<!– {/if} –>
<!– {/foreach}–>
<!– #EndLibraryItem –>   
    
    
//*********************************************************底部导航参考*************************************************//

//友情链接

<!–{if $img_links  or $txt_links }–>

//图片类型 <!–{foreach from=$img_links item=link}–>
                                {$link.url}{$link.name}{$link.logo}
                            <!–{/foreach}–>
                             <!– {if $txt_links} –>
//文字类型  <!–{foreach from=$txt_links item=link}–>
                                {$link.url}{$link.name}{$link.name}
                            <!–{/foreach}–>
                             <!– {/if} –>
<!–{/if}–>

 

//底部导航     <!– {if $navigator_list.bottom} –>
                    <!– {foreach name=nav_bottom_list from=$navigator_list.bottom item=nav} –>
                       {$nav.url}
//样式判断             <!– {if $nav.opennew eq 1} –> <!– {/if} –>
                       {$nav.name}
                       <!– {if !$smarty.foreach.nav_bottom_list.last} –>
                        –
                       <!– {/if} –>
                     <!– {/foreach} –>
              <!– {/if} –>      
       
 //*******************商品比较************************************************//
 起作用的是/js/compare.js
 同时需要调用一下样式
 /* ======商品比较浮动块 ====== */
#compareBox {
 width:128px;
 background:url(images/compareBg.gif) no-repeat top center;
 background-color:#edf8ff;
 padding:35px 0 8px 0;
 border: 1px solid #c5e4ff;
 position: absolute;
 right:1px;
 top:200px;
}

#compareBox input {
    width:52px; height:13px;
    border:none;
    background:url(images/compareSub.gif) no-repeat;
}

#compareList {
 margin:0px 0px 8px 0px;
 padding:0px;
 width:120px;
 background:#FFFFFF;
 border:1px solid #d6ecff;
}

#compareList li {
 color: #333;
 text-align:left;
 background: #fff;
 padding: 3px 5px;
 margin: 3px 0;
}

#compareList li img {
 float:right;
 padding-top:4px;
}     
 
 
//**************************全站改固定值***********************************//
打开 includes/lib_common.php
将return sprintf($GLOBALS[‘_CFG’][‘currency_format’], $price);
替换为
if (intval($price) == 0) {  return “您想写的话”;} else {  return sprintf($GLOBALS[‘_CFG’][‘currency_format’], $price); }

此条目发表在ecshop参考分类目录,贴了标签。将固定链接加入收藏夹。

发表评论

邮箱地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>