From 7e39ee34a466c832b64c74ee9f09e33497050ef2 Mon Sep 17 00:00:00 2001 From: Rock Zhang <iamgtskk@gmail.com> Date: Tue, 26 Jan 2016 11:33:56 +0800 Subject: [PATCH] 购物车页面添加商品的skn Code Review By Rock Zhang --- template/m.yohobuy.com/partials/cart/good.phtml | 2 +- yohobuy/m.yohobuy.com/application/models/Index/Cart.php | 5 ++--- yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php | 6 ++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/template/m.yohobuy.com/partials/cart/good.phtml b/template/m.yohobuy.com/partials/cart/good.phtml index c3a6829..9ba5ae1 100644 --- a/template/m.yohobuy.com/partials/cart/good.phtml +++ b/template/m.yohobuy.com/partials/cart/good.phtml @@ -1,4 +1,4 @@ -<div class="shopping-cart-good clearfix" data-id="{{id}}"> +<div class="shopping-cart-good clearfix" data-id="{{id}}" data-skn="{{skn}}"> {{#if inValid}} <span class="few-tag-expire">失效</span> {{/if}} diff --git a/yohobuy/m.yohobuy.com/application/models/Index/Cart.php b/yohobuy/m.yohobuy.com/application/models/Index/Cart.php index 8f722d4..f38934f 100644 --- a/yohobuy/m.yohobuy.com/application/models/Index/Cart.php +++ b/yohobuy/m.yohobuy.com/application/models/Index/Cart.php @@ -224,8 +224,7 @@ class CartModel $product = CartData::cartProductData($uid, $skn); if (isset($product['code']) && $product['code'] === 200) { - $result['code'] = 200; - $result['data'] = self::procGoodsDetail($product['data'], $num); + $result = self::procGoodsDetail($product['data'], $num); } return $result; @@ -244,7 +243,7 @@ class CartModel $product = CartData::giftProductData($skn, $promotionId); if (isset($product['code']) && $product['code'] === 200) { - $result['data'] = self::procGoodsDetail($product['data']); + $result = self::procGoodsDetail($product['data']); } return $result; 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 7df2f5a..3c78808 100644 --- a/yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php +++ b/yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php @@ -195,7 +195,9 @@ class IndexController extends AbstractAction $result['num'] = $num; } - $this->echoJson($result); + $this->_view->display('gift-info', array( + 'cartInfo' => $result + )); } // /* @@ -223,7 +225,7 @@ class IndexController extends AbstractAction $this->_view->display('gift-info', array( 'promotionId' => $promotionId, - 'cartInfo' => $result['data'] + 'cartInfo' => $result )); } -- libgit2 0.24.0