提交 417c51f6 编写于 作者: T Terry

订单备注完善

上级 eea16dd3
......@@ -31,7 +31,10 @@ class Placeorder
* 用户的支付方式.
*/
public $_payment_method;
/**
* 订单备注信息.
*/
public $_order_remark;
public function getLastData()
{
$post = Yii::$app->request->post();
......@@ -59,7 +62,7 @@ class Placeorder
// 将购物车数据,生成订单,生成订单后,不清空购物车,不扣除库存,在支付成功后在清空购物车。
$innerTransaction = Yii::$app->db->beginTransaction();
try {
$genarateStatus = Yii::$service->order->generateOrderByCart($this->_billing, $this->_shipping_method, $this->_payment_method, false,$token);
$genarateStatus = Yii::$service->order->generateOrderByCart($this->_billing, $this->_shipping_method, $this->_payment_method, false, $token, $this->_order_remark);
if ($genarateStatus) {
$innerTransaction->commit();
} else {
......@@ -223,7 +226,20 @@ class Placeorder
return false;
}
}
// 订单备注信息不能超过1500字符
$orderRemarkStrMaxLen = Yii::$service->order->orderRemarkStrMaxLen;
$order_remark = isset($post['order_remark']) ? $post['order_remark'] : '';
if ($order_remark && $orderRemarkStrMaxLen) {
$order_remark_strlen = strlen($order_remark);
if ($order_remark_strlen > $orderRemarkStrMaxLen) {
Yii::$service->helper->errors->add('order remark string length can not gt '.$orderRemarkStrMaxLen);
return false;
} else {
// 去掉xss攻击字符,关于防止xss攻击的yii文档参看:http://www.yiichina.com/doc/guide/2.0/security-best-practices#fang-zhi-xss-gong-ji
$this->_order_remark = $order_remark;
}
}
$this->_shipping_method = $shipping_method;
$this->_payment_method = $payment_method;
Yii::$service->payment->setPaymentMethod($this->_payment_method);
......
......@@ -66,6 +66,11 @@
<div class="coupon_add_log"></div>
</div>
<div class="onestepcheckout-coupons">
<div class="op_block_title"><?= Yii::$service->page->translate->__('Order Remark (optional)');?></div>
<label for="id_couponcode"><?= Yii::$service->page->translate->__('You can fill in the order remark information below');?></label>
<textarea class="order_remark" name="order_remark" style="width:94%;height:100px;padding:10px;"></textarea>
</div>
</div>
......
......@@ -31,7 +31,10 @@ class Placeorder
* 用户的支付方式.
*/
public $_payment_method;
/**
* 订单备注信息.
*/
public $_order_remark;
public function getLastData()
{
$post = Yii::$app->request->post();
......@@ -59,7 +62,7 @@ class Placeorder
// 将购物车数据,生成订单,生成订单后,不清空购物车,不扣除库存,在支付成功后在清空购物车。
$innerTransaction = Yii::$app->db->beginTransaction();
try {
$genarateStatus = Yii::$service->order->generateOrderByCart($this->_billing, $this->_shipping_method, $this->_payment_method, false,$token);
$genarateStatus = Yii::$service->order->generateOrderByCart($this->_billing, $this->_shipping_method, $this->_payment_method, false, $token, $this->_order_remark);
if ($genarateStatus) {
$innerTransaction->commit();
} else {
......@@ -223,7 +226,20 @@ class Placeorder
return false;
}
}
// 订单备注信息不能超过1500字符
$orderRemarkStrMaxLen = Yii::$service->order->orderRemarkStrMaxLen;
$order_remark = isset($post['order_remark']) ? $post['order_remark'] : '';
if ($order_remark && $orderRemarkStrMaxLen) {
$order_remark_strlen = strlen($order_remark);
if ($order_remark_strlen > $orderRemarkStrMaxLen) {
Yii::$service->helper->errors->add('order remark string length can not gt '.$orderRemarkStrMaxLen);
return false;
} else {
// 去掉xss攻击字符,关于防止xss攻击的yii文档参看:http://www.yiichina.com/doc/guide/2.0/security-best-practices#fang-zhi-xss-gong-ji
$this->_order_remark = $order_remark;
}
}
$this->_shipping_method = $shipping_method;
$this->_payment_method = $payment_method;
Yii::$service->payment->setPaymentMethod($this->_payment_method);
......
......@@ -60,25 +60,25 @@ use fecshop\app\apphtml5\helper\Format;
<table class="onestepcheckout-totals">
<tbody>
<tr>
<td ><?= Yii::$service->page->translate->__('Subtotal') ?></td>
<td class="totals"><?= Yii::$service->page->translate->__('Subtotal') ?></td>
<td class="value">
<span class="price"><?= $currency_info['symbol']; ?><?= Format::price($cart_info['product_total']); ?></span>
</td>
</tr>
<tr>
<td ><?= Yii::$service->page->translate->__('Shipping Cost') ?></td>
<td class="totals"><?= Yii::$service->page->translate->__('Shipping Cost') ?></td>
<td class="value">
<span class="price"><?= $currency_info['symbol']; ?><?= Format::price($cart_info['shipping_cost']); ?></span>
</td>
</tr>
<tr>
<td ><?= Yii::$service->page->translate->__('Discount') ?></td>
<td class="totals"><?= Yii::$service->page->translate->__('Discount') ?></td>
<td class="value">
<span class="price">-<?= $currency_info['symbol']; ?><?= Format::price($cart_info['coupon_cost']); ?></span>
</td>
</tr>
<tr class="grand-total">
<td ><?= Yii::$service->page->translate->__('Grand Total') ?></td>
<td class="totals"><?= Yii::$service->page->translate->__('Grand Total') ?></td>
<td class="value">
<span class="price"><?= $currency_info['symbol']; ?><?= Format::price($cart_info['grand_total']) ?></span>
</td>
......
......@@ -65,7 +65,11 @@
<div class="coupon_add_log"></div>
</div>
<div class="onestepcheckout-coupons">
<div class="op_block_title"><?= Yii::$service->page->translate->__('Order Remark (optional)');?></div>
<label for="id_couponcode"><?= Yii::$service->page->translate->__('You can fill in the order remark information below');?></label>
<textarea class="order_remark" name="order_remark" style="width:100%;height:100px;padding:10px;"></textarea>
</div>
</div>
<div class="onestepcheckout-column-right">
......
......@@ -61,25 +61,25 @@ use fecshop\app\apphtml5\helper\Format;
<table class="onestepcheckout-totals">
<tbody>
<tr>
<td class="title"><?= Yii::$service->page->translate->__('Subtotal') ?></td>
<td class="totals"><?= Yii::$service->page->translate->__('Subtotal') ?></td>
<td class="value">
<span class="price"><?= $currency_info['symbol']; ?><?= Format::price($cart_info['product_total']); ?></span>
</td>
</tr>
<tr>
<td class="title"><?= Yii::$service->page->translate->__('Shipping Cost') ?></td>
<td class="totals"><?= Yii::$service->page->translate->__('Shipping Cost') ?></td>
<td class="value">
<span class="price"><?= $currency_info['symbol']; ?><?= Format::price($cart_info['shipping_cost']); ?></span>
</td>
</tr>
<tr>
<td class="title"><?= Yii::$service->page->translate->__('Discount') ?></td>
<td class="totals"><?= Yii::$service->page->translate->__('Discount') ?></td>
<td class="value">
<span class="price">-<?= $currency_info['symbol']; ?><?= Format::price($cart_info['coupon_cost']); ?></span>
</td>
</tr>
<tr class="grand-total">
<td class="title"><?= Yii::$service->page->translate->__('Grand Total') ?></td>
<td class="totals"><?= Yii::$service->page->translate->__('Grand Total') ?></td>
<td class="value">
<span class="price"><?= $currency_info['symbol']; ?><?= Format::price($cart_info['grand_total']) ?></span>
</td>
......
......@@ -31,7 +31,9 @@ class Placeorder
* 用户的支付方式.
*/
public $_payment_method;
public $_order_remark;
public function getLastData()
{
$post = Yii::$app->request->post();
......@@ -66,7 +68,7 @@ class Placeorder
// 将购物车数据,生成订单,生成订单后,不清空购物车,不扣除库存,在支付成功后在清空购物车。
$innerTransaction = Yii::$app->db->beginTransaction();
try {
$genarateStatus = Yii::$service->order->generateOrderByCart($this->_billing, $this->_shipping_method, $this->_payment_method, false,$token);
$genarateStatus = Yii::$service->order->generateOrderByCart($this->_billing, $this->_shipping_method, $this->_payment_method, false, $token, $this->_order_remark);
if ($genarateStatus) {
$innerTransaction->commit();
} else {
......@@ -266,7 +268,20 @@ class Placeorder
}
}
// 订单备注信息不能超过1500字符
$orderRemarkStrMaxLen = Yii::$service->order->orderRemarkStrMaxLen;
$order_remark = isset($post['order_remark']) ? $post['order_remark'] : '';
if ($order_remark && $orderRemarkStrMaxLen) {
$order_remark_strlen = strlen($order_remark);
if ($order_remark_strlen > $orderRemarkStrMaxLen) {
Yii::$service->helper->errors->add('order remark string length can not gt '.$orderRemarkStrMaxLen);
return false;
} else {
// 去掉xss攻击字符,关于防止xss攻击的yii文档参看:http://www.yiichina.com/doc/guide/2.0/security-best-practices#fang-zhi-xss-gong-ji
$this->_order_remark = $order_remark;
}
}
$this->_shipping_method = $shipping_method;
$this->_payment_method = $payment_method;
Yii::$service->payment->setPaymentMethod($this->_payment_method);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册