轻源码

  • QingYuanMa.com
  • 全球最大的互联网技术和资源下载平台
搜索
一起源码网 门户 ECShop网店 查看主题

ECSHOP二次开发教程开发手册(一)

发布者: tuoyelong | 发布时间: 2018-9-22 14:37| 查看数: 4025| 评论数: 1|帖子模式

> :模板修改,二次开发介绍


[url=http://www.qingyuanma.com/forum-43-1.html]ECSHOP模板结构说明,一套完整ECSHOP模板文件说明手册[/url]









1:如何统计ecshop商品在订单中出现的次数

     回答:$count = $db -> getOne("select sum(goods_number) from ".$ecs->table('order_goods')." where goods_id = '$goods[goods_id]'");
   2:ecshop详细页面如何通过onclick点击事件来控制购买,特别用在批发,批发存在一个最小购买量控制.
   回答:
        

    3:如何用js去验证手机号码.
    回答:var reg =/^[1]([3][0-9]{1}|50|53|59|58|56|86|80|89|87|88|85|86|55|51|52|57)[0-9]{8}$/;
    4:ecshop中如何取得每个月的1号时间?
   回答:local_mktime(0,0,0,date("m"),0,date("Y"));使用ecshop的local_mktime函 数.  
    5:ecshop如何直接关闭窗口而不弹出提示
   回答:
    6:如何统计ecshop某商品下被审核过的评论数量。
回答:$ccount = $db -> getOne("select count(*) cc from ".$ecs->table('comment')." where id_value = '$goods_id' and comment_type = '0' and status = '1' and parent_id = '0'");
   
   7:ecshop中js如何将时间格式互转
    回答:date1 = new Date();
var b = Date.UTC(date1.getYear(),date1.getMonth()+1,date1.getDate(),0,0,0)
time1 = frm.elements['best_time'].value;

y = time1.substring(0,4);
m = time1.substring(5,7);
d = time1.substring(8,10);
var b2 = Date.UTC(y,m,d,0,0,0)
   8:如何解析ecshop flash的xml
回答:
    $str = @file_get_contents("data/flash_data.xml");
if($str){
   preg_match_all("/item_url=\"(.*?)\"/",$str,$url);
   preg_match_all("/text=\"(.*?)\"/",$str,$text);
   preg_match_all("/link=\"(.*?)\"/",$str,$link);
   $ar_flash = array();
   if(sizeof($url[1])){
    for($i=0;$iassign('ar_flash',$ar_flash);
   }
  
}
9:ecshop中如何正则提取中文
回答:preg_match("/[".chr(0xa1)."-".chr(0xff)."]+/",ecs_iconv("UTF-8","GBK",$v['brand_name']),$cn);
10:ecshop如何取得订单中所属区域
$p = $GLOBALS['db']->getOne("select region_name from ".$GLOBALS['ecs']->table('region')." where region_id = '".$re1['province']."'");
     $c = $GLOBALS['db']->getOne("select region_name from ".$GLOBALS['ecs']->table('region')." where region_id = '".$re1['city']."'");
     $d = $GLOBALS['db']->getOne("select region_name from ".$GLOBALS['ecs']->table('region')." where region_id = '".$re1['district']."'");
11:ecshop中如何分别提取中文和英文
回答:utf下面
$pregstr = "/[\x{4e00}-\x{9fa5}]+/u";
preg_match($pregstr,$v['brand_name'],$ch);      
gbk下面
$strtest = “yyg中文字符yyg”;
$pregstr = "/([".chr(0xb0)."-".chr(0xf7)."][".chr(0xa1)."-".chr(0xfe)."])+/i";
if(preg_match($pregstr,$strtest,$matchArray)){
echo $matchArray[0];
}

12:如何控制ecshop商品总价格只有ecshop会员特殊等级才能查看
回答:ecshop的goods.php
$is_spe = $GLOBALS['db'] -> getOne("select special_rank from ".$GLOBALS['ecs']->table('user_rank')." where rank_id = '".$_SESSION['user_rank']."'");
   if($is_spe){
    $res['result'] = price_format($shop_price * $number);
   }else{
    $string = "' .$GLOBALS['_LANG']['view_order']. '';
                }
            }
        }
        else
        {
            $row['handler'] = ''.$GLOBALS['_LANG']['os'][$row['order_status']] .'';
        }
        $row2 = $db -> getAll("select goods_id ,goods_sn from ".$ecs->table('order_goods')." where order_id = '".$row['order_id']."'");
        $row['shipping_status'] = ($row['shipping_status'] == SS_SHIPPED_ING) ? SS_PREPARING : $row['shipping_status'];
        $row['order_status'] = $GLOBALS['_LANG']['os'][$row['order_status']] . ',' . $GLOBALS['_LANG']['ps'][$row['pay_status']] . ',' . $GLOBALS['_LANG']['ss'][$row['shipping_status']];
        $arr[] = array('order_id'       => $row['order_id'],
                       'order_sn'       => $row['order_sn'],
                       'order_time'     => local_date($GLOBALS['_CFG']['time_format'], $row['add_time']),
                       'order_status'   => $row['order_status'],
       'consignee'   => $row['consignee'],
                       'total_fee'      => price_format($row['total_fee'], false),
        'goodslist'   => $row2,
                       'handler'        => $row['handler']);
    }
    return $arr;
}

16:如何取得ecshop会员一天内的评论条数
回答:
function get_day_count_comment($user_id = ''){

global $db;
global $ecs;
$pre = local_mktime(0,0,0,date("m"),date("d"),date("y"));
$next = local_mktime(0,0,0,date("m"),date("d")+2,date("y"));
   
$count = $db -> getOne("select count(*) from ".$ecs->table('comment')." where user_id = '$user_id' and add_time > '$pre' and add_time < '$next' ");

if($count > 5){
   return false;
}else{
   return true;
}
}

17:ecshop中js是如何验证radio选择.
回答:类似以下代码
/*
var businesstype = false;
var job_title = false;
var number_of_employees = false;

   for (i = 0; i < frm.elements.length; i ++ )
{
    if (frm.elements.name == 'businesstype' && frm.elements.checked)
    {
      businesstype = true;
    }
    if (frm.elements.name == 'job_title' && frm.elements.checked)
    {
      job_title = true;
    }
if (frm.elements.name == 'number_of_employees' && frm.elements.checked)
    {
      number_of_employees = true;
    }
if (frm.elements.name == 'number_of_employees' && frm.elements.checked)
    {
      number_of_employees = true;
    }
}
*/

最新评论

副叫兽 发表于 2022-7-11 07:33
磁力搜索软件源码

浏览过的版块

轻源码让程序更轻更快

QingYuanMa.com

工作时间 周一至周六 8:00-17:30

侵权处理

客服QQ点击咨询

关注抖音号

定期抽VIP

Copyright © 2016-2021 https://www.171739.xyz/ 滇ICP备13200218号

快速回复 返回顶部 返回列表