From dea93f91141a565c3e34a774dc3989448deb5379 Mon Sep 17 00:00:00 2001
From: Rock Zhang <iamgtskk@gmail.com>
Date: Fri, 15 Apr 2016 19:42:02 +0800
Subject: [PATCH] 修复限购商品结算进入选择地址页之后再回到结算页左上角的返回链接地址错误的bug

---
 yohobuy/m.yohobuy.com/application/models/Index/Cart.php              | 8 +++++---
 yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/yohobuy/m.yohobuy.com/application/models/Index/Cart.php b/yohobuy/m.yohobuy.com/application/models/Index/Cart.php
index 1967afa..a8510e1 100644
--- a/yohobuy/m.yohobuy.com/application/models/Index/Cart.php
+++ b/yohobuy/m.yohobuy.com/application/models/Index/Cart.php
@@ -331,9 +331,10 @@ class CartModel
         $result = array();
 
         $skuList = '';
-        $isLimitGoods = !empty($sku) && !empty($skn) && !empty($buyNumber);
-        if ($isLimitGoods) { // 存在sku,skn和buyNumber时为限购商品
-            $skuList = json_encode(array(
+        $hasSkuListCookie = isset($orderInfo['skuList']);
+        $isLimitGoods = $hasSkuListCookie || (!empty($sku) && !empty($skn) && !empty($buyNumber));
+        if ($isLimitGoods) { // 存在sku,skn和buyNumber或者cookie中有skuList时为限购商品
+            $skuList = $hasSkuListCookie ? $orderInfo['skuList'] : json_encode(array(
                 array(
                     'type' => 'limitcode',
                     'limitproductcode' => $limitProductCode,
@@ -342,6 +343,7 @@ class CartModel
                     'buy_number' => $buyNumber
                 )
             ));
+
             $result['isLimit'] = true;
         }
 
diff --git a/yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php b/yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
index af2a787..3384bf3 100644
--- a/yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
+++ b/yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
@@ -321,7 +321,7 @@ class IndexController extends AbstractAction
 
         // 限购商品时更换返回按钮地址
         if (isset($order['isLimit'])) {
-            $returnUrl = $this->server('HTTP_REFERER', $returnUrl);
+            $returnUrl = Helpers::url('/product/show_' . $skn . '.html');;
         }
 
         $data = array(
--
libgit2 0.24.0