Home >Backend Development >PHP Tutorial >ECSHOP: Display sub-category products on the homepage, and switch category products by clicking on the Tab page_PHP tutorial

ECSHOP: Display sub-category products on the homepage, and switch category products by clicking on the Tab page_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:13:33988browse

开始:    1. 打开调试开关     文件地址:include/cls_template.php 找到 :     

 function _eval($content)
     函数体第一行增加: echo($content);    改写调试完毕后在注释掉。   2. 修改goods获取函数,以便显示子分类。    文件:include/cls_goods.php 找到函数:function assign_cat_goods, 在 $cat['id']   = $cat_id; 后增加一行:
$cat['cat_id'] = get_child_tree($cat_id);

// 调用子分类信息。

  3.修改模板 cat_goods.lbi ,显示子分类并调用子商品   c0187d15cc6f1a0d2b239b3fc7738f3a
        3bb119c58ba7e74ce3a33b235dfef6d3 
        868dcb2b0f95fafa6b1c28d480af4204class="active" 7c11b78bab7b812c6b78fbadb578b171>727d410cdb5278b0cc363fa96cfc8695{$rec_cat.name|escape:html}5db79b134e9f6b82c0b36e0489ee08edbed06894275b65c1ab86501b08a632eb
        7adaa08b17844ac234fc75b446639fde
       
      929d1f5ca49e04fdcb27f9465b944689
3957cf47da1fbc8dd802c9327074468119ead97de4955a9a589123cb9ba5d16a更多>>5db79b134e9f6b82c0b36e0489ee08ed16b28748ea4df4d9c2150843fecfba68-->
      439c212be5717219e97db6123e224296
      2b3e6739ec9062b75d34e17aff2fd858 //这里循环获取当前商品分类ID,传入获取商品信息集合
            $this ->assign('goods_cat_'.$cid, assign_cat_goods($cid, 4));
            $this->assign('cat_goods_nf',$this->_var['cat_goods_'.$cid]);
     ?>

        1a0e2afa41f042d108027041b948d6c5active7c11b78bab7b812c6b78fbadb578b171" id="tab{$rec_cat1.id}">
          39bbc163833ae4e036fa5108a4263823
            e13f1f1af5cb3efbcbacd0bcaa2560bb 
            50cd457036e698d176e1f9054fe17d47
              1adb1093646f2b3555a7eb390c8a2671 3dccb34e7c2ff4862369649c7efaf83547ed7b3e610b0b0ac50d6d7467eab6695db79b134e9f6b82c0b36e0489ee08ed
                de7d80c54364b1dca47f257f45f18515{$goods.short_name|escape:html}df250b2156c434f3390392d09b1c9563
                市场价:41322dc2fbdf538f1ea20bb0dcb68ceb
        ef5dc968b76d5ea7ce8b8602c8c59a967a503c6fb6093f785115cd33dd29873e{$goods_cat.name|escape:html}5db79b134e9f6b82c0b36e0489ee08edbed06894275b65c1ab86501b08a632eb
      929d1f5ca49e04fdcb27f9465b944689
      23180cee6f11f60fe6d6bfd48dce572a19ead97de4955a9a589123cb9ba5d16a更多>>5db79b134e9f6b82c0b36e0489ee08ed16b28748ea4df4d9c2150843fecfba68
      439c212be5717219e97db6123e224296
        fcb2a8c12575fd49dc08d61f088d8441
          39bbc163833ae4e036fa5108a4263823
            87cdbe938be985b691d3801c783497f8
            50cd457036e698d176e1f9054fe17d47
              1adb1093646f2b3555a7eb390c8a2671 3dccb34e7c2ff4862369649c7efaf83547ed7b3e610b0b0ac50d6d7467eab6695db79b134e9f6b82c0b36e0489ee08ed
                de7d80c54364b1dca47f257f45f18515{$goods.short_name|escape:html}df250b2156c434f3390392d09b1c9563
                  市场价: 改正如下: 1. 增加当前大分类ID是否有值的判断     增加位置:商品分类模板第一行cat_goods.lbi     代码:
<!--   {<span if</span> not <span is_null</span>(<span $goods_cat</span>.id) || <span $goods_cat</span>.id>0}   -->

2. 修改获取当前ID代码。代码如下:

      <!--   {<span foreach</span> from=<span $goods_cat</span>.cat_id item=rec_cat1 name=f1 <span key</span>=curCat}-->
<span //</span><span 这里循环获取当前商品分类ID,传入获取商品信息集合</span>
       <?<span php 
               </span><span $cid</span> = <span $this</span>->_var['curCat'];  <span //</span><span 改为这个 </span>
            <span $this</span> ->assign('goods_cat_'.<span $cid</span>, assign_cat_goods(<span $cid</span>, 4<span )); //4表示每个分类显示的商品数量,根据实际情况自己修改
            </span><span $this</span>->assign('cat_goods_nf',<span $this</span>->_var['cat_goods_'.<span $cid</span><span ]);
     </span>?>
 

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/440369.htmlTechArticle开始: 1. 打开调试开关 文件地址:include/cls_template.php 找到 : function _eval($content) 函数体第一行增加: echo($content); 改写调试完毕后在注释掉...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn