ecshop支付宝直接支付修改

2010-09-13 22:39 来源:www.chinab4c.com 作者:admin

       ecshop的购买流程,相对于其他程序.可能要稍微好些。但是ecshop购买流程还是有很多不好的因素在里面。比如购买流程其实还是过于烦琐了。我们也试图开发过ecshop直接购买插件,也开发过ecshop简单购买流程.这些无非就是对ecshop的flow.php进行修改.简化ecshop.通过对ecshop二次开发达到从简购买.所以我们今天写一段程序,关于ecshop支付宝直接支付修改.主要思路的程序在以下代码。

      $goods_id = intval($_REQUEST['goods_id']);
 $shop_price  = get_final_price($goods_id, 1, true, array());
 $goods = get_goods_info($goods_id);
    include_once('includes/lib_clips.php');
 include_once('includes/lib_payment.php');
 include_once('includes/lib_order.php');
  
 $pay_id = $db -> getOne("select pay_id from ".$ecs->table('payment')." where pay_code = 'alipay'");
   
 $payment = payment_info($pay_id);
  
    include_once('includes/modules/payment/' . $payment['pay_code'] . '.php');
          
    $pay_obj    = new $payment['pay_code'];
    //$order['order_sn'] = get_order_sn();
 
 
 $order = array(
        'pay_id'          => $pay_id,
        'user_id'         => $_SESSION['user_id'],
        'add_time'        => gmtime(),
        'order_status'    => OS_UNCONFIRMED,
        'shipping_status' => SS_UNSHIPPED,
        'pay_status'      => PS_UNPAYED,
     
        ); 
 //$order['order_sn'] = date("YmdHis");
  $order['order_sn'] = get_order_sn();
 $order['title'] = $goods['goods_name'];

 $order['order_amount'] = $shop_price;
 $order['goods_amount'] = $shop_price;
 if($order['order_amount'] < 298){
  $order['order_amount']+=10;
  $order['shipping_fee'] = 10;
 }

 $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), $order, 'INSERT');
  
 $new_order_id = $db->insert_id();
    $order['order_id'] = $new_order_id;
 clear_cart();
 addto_cart($goods_id, 1, array(), '');
    $sql = "INSERT INTO " . $ecs->table('order_goods') . "( " .
                "order_id, goods_id, goods_name, goods_sn, product_id, goods_number, market_price, ".
                "goods_price, goods_attr, is_real, extension_code, parent_id, is_gift, goods_attr_id) ".
            " SELECT '$new_order_id', goods_id, goods_name, goods_sn, product_id, goods_number, market_price, ".
                "goods_price, goods_attr, is_real, extension_code, parent_id, is_gift, goods_attr_id".
            " FROM " .$ecs->table('cart') .
            " WHERE session_id = '".SESS_ID."' AND rec_type = '$flow_type' and goods_id = '$goods_id'";
  $db->query($sql);

 $db -> query("delete from ".$ecs->table('cart')." where goods_id = '$goods_id' and session_id = '".SESS_ID."'");
 header("Location:$url");

    以上是代码思路,供参考.

   相关插件:

    ecshop2.7.2购买流程简化 

   ecshop2.7.1直接购买插件

   来源:http://www.chinab4c.com