提交 27c9803e 编写于 作者: R root

fecshop支付成功返回的成功页面部分

上级 f2ff95e1
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace fecshop\app\appfront\modules\Payment\block\success;
use Yii;
use fec\helpers\CModule;
use fec\helpers\CRequest;
use yii\base\InvalidValueException;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class Index {
public function getLastData(){
$increment_id = Yii::$service->order->getSessionIncrementId();
$order = Yii::$service->order->getInfoByIncrementId($increment_id);
# 清空购物车。这里针对的是未登录用户进行购物车清空。
Yii::$service->cart->clearCart();
return [
'increment_id' => $increment_id,
'order' => $order,
];
}
}
\ No newline at end of file
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace fecshop\app\appfront\modules\Payment\controllers;
use Yii;
use fec\helpers\CModule;
use fec\helpers\CRequest;
use fecshop\app\appfront\modules\AppfrontController;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class SuccessController extends AppfrontController
{
public function actionIndex(){
$data = $this->getBlock()->getLastData();
return $this->render($this->action->id,$data);
}
}
\ No newline at end of file
......@@ -27,9 +27,7 @@ class StandardController extends AppfrontController
}
public function actionSuccess(){
}
public function actionIpn(){
Yii::$service->payment->paypal->receiveIpn();
......
<style>
.paypal_success{line-height:24px;}
</style>
<div class="main container one-column">
<div class="col-main">
<div class="paypal_success">
<div class="page-title">
</div>
<h2 class="sub-title">Your order has been received,Thank you for your purchase!</h2>
<p>Your order # is: <?= $increment_id ?>.</p>
<p>You will receive an order confirmation email with details of your order and a link to track its progress.</p>
<div class="buttons-set">
<button type="button" class="button" title="Continue Shopping" onclick="window.location='<?= Yii::$service->url->homeUrl(); ?>'"><span><span>Continue Shopping</span></span></button>
</div>
<?php // var_dump($order); ?>
</div>
</div>
</div>
\ No newline at end of file
......@@ -16,7 +16,7 @@ return [
'supplement' => 'Off-line Money Payments', # 补充
'style' => '<style></style>', # 补充css
'start_url' => '@homeUrl/payment/checkmoney/start',
'success_redirect_url' => '@homeUrl/payment/checkmoney/success',
'success_redirect_url' => '@homeUrl/payment/success',
],
'paypal_standard' => [
'label' => 'PayPal Website Payments Standard',
......@@ -27,7 +27,7 @@ return [
# 接收IPN消息的页面。
'IPN_url' => '@homeUrl/payment/paypal/standard/ipn',
# 在第三方支付成功后,跳转到网站的页面
'success_redirect_url' => '@homeUrl/payment/paypal/standard/success',
'success_redirect_url' => '@homeUrl/payment/success',
# 进入paypal支付页面,点击取消进入网站的页面。
'cancel_url' => '@homeUrl/payment/paypal/standard/cancel',
......
......@@ -324,6 +324,12 @@ class Order extends Service
$orderModel->save();
Yii::$service->order->item->saveOrderItems($cartInfo['products'],$order_id,$cartInfo['store']);
$this->setSessionIncrementId($increment_id);
# 如果是登录用户,那么,在生成订单后,需要清空购物车。
Yii::$service->cart->clearCart();
# 扣除库存。
# (备注)需要另起一个脚本,用来处理半个小时后,还没有支付的订单,将订单取消,然后将订单里面的产品库存返还。
# 如果是无限库存(没有库存就去采购的方式),那么不需要跑这个脚本,将库存设置的非常大即可。
return true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册