在限购商品详情页添加限购商品码字段
Code Review By Rock Zhang
Showing
4 changed files
with
9 additions
and
5 deletions
@@ -159,6 +159,9 @@ | @@ -159,6 +159,9 @@ | ||
159 | <a href="javascript:;" class="sold-out">立即购买</a> | 159 | <a href="javascript:;" class="sold-out">立即购买</a> |
160 | {{/if}} | 160 | {{/if}} |
161 | <input type="hidden" name="limitCodeUrl" value="{{limitCodeUrl}}"> | 161 | <input type="hidden" name="limitCodeUrl" value="{{limitCodeUrl}}"> |
162 | + {{#limitProductCode}} | ||
163 | + <input type="hidden" name="limitProductCode" value="{{.}}"> | ||
164 | + {{/limitProductCode}} | ||
162 | 165 | ||
163 | <a href="javascript:;" id="likeBtn" class="favorite iconfont {{#isCollect}}liked{{/isCollect}}"></a> | 166 | <a href="javascript:;" id="likeBtn" class="favorite iconfont {{#isCollect}}liked{{/isCollect}}"></a> |
164 | </div> | 167 | </div> |
@@ -314,13 +314,13 @@ class CartModel | @@ -314,13 +314,13 @@ class CartModel | ||
314 | * @param int $uid 用户ID | 314 | * @param int $uid 用户ID |
315 | * @param string $cartType 购物车类型,ordinary表示普通购物车 | 315 | * @param string $cartType 购物车类型,ordinary表示普通购物车 |
316 | * @param array $orderInfo cookie中记录的一些订单有关数据 | 316 | * @param array $orderInfo cookie中记录的一些订单有关数据 |
317 | - * @param string $limitCode 限购商品的限购码,用户限购商品购买 | 317 | + * @param string $limitProductCode 限购商品码,用户限购商品购买 |
318 | * @param string $sku 商品sku,用于限购商品购买 | 318 | * @param string $sku 商品sku,用于限购商品购买 |
319 | * @param stirng $skn 商品skn,用于限购商品购买 | 319 | * @param stirng $skn 商品skn,用于限购商品购买 |
320 | * @param int $buyNumber 购买商品数目,用户限购商品支付 | 320 | * @param int $buyNumber 购买商品数目,用户限购商品支付 |
321 | * @return array 接口返回的数据 | 321 | * @return array 接口返回的数据 |
322 | */ | 322 | */ |
323 | - public static function cartPay($uid, $cartType, $orderInfo, $limitCode, $sku, $skn, $buyNumber) | 323 | + public static function cartPay($uid, $cartType, $orderInfo, $limitProductCode, $sku, $skn, $buyNumber) |
324 | { | 324 | { |
325 | $result = array(); | 325 | $result = array(); |
326 | 326 | ||
@@ -329,7 +329,7 @@ class CartModel | @@ -329,7 +329,7 @@ class CartModel | ||
329 | $skuList = json_encode(array( | 329 | $skuList = json_encode(array( |
330 | array( | 330 | array( |
331 | 'type' => 'limitcode', | 331 | 'type' => 'limitcode', |
332 | - 'limitproductcode' => $limitCode, | 332 | + 'limitproductcode' => $limitProductCode, |
333 | 'skn' => $skn, | 333 | 'skn' => $skn, |
334 | 'sku' => $sku, | 334 | 'sku' => $sku, |
335 | 'buy_number' => $buyNumber | 335 | 'buy_number' => $buyNumber |
@@ -330,6 +330,7 @@ class DetailModel | @@ -330,6 +330,7 @@ class DetailModel | ||
330 | // 处理限购商品有关的按钮状态 | 330 | // 处理限购商品有关的按钮状态 |
331 | self::procShowStatus($result, $showStatus, $isBeginSale); | 331 | self::procShowStatus($result, $showStatus, $isBeginSale); |
332 | 332 | ||
333 | + $result['cartInfo']['limitProductCode'] = $baseInfo['limitProductCode']; | ||
333 | $result['cartInfo']['limitCodeUrl'] = 'yohobuy://' . Helpers::url('/product', array('skn' => $baseInfo['erpProductId'])); | 334 | $result['cartInfo']['limitCodeUrl'] = 'yohobuy://' . Helpers::url('/product', array('skn' => $baseInfo['erpProductId'])); |
334 | } | 335 | } |
335 | 336 |
@@ -295,14 +295,14 @@ class IndexController extends AbstractAction | @@ -295,14 +295,14 @@ class IndexController extends AbstractAction | ||
295 | } | 295 | } |
296 | 296 | ||
297 | // 如果传递了code, sku,skn,buy_number就代表是限购商品 | 297 | // 如果传递了code, sku,skn,buy_number就代表是限购商品 |
298 | - $limitCode = $this->get('code', ''); | 298 | + $limitProductCode = $this->get('code', ''); |
299 | $sku = $this->get('sku', ''); | 299 | $sku = $this->get('sku', ''); |
300 | $skn = $this->get('skn', ''); | 300 | $skn = $this->get('skn', ''); |
301 | $buyNumber = $this->get('buy_number', ''); | 301 | $buyNumber = $this->get('buy_number', ''); |
302 | 302 | ||
303 | // 购物车商品为空跳转到购物车页面 | 303 | // 购物车商品为空跳转到购物车页面 |
304 | $uid = $this->getUid(true); | 304 | $uid = $this->getUid(true); |
305 | - $order = CartModel::cartPay($uid, $cartType, $orderInfo, $limitCode, $sku, $skn, $buyNumber); | 305 | + $order = CartModel::cartPay($uid, $cartType, $orderInfo, $limitProductCode, $sku, $skn, $buyNumber); |
306 | if (isset($order['cartUrl'])) { | 306 | if (isset($order['cartUrl'])) { |
307 | $this->go($order['cartUrl']); | 307 | $this->go($order['cartUrl']); |
308 | } | 308 | } |
-
Please register or login to post a comment