MetInfo米拓6.2模板开发改造和商城模块插件v4升级优化修改PHP+Mysql

2019-09-01 23:31:20 admin 0

米拓商城经过4个版本的升级,现已支持在线商城的主要功能,代码开源,支付接口丰富,响应式布局(支持电脑、手机、平板)本次升级主要新增了如下功能:

V1.4版本: 1.修复多语言支付错误的问题;

V1.3版本:1.修复PayPal支付接口报错问题;

V1.2版本:1.增加支付接口配置错误提示;

V1.1版本:1.修复微信公众号支付报错问题;

2.优化支付密钥存储格式;

V1.0版本功能:

1、支持微信扫描、H5、公众号支付,支付宝电脑端、手机端,银联B2C,银联B2B,Paypa支付接口;

2、支持货币符号自定设置;

3、支持多语言;

添加购物车的控制器功能函数代码

<?php

defined('IN_MET') or exit('No permission');

load::own_class('web/class/web_shop_base');

class cart extends web_shop_base{

    public $cart;

    public function __construct() {

        global $_M;

        parent::__construct();

        $this->cart = load::own_class('web/class/web_cart', 'new');

    }

    public function doindex() {

        global $_M;

        // 页面数据

        $cart = $this->cart->cart_list();

        $this->input['cartnum'] = count($cart);

        $this->input['moregoods_type']=intval($_M['config']['shopv2_moregoods'])?'com':'all';

        $this->input['goodnum']=$_M['form']['goodnum'];

        require_once $this->view('app/shop_cart',$this->input);

    }

    public function dotocart(){

        global $_M;

        $num = $_M['form']['num'];

        $pid = $_M['form']['pid'];

        $para_str = $_M['form']['option'];  //规格值组成的数组[1,3]

        $info['pid'] = $pid;

        $info['para_str'] = $para_str ?explode(',', $para_str) : '' ;

        $info['amount'] = $num;

        $stock = load::own_class('web/class/web_goods', 'new')->stock_list($info);

        $data['buy_ok'] = $stock['buy_ok'];

        $data['stock'] = $stock['stock'];

        if($data['buy_ok'] == 0){

            okinfo(-1,$_M['word']['app_shop_lowstocks']);

        }

        $data = array();

        $data[$info['pid']]['pid'] = $info['pid'];

        $purchase = load::own_class('web/class/web_goods', 'new')->purchase_list($data);

        if($num > $purchase[$info['pid']]){

            okinfo(-1,$_M['word']['app_shop_lowpurchase']);

        }

        $total = $this->cart->get_total_by_pid($pid, $para_str);

        if($total){

            $min_amount = min($stock['stock'], $purchase[$info['pid']]);

            if($min_amount - $total < $num){

                //购买商品数量超出上线 将无法再往购物车新增商品

                $num = 0;

                #okinfo(-1,$_M['word']['app_shop_lowpurchase']);

            }

        }

        $id = $this->cart->tocrat($pid, $para_str, $num);

        if($_M['form']['action'] == 'buynow'){

            header("Location: {$_M['url']['shop_pay']}&cidlist={$id}");

        }else{

            header("Location: {$_M['url']['shop_cart']}&a=domycart&id={$id}");

        }

    }

    public function domycart()

    {

        global $_M;

        $id = $_M['form']['id'];

        if(intval($id) < 0){

            okinfo(-1,$_M['word']['app_shop_lowstocks']);

        }

        load::plugin('doshopv2_tocart_afert', 0, array('id'=>$id));//加载插件

        $cart = $this->cart->get_cart_by_id($id);

        if(!$cart){

            okinfo(-1,$_M['word']['app_shop_emptycart']);

        }

        // 页面数据

        $this->input['tocart'] = $this->cart->analysis($cart);

        $this->input['moregoods_type']=intval($_M['config']['shopv2_moregoods'])?'com':'all';

        require_once $this->view('app/shop_tocart',$this->input);

    }

    public function dojson_cart_list() {

        global $_M;

        $search .= " and uid = '".get_met_cookie('id')."' ";

        $order = '';

        $data = $this->cart->json_cart_list($search, $order);

        $data = load::plugin('doshopv2_cart', 1, array('cart'=>$data));//加载插件

        echo jsonencode($data);

    }

    public function domodify() {

        global $_M;

        if($_M['form']['id'] || is_numeric($_M['form']['id'])){

            $info['id'] = $_M['form']['id'];

            $info['amount'] = $_M['form']['amount']>0?$_M['form']['amount']:1;

            $cart = $this->cart->get_cart_by_id($info['id']);

            $goods = load::own_class('web/class/web_goods', 'new')->get_goods_by_pid($cart['pid'],0,0,1);

            $shopmax = $goods['purchase']?$goods['purchase']:$goods['stock'];

            //purchase_list() 方法传入商品列表 二维数组机构

            $purchase = load::own_class('web/class/web_goods', 'new')->purchase_list(array($goods));

            #$purchase = load::own_class('web/class/web_goods', 'new')->purchase_list($goods);

            if($purchase[$cart['pid']]){

                $shopmax = $purchase[$cart['pid']];

            }

            if($info['amount']>$shopmax){

                $info['amount'] = $shopmax;

            }

            $this->cart->save_cart($info);

            if(!get_met_cookie('id')){

                $cart = $this->cart->cookie_cart;

            }else{

                $cart = $this->cart->cart_list();

            }

        }else{

            $cart = $this->cart->cart_list();

        }

        $cart = $this->cart->analysis_array($cart);

        $price = load::own_class('web/class/web_func', 'new')->price_plugin($cart);

        $return['message'] = 'ok';

        $return['price'] = $price;

        jsoncallback($return);

    }

    public function dodel() {

        global $_M;

        $this->cart->del_cart($_M['form']['id']);

        $this->ajax_success($_M['word']['app_shop_delok']);

    }

    //错误

    public function ajax_error($error, $data){

        global $_M;

        $retun = array();

        $retun['error'] = $error;

        $retun['data'] = $data;

        echo jsonencode($retun);

        die();

    }

    //成功

    public function ajax_success($success, $data){

        global $_M;

        $retun = array();

        $retun['success'] = $success;

        $retun['data'] = $data;

        echo jsonencode($retun);

        die();

    }

}

?>


响应式网站定制
响应式网站定制

MetInfo只提供支付接口工具,用户需要自行联系各大支付接口提供平台申请自己的支付接口许可,因考虑到资金安全问题,系统暂不支持第三方代收支付接口。

微信扫码  微信公众号支付  微信手机H5支付(新) 支付宝wap支付(新) 支付宝支付 银联B2C支付 银联B2B支付(新) PayPal

1、新增微信H5支付、支付宝wap支付、银联B2B支付接口(支付接口管理应用):

响应式网站定制
响应式网站定制

2、新增按会员组设置商品折扣功能:

响应式网站定制

<div class="page bg-pagebg1"><div class="container"><div class="page-content row"><include file="user_sidebar"/>

<div class="col-lg-9 shop-address"><div class="panel m-b-0" boxmh-mh>

<div class="panel-body">

<button type="button" class="btn btn-success addr-btn btn-squared">{$_M['word']['app_shop_addto']}{$_M['word']['app_shop_address']}</button>

<ul class="blocks-100 blocks-sm-2 blocks-md-3 m-t-20 text-xs-center addr-body">

<div class="loader vertical-align-middle loader-default m-l-30"></div>

</ul>

</div></div></div></div></div></div>

<script>var addrlisturl  = '{$_M['url']['shop_addr_index']}',addrdelurl = '{$_M['url']['shop_addr_del']}';</script>

3、新增虚拟商品自动发码(发卡)功能:

响应式网站定制
响应式网站定制
响应式网站定制


public function get_pay($pidlist) {

$cart = $this->cart->cart_list();

        $cart = $this->cart->analysis_array($cart);

$cidlist = '-'.$pidlist.'-';

$pgoods = array();

foreach($cart as $key=>$val){

if(stripos($cidlist, '-'.$val['id'].'-') !== false)$pgoods[] = $val;

}

$price = load::own_class('web/class/web_func', 'new')->price_plugin($pgoods);

$pgoods = load::own_class('web/class/web_func', 'new')->price_plugin_data($pgoods, $price);

$pgoods = load::plugin('doshopv2_pay_goods', 1, array('pgoods'=>$pgoods));

return $pgoods;

}

public function is_consignee_display($p) {

foreach($p as $key=>$val){

if($val['logistic'])return true;

}

return false;

}

public function is_stock_display($p) {

foreach($p as $key=>$val){

if($val['buy_ok'] == 0)return false;

}

return true;

}

4、新增退换货和取消订单功能:

响应式网站定制
响应式网站定制
响应式网站定制

5、新增多件下单打折和下单立减功能:

响应式网站定制
响应式网站定制
响应式网站定制

6、新增产品列表页按商品规格及价格筛选功能(需要模板支持):

响应式网站定制

7、优化系统多语言、运费模板等功能、前台功能界面:

响应式网站定制
响应式网站定制
响应式网站定制

开发语言:PHP+Mysql    支持语言:用户自定义(支持全球各种语言,每套系统可设置无限多种语言)

界面风格:支持 MetInfo 数百套商业模板及用户自定义模板      适用范围:B2B/B2C商城网站

功能:支持虚拟发货码(自动发货)、支持按会员组设置价格折扣

案例演示地址:
技术开发 http://www.shop1a.cn/product/