广告投放

ECSHOP首页显示并调用积分商品教程

目录

    ECSHOP商城首页如何显示积分商品?在ecshop首页显示积分商城里的商品?
    星空站长网今天讲解下ECSHOP商城首页显示积分商品,如何在首页调用积分商品ecshop开发教程,希望对大家有些帮助!

    1、首先打开index.php文件 

    在最末尾?>的前面增加:

    /*** 
    获得积分商城热门商品
      
    * 
    * @param int $limit        
    列出条数
      
    * @param int $ishot       
    是否只显示热销
      
    *@return array 
    */function index_get_exchange($limit=3,$ishot=0) 
    { 
    /* 
    获得热门积分商品列表
     */ 
    $sql_ishot=$ishot ? " AND eg.is_hot=1 " : ""; 
    $sql='SELECT g.goods_id,g.goods_name, g.goods_name_style, eg.exchange_integral,'.' g.goods_type,g.goods_brief, g.goods_thumb, g.goods_img, eg.is_hot ' . 
    ' FROM ' . $GLOBALS['ecs']->table('exchange_goods') . ' AS eg LEFT JOIN ' . 
    $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = eg.goods_id  ' . 
    ' WHERE eg.is_exchange = 1 AND g.is_delete = 0 '. $sql_ishot .'  limit '.$limit;
      
    $res = $GLOBALS['db']->getAll($sql); 
        $arr = array(); 
       foreach($res AS $idx => $row) 
        { 
    $arr[$idx]['name']              = $row['goods_name']; 
    $arr[$idx]['goods_brief']       = $row['goods_brief']; 
    $arr[$idx]['goods_style_name'] = 
    add_style($row['goods_name'],$row['goods_name_style']); 
    $arr[$idx]['exchange_integral'] = $row['exchange_integral']; 
    $arr[$idx]['type']              = $row['goods_type']; 
    $arr[$idx]['goods_thumb']       = get_image_path($row['goods_id'], 
    $row['goods_thumb'], true); 
    $arr[$idx]['goods_img']         = get_image_path($row['goods_id'], 
    $row['goods_img']); 
    $arr[$idx]['url']               = build_uri('exchange_goods', 
    array('gid'=>$row['goods_id']), $row['goods_name']); 
        } 
        return $arr; 
    }
     

    然后继续在index.php 文件中 找到

    $smarty->assign('shop_notice',$_CFG['shop_notice']);       // 商店公告

    在它下边另起一行增加如下代码

     $smarty->assign('goods_exchange_list',index_get_exchange(6,0));  //积分商城

    如果你想只显示热销的积分商品,只需将上面代码稍作修改即可

    $smarty->assign('goods_exchange_list',index_get_exchange(6,1));  //积分商城

    2、下面继续修改模板文件

    商城首页文件themes/default/index.dwt 

    在你想显示积分商城商品的地方,加入下面代码段

    <!--积分商城列表--> 
    <div class="box"> 
     <div class="box_1"> 
      <h3><span><a href="/exchange.php" class="f6">
    积分商城
    </a></span></h3> 
        <div class="centerPadd"> 
        <div class="clearfix goodsBox" style="border:none;"> 
          <!--{foreach name=goods_exchange_list from=$goods_exchange_list 
    item=exchange_goods}--> 
          <div class="goodsItem"> 
      <a href="{$exchange_goods.url}" target="_blank"><img 
    src="{$exchange_goods.goods_thumb}" alt="{$exchange_goods.goods_name}" 
    class="goodsimg" /></a><br /> 
       <p><a href="{$exchange_goods.url}" target="_blank"> 
      <!-- {if $exchange_goods.goods_style_name} --> 
      <font class="f3">{$exchange_goods.goods_style_name}</font><br /> 
      <!-- {else} --> 
      <font class="f3">{$exchange_goods.goods_name}</font><br /> 
      <!-- {/if} --> 
      </a> 
      </p> 
    {$lang.exchange_integral}<font 
    class="price">{$exchange_goods.exchange_integral}</font> 
            </div> 
          <!--{/foreach}--> 
          <div class="more"><a href="/exchange.php"><img src="images/more.gif" 
    /></a></div> 
        </div> 
        </div> 
     </div> 
    </div> 
    <div class="blank5"></div>

    3.css外观自己写下,这样就大功告成了!

    声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

    给TA打赏
    共{{data.count}}人
    人已打赏
    广告位招租919838898
    0 条回复 A文章作者 M管理员
      暂无讨论,说说你的看法吧
    个人中心
    购物车
    优惠劵
    今日签到
    有新私信 私信列表
    搜索