你想的是,不使用一页支付,而是想分开操作。
1.在下单页面,点击place order后, /checkout/onepage/index post 请求
https://github.com/fecshop/yii2_fecshop/blob/master/app/appfront/modules/Checkout/controllers/OnepageController.php#L42
$status = $this->getBlock('placeorder')->getLastData();
就是文件:https://github.com/fecshop/yii2_fecshop/blob/master/app/appfront/modules/Checkout/block/onepage/Placeorder.php
2.找到: https://github.com/fecshop/yii2_fecshop/blob/master/app/appfront/modules/Checkout/block/onepage/Placeorder.php#L77
$genarateStatus = Yii::$service->order->generateOrderByCart($this->_billing, $this->_shipping_method, $this->_payment_method, false, '', $this->_order_remark);
就是:https://github.com/fecshop/yii2_fecshop/blob/master/services/Order.php#L522
protected function actionGenerateOrderByCart($address, $shipping_method, $payment_method, $clearCart = true, $token = '', $order_remark = '')
{
}
到这里就找到生成订单的代码了
对于优惠券,在购物车页面就可以使用,你在下单前使用也没有问题,自己找代码逻辑
对于货运地址,你可以提前保存,目前处理货运地址的代码为:https://github.com/fecshop/yii2_fecshop/blob/master/app/appfront/modules/Checkout/block/onepage/Placeorder.php#L224
,你可以在前面保存写来,然后吧address_id 写入session,然后在调用
generateOrderByCart()
的时候传递进来即可
对于支付方式,在订单生成后选择支付方式更新订单支付,可以将:https://github.com/fecshop/yii2_fecshop/blob/master/services/Order.php#L606
这行代码去掉,然后自己写一个更新订单支付方式的方法。
理清楚思路和逻辑,按照自己的需求更改相应的代码逻辑即可。