如何添加ecshop模板导航弹出菜单.docx

上传人:b****5 文档编号:2933658 上传时间:2022-11-16 格式:DOCX 页数:12 大小:53.28KB
下载 相关 举报
如何添加ecshop模板导航弹出菜单.docx_第1页
第1页 / 共12页
如何添加ecshop模板导航弹出菜单.docx_第2页
第2页 / 共12页
如何添加ecshop模板导航弹出菜单.docx_第3页
第3页 / 共12页
如何添加ecshop模板导航弹出菜单.docx_第4页
第4页 / 共12页
如何添加ecshop模板导航弹出菜单.docx_第5页
第5页 / 共12页
点击查看更多>>
下载资源
资源描述

如何添加ecshop模板导航弹出菜单.docx

《如何添加ecshop模板导航弹出菜单.docx》由会员分享,可在线阅读,更多相关《如何添加ecshop模板导航弹出菜单.docx(12页珍藏版)》请在冰豆网上搜索。

如何添加ecshop模板导航弹出菜单.docx

如何添加ecshop模板导航弹出菜单

如何添加ecshop模板导航弹出菜单

ecshop开发中心在做模板时经常用到的导航弹出菜单效果,如下图,下面我来讲解下具体的安装步骤:

 

一般头部代码都写在库文件page_header.lbi中 

1.先把php代码复制到文件顶部。

  

php

functionget_subcate_byurl($url)

{

$rs=strpos($url,"category");

if($rs!

==false)

{

preg_match("/\d+/i",$url,$matches);

$cid=$matches[0];

$cat_arr=array();

$sql="select*from".$GLOBALS['ecs']->table('category')."whereparent_id=".$cid."andis_show=1ORDERBYsort_orderASC,cat_idASC";

$res=$GLOBALS['db']->getAll($sql);

foreach($resas$idx=>$row)

{

$cat_arr[$idx]['id'] =$row['cat_id'];

      $cat_arr[$idx]['name']=$row['cat_name'];

      $cat_arr[$idx]['url'] =build_uri('category',array('cid'=>$row['cat_id']),$row['cat_name']);

$cat_arr[$idx]['children']=get_clild_list($row['cat_id']);

}

 

return$cat_arr;

}

else 

{

returnfalse;

}

}

 

functionget_clild_list($pid)

{

  $sql_sub="select*from".$GLOBALS['ecs']->table('category')."whereparent_id=".$pid."andis_show=1ORDERBYsort_orderASC,cat_idASC";

 

$subres=$GLOBALS['db']->getAll($sql_sub);

if($subres)

{

foreach($subresas$sidx=>$subrow)

{

$children[$sidx]['id']=$subrow['cat_id'];

$children[$sidx]['name']=$subrow['cat_name'];

$children[$sidx]['url']=build_uri('category',array('cid'=>$subrow['cat_id']),$subrow['cat_name']);

}

}

else 

{

$children=null;

}

return$children;

}

//

functionget_brands1($url=0,$app='brand')

{

preg_match("/\d+/i",$url,$matches);

$cat=$matches[0];

$children=($cat>0)?

'AND'.get_children($cat):

'';

 

  $sql="SELECTb.brand_id,b.brand_name,b.brand_logo,b.brand_desc,COUNT(*)ASgoods_num,IF(b.brand_logo>'','1','0')AStag".

      "FROM".$GLOBALS['ecs']->table('brand')."ASb,".

        $GLOBALS['ecs']->table('goods')."ASg".

      "WHEREg.brand_id=b.brand_id$childrenANDis_show=1".

      "ANDg.is_on_sale=1ANDg.is_alone_sale=1ANDg.is_delete=0".

      "GROUPBYb.brand_idHAVINGgoods_num>0ORDERBYtagDESC,b.sort_orderASC";

  $row=$GLOBALS['db']->getAll($sql);

 

  foreach($rowAS$key=>$val)

  {

    $row[$key]['url']=build_uri($app,array('cid'=>$cat,'bid'=>$val['brand_id']),$val['brand_name']);

    $row[$key]['brand_desc']=htmlspecialchars($val['brand_desc'],ENT_QUOTES);

  }

 

  return$row;

}

//

functionget_promotion_info1($goods_id='')

{

  $snatch=array();

  $group=array();

  $auction=array();

  $package=array();

  $favourable=array();

 

  $gmtime=gmtime();

  $sql='SELECTact_id,act_name,act_type,start_time,end_timeFROM'.$GLOBALS['ecs']->table('goods_activity')."WHEREis_finished=0ANDstart_time<='$gmtime'ANDend_time>='$gmtime'";

  if(!

empty($goods_id))

  {

    $sql.="ANDgoods_id='$goods_id'";

  }

  $res=$GLOBALS['db']->getAll($sql);

  foreach($resas$data)

  {

    switch($data['act_type'])

    {

      caseGAT_SNATCH:

//夺宝奇兵

        $snatch[$data['act_id']]['act_name']=$data['act_name'];

        $snatch[$data['act_id']]['url']=build_uri('snatch',array('sid'=>$data['act_id']));

        $snatch[$data['act_id']]['time']=sprintf($GLOBALS['_LANG']['promotion_time'],local_date('Y-m-d',$data['start_time']),local_date('Y-m-d',$data['end_time']));

        $snatch[$data['act_id']]['sort']=$data['start_time'];

        $snatch[$data['act_id']]['type']='snatch';

        break;

 

      caseGAT_GROUP_BUY:

//团购

        $group[$data['act_id']]['act_name']=$data['act_name'];

        $group[$data['act_id']]['url']=build_uri('group_buy',array('gbid'=>$data['act_id']));

        $group[$data['act_id']]['time']=sprintf($GLOBALS['_LANG']['promotion_time'],local_date('Y-m-d',$data['start_time']),local_date('Y-m-d',$data['end_time']));

        $group[$data['act_id']]['sort']=$data['start_time'];

        $group[$data['act_id']]['type']='group_buy';

        break;

 

      caseGAT_AUCTION:

//拍卖

        $auction[$data['act_id']]['act_name']=$data['act_name'];

        $auction[$data['act_id']]['url']=build_uri('auction',array('auid'=>$data['act_id']));

        $auction[$data['act_id']]['time']=sprintf($GLOBALS['_LANG']['promotion_time'],local_date('Y-m-d',$data['start_time']),local_date('Y-m-d',$data['end_time']));

        $auction[$data['act_id']]['sort']=$data['start_time'];

        $auction[$data['act_id']]['type']='auction';

        break;

 

      caseGAT_PACKAGE:

//礼包

        $package[$data['act_id']]['act_name']=$data['act_name'];

        $package[$data['act_id']]['url']='package.php#'.$data['act_id'];

    

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 表格模板 > 合同协议

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1