Home > php教程 > php手册 > ECSHOP:首页实现显示子分类商品,并实现点击Tab页切换分类商品

ECSHOP:首页实现显示子分类商品,并实现点击Tab页切换分类商品

WBOY
Release: 2016-06-13 11:29:23
Original
1255 people have browsed it

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

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

// 调用子分类信息。

3.修改模板 cat_goods.lbi ,显示子分类并调用子商品




//这里循环获取当前商品分类ID,传入获取商品信息集合
$cid = $this->_var['rec_cat1']['id'];
$this ->assign('goods_cat_'.$cid, assign_cat_goods($cid, 4));
$this->assign('cat_goods_nf',$this->_var['cat_goods_'.$cid]);
?>





{$goods.name|escape:html}
{$goods.short_name|escape:html}

市场价:







{$goods.name|escape:html}
{$goods.short_name|escape:html}

市场价: 改正如下: 1. 增加当前大分类ID是否有值的判断 增加位置:商品分类模板第一行cat_goods.lbi 代码:
<!--   {<span if</span> not <span is_null</span>(<span $goods_cat</span>.id) || <span $goods_cat</span>.id>0}   -->
Copy after login

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>?>
 
Copy after login

 

Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template