Changeset 18275 for branches/comu-ver2/data/class/helper/SC_Helper_DB.php
- Timestamp:
- 2009/09/01 15:04:37 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/class/helper/SC_Helper_DB.php
r18273 r18275 264 264 // 商品規格取得 265 265 $objQuery = new SC_Query(); 266 $col = "product_id, deliv_fee, name, product_code, main_list_image, main_image, price01, price02, point_rate, product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited, sale_limit , sale_unlimited";266 $col = "product_id, deliv_fee, name, product_code, main_list_image, main_image, price01, price02, point_rate, product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited, sale_limit"; 267 267 $table = "vw_product_class AS prdcls"; 268 268 $where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ? AND status = 1"; … … 309 309 // 商品規格情報の取得 310 310 $arrData = $this->sfGetProductsClass($arrCart['id']); 311 $limit = "";311 $limit = null; 312 312 // DBに存在する商品 313 313 if (count($arrData) > 0) { 314 314 315 315 // 購入制限数を求める。 316 if ($arrData['stock_unlimited'] != '1' && $arrData['sale_unlimited'] != '1') {316 if ($arrData['stock_unlimited'] != '1' && SC_Utils_Ex::sfIsInt($arrData['sale_limit'])) { 317 317 $limit = min($arrData['sale_limit'], $arrData['stock']); 318 } elseif ( $arrData['sale_unlimited'] != '1') {318 } elseif (SC_Utils_Ex::sfIsInt($arrData['sale_limit'])) { 319 319 $limit = $arrData['sale_limit']; 320 320 } elseif ($arrData['stock_unlimited'] != '1') { … … 322 322 } 323 323 324 if ($limit != "" && $limit < $arrCart['quantity']) { 325 // カート内商品数を制限に合わせる 326 $objCartSess->setProductValue($arrCart['id'], 'quantity', $limit); 327 $quantity = $limit; 328 $objPage->tpl_message .= "※「" . $arrData['name'] . "」は販売制限(または在庫が不足)しております。一度に数量{$limit}以上の購入はできません。\n"; 324 if (!is_null($limit) && $arrCart['quantity'] > $limit) { 325 if ($limit > 0) { 326 // カート内商品数を制限に合わせる 327 $objCartSess->setProductValue($arrCart['id'], 'quantity', $limit); 328 $quantity = $limit; 329 $objPage->tpl_message .= "※「" . $arrData['name'] . "」は販売制限(または在庫が不足)しております。一度に数量{$limit}以上の購入はできません。\n"; 330 } else { 331 // 売り切れ商品をカートから削除する 332 $objCartSess->delProduct($arrCart['cart_no']); 333 $objPage->tpl_message .= "※「" . $arrData['name'] . "」は売り切れました。\n"; 334 break; 335 } 329 336 } else { 330 337 $quantity = $arrCart['quantity']; … … 334 341 $product_id = $arrCart['id'][0]; 335 342 $arrQuantityInfo_by_product[$product_id]['quantity'] += $quantity; 336 $arrQuantityInfo_by_product[$product_id]['sale_unlimited'] = $arrData['sale_unlimited'];337 343 $arrQuantityInfo_by_product[$product_id]['sale_limit'] = $arrData['sale_limit']; 338 344 $arrQuantityInfo_by_product[$product_id]['name'] = $arrData['name']; … … 384 390 $cnt++; 385 391 } else { // DBに商品が見つからない場合、 386 $objPage->tpl_message .= "※ 現時点で販売していない商品が含まれておりました。該当商品をカートから削除しました。\n";392 $objPage->tpl_message .= "※ 現時点で販売していない商品が含まれておりました。該当商品をカートから削除しました。\n"; 387 393 // カート商品の削除 388 $objCartSess->delProduct Key('id', $arrCart['id']);394 $objCartSess->delProduct($arrCart['cart_no']); 389 395 } 390 396 } 391 397 392 398 foreach ($arrQuantityInfo_by_product as $product_id => $quantityInfo) { 393 if ( $quantityInfo['sale_unlimited'] != '1' && $quantityInfo['sale_limit'] != '' && $quantityInfo['sale_limit'] < $quantityInfo['quantity']) {399 if (SC_Utils_Ex::sfIsInt($quantityInfo['sale_limit']) && $quantityInfo['quantity'] > $quantityInfo['sale_limit']) { 394 400 $objPage->tpl_error = "※「{$quantityInfo['name']}」は数量「{$quantityInfo['sale_limit']}」以下に販売制限しております。一度にこれ以上の購入はできません。\n"; 395 401 // 販売制限に引っかかった商品をマークする
Note: See TracChangeset
for help on using the changeset viewer.