Changeset 21441 for branches/version-2_12-dev/data/class/SC_CartSession.php
- Timestamp:
- 2012/02/06 11:05:15 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/SC_CartSession.php
r21420 r21441 47 47 $this->key_tmp = "savecart_" . $key_tmp; 48 48 // すでに情報がなければ現状のカート情報を記録しておく 49 if (count($_SESSION[$this->key_tmp]) == 0) {49 if (count($_SESSION[$this->key_tmp]) == 0) { 50 50 $_SESSION[$this->key_tmp] = $this->cartSession[$productTypeId]; 51 51 } 52 52 // 1世代古いコピー情報は、削除しておく 53 foreach ($_SESSION as $k => $val) {54 if ($k != $this->key_tmp && preg_match("/^savecart_/", $k)) {53 foreach ($_SESSION as $k => $val) { 54 if ($k != $this->key_tmp && preg_match("/^savecart_/", $k)) { 55 55 unset($this->cartSession[$productTypeId][$k]); 56 56 } … … 70 70 $change = false; 71 71 $max = $this->getMax($productTypeId); 72 for ($i = 1; $i <= $max; $i++) {72 for ($i = 1; $i <= $max; $i++) { 73 73 if ($this->cartSession[$productTypeId][$i]['quantity'] 74 74 != $_SESSION[$this->key_tmp][$i]['quantity']) { … … 96 96 // 次に割り当てるカートのIDを取得する 97 97 function getNextCartID($productTypeId) { 98 foreach ($this->cartSession[$productTypeId] as $key => $val){98 foreach ($this->cartSession[$productTypeId] as $key => $val) { 99 99 $arrRet[] = $this->cartSession[$productTypeId][$key]['cart_no']; 100 100 } … … 112 112 function getProductTotal($id, $productTypeId) { 113 113 $max = $this->getMax($productTypeId); 114 for ($i = 0; $i <= $max; $i++) {114 for ($i = 0; $i <= $max; $i++) { 115 115 if(isset($this->cartSession[$productTypeId][$i]['id']) 116 116 && $this->cartSession[$productTypeId][$i]['id'] == $id) { … … 130 130 function setProductValue($id, $key, $val, $productTypeId) { 131 131 $max = $this->getMax($productTypeId); 132 for ($i = 0; $i <= $max; $i++) {132 for ($i = 0; $i <= $max; $i++) { 133 133 if(isset($this->cartSession[$productTypeId][$i]['id']) 134 134 && $this->cartSession[$productTypeId][$i]['id'] == $id) { … … 141 141 function getMax($productTypeId) { 142 142 $max = 0; 143 if (count($this->cartSession[$productTypeId]) > 0) {144 foreach ($this->cartSession[$productTypeId] as $key => $val) {143 if (count($this->cartSession[$productTypeId]) > 0) { 144 foreach ($this->cartSession[$productTypeId] as $key => $val) { 145 145 if (is_numeric($key)) { 146 if ($max < $key) {146 if ($max < $key) { 147 147 $max = $key; 148 148 } … … 157 157 $total = 0; 158 158 $max = $this->getMax($productTypeId); 159 for ($i = 0; $i <= $max; $i++) {159 for ($i = 0; $i <= $max; $i++) { 160 160 $total+= $this->cartSession[$productTypeId][$i]['quantity']; 161 161 } … … 168 168 $total = 0; 169 169 $max = $this->getMax($productTypeId); 170 for ($i = 0; $i <= $max; $i++) {170 for ($i = 0; $i <= $max; $i++) { 171 171 172 172 if (!isset($this->cartSession[$productTypeId][$i]['price'])) { … … 192 192 $total = 0; 193 193 $max = $this->getMax($productTypeId); 194 for ($i = 0; $i <= $max; $i++) {194 for ($i = 0; $i <= $max; $i++) { 195 195 $price = $this->cartSession[$productTypeId][$i]['price']; 196 196 $quantity = $this->cartSession[$productTypeId][$i]['quantity']; … … 207 207 if (USE_POINT !== false) { 208 208 $max = $this->getMax($productTypeId); 209 for ($i = 0; $i <= $max; $i++) {209 for ($i = 0; $i <= $max; $i++) { 210 210 $price = $this->cartSession[$productTypeId][$i]['price']; 211 211 $quantity = $this->cartSession[$productTypeId][$i]['quantity']; … … 233 233 $find = false; 234 234 $max = $this->getMax($productTypeId); 235 for ($i = 0; $i <= $max; $i++) {236 237 if ($this->cartSession[$productTypeId][$i]['id'] == $product_class_id) {235 for ($i = 0; $i <= $max; $i++) { 236 237 if ($this->cartSession[$productTypeId][$i]['id'] == $product_class_id) { 238 238 $val = $this->cartSession[$productTypeId][$i]['quantity'] + $quantity; 239 if (strlen($val) <= INT_LEN) {239 if (strlen($val) <= INT_LEN) { 240 240 $this->cartSession[$productTypeId][$i]['quantity'] += $quantity; 241 241 } … … 243 243 } 244 244 } 245 if (!$find) {245 if (!$find) { 246 246 $this->cartSession[$productTypeId][$max+1]['id'] = $product_class_id; 247 247 $this->cartSession[$productTypeId][$max+1]['quantity'] = $quantity; … … 259 259 $exclude = false; 260 260 // ページチェックを行う。 261 foreach ($arrExclude as $val) {262 if (preg_match("|" . preg_quote($val) . "|", $url)) {261 foreach ($arrExclude as $val) { 262 if (preg_match("|" . preg_quote($val) . "|", $url)) { 263 263 $exclude = true; 264 264 break; … … 266 266 } 267 267 // 除外ページでない場合は、前頁として記録する。 268 if (!$exclude) {268 if (!$exclude) { 269 269 $_SESSION['prev_url'] = $url; 270 270 } … … 279 279 function delProductKey($keyname, $val, $productTypeId) { 280 280 $max = count($this->cartSession[$productTypeId]); 281 for ($i = 0; $i < $max; $i++) {282 if ($this->cartSession[$productTypeId][$i][$keyname] == $val) {281 for ($i = 0; $i < $max; $i++) { 282 if ($this->cartSession[$productTypeId][$i][$keyname] == $val) { 283 283 unset($this->cartSession[$productTypeId][$i]); 284 284 } … … 335 335 $max = $this->getMax($productTypeId); 336 336 $arrRet = array(); 337 for ($i = 0; $i <= $max; $i++) {337 for ($i = 0; $i <= $max; $i++) { 338 338 if(isset($this->cartSession[$productTypeId][$i]['cart_no']) 339 339 && $this->cartSession[$productTypeId][$i]['cart_no'] != "") { … … 391 391 function getAllProductID($productTypeId) { 392 392 $max = $this->getMax($productTypeId); 393 for ($i = 0; $i <= $max; $i++) {394 if ($this->cartSession[$productTypeId][$i]['cart_no'] != "") {393 for ($i = 0; $i <= $max; $i++) { 394 if ($this->cartSession[$productTypeId][$i]['cart_no'] != "") { 395 395 $arrRet[] = $this->cartSession[$productTypeId][$i]['id'][0]; 396 396 } … … 407 407 function getAllProductClassID($productTypeId) { 408 408 $max = $this->getMax($productTypeId); 409 for ($i = 0; $i <= $max; $i++) {410 if ($this->cartSession[$productTypeId][$i]['cart_no'] != "") {409 for ($i = 0; $i <= $max; $i++) { 410 if ($this->cartSession[$productTypeId][$i]['cart_no'] != "") { 411 411 $arrRet[] = $this->cartSession[$productTypeId][$i]['id']; 412 412 } … … 423 423 function delAllProducts($productTypeId) { 424 424 $max = $this->getMax($productTypeId); 425 for ($i = 0; $i <= $max; $i++) {425 for ($i = 0; $i <= $max; $i++) { 426 426 unset($this->cartSession[$productTypeId][$i]); 427 427 } … … 431 431 function delProduct($cart_no, $productTypeId) { 432 432 $max = $this->getMax($productTypeId); 433 for ($i = 0; $i <= $max; $i++) {434 if ($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) {433 for ($i = 0; $i <= $max; $i++) { 434 if ($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) { 435 435 unset($this->cartSession[$productTypeId][$i]); 436 436 } … … 578 578 $total_quantity = $this->getTotalQuantity($productTypeId); 579 579 580 if ($total_quantity >= DELIV_FREE_AMOUNT) {580 if ($total_quantity >= DELIV_FREE_AMOUNT) { 581 581 return true; 582 582 } … … 587 587 if ($arrInfo['free_rule'] > 0) { 588 588 // 小計が無料条件を超えている場合 589 if ($subtotal >= $arrInfo['free_rule']) {589 if ($subtotal >= $arrInfo['free_rule']) { 590 590 return true; 591 591 } … … 659 659 $results['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($total_point, 660 660 $use_point); 661 if ($objCustomer != "") {661 if ($objCustomer != "") { 662 662 // 誕生日月であった場合 663 if ($objCustomer->isBirthMonth()) {663 if ($objCustomer->isBirthMonth()) { 664 664 $results['birth_point'] = BIRTH_MONTH_POINT; 665 665 $results['add_point'] += $results['birth_point']; 666 666 } 667 667 } 668 if ($results['add_point'] < 0) {668 if ($results['add_point'] < 0) { 669 669 $results['add_point'] = 0; 670 670 }
Note: See TracChangeset
for help on using the changeset viewer.