米拓商城經過4個版本的升級,現已支持在線商城的主要功能,代碼開源,支付接口豐富,響應式佈局(支持電腦、手機、平板)本次升級主要新增瞭如下功能:
V1.4版本: 1.修復多語言支付錯誤的問題;
V1.3版本:1.修復PayPal支付接口報錯問題;
V1.2版本:1.增加支付接口配置錯誤提示;
V1.1版本:1.修復微信公衆號支付報錯問題;
2.優化支付密鑰存儲格式;
V1.0版本功能:
1、支持微信掃描、H5、公衆號支付,支付寶電腦端、手機端,銀聯B2C,銀聯B2B,Paypa支付接口;
2、支持貨幣符號自定設置;
3、支持多語言;http://www.shop1a.cn/news/news23.html
添加購物車的控制器功能函數代碼
<?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/