Changeset 18007 for branches/version-2/data/class/helper/SC_Helper_DB.php
- Timestamp:
- 2009/05/15 16:30:40 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2/data/class/helper/SC_Helper_DB.php
r17655 r18007 294 294 $objPage->tpl_total_pretax = 0; // 費用合計(税込み) 295 295 $objPage->tpl_total_tax = 0; // 消費税合計 296 $objPage->tpl_total_point = 0; // ポイント合計 296 if (USE_POINT === true) { 297 $objPage->tpl_total_point = 0; // ポイント合計 298 } 297 299 298 300 // カート内情報の取得 … … 370 372 } 371 373 // ポイント付与率の登録 372 $objCartSess->setProductValue($arrCart[$i]['id'], 'point_rate', $arrData['point_rate']); 374 if (USE_POINT === true) { 375 $objCartSess->setProductValue($arrCart[$i]['id'], 'point_rate', $arrData['point_rate']); 376 } 373 377 // 商品ごとの合計金額 374 378 $objPage->arrProductsClass[$cnt]['total_pretax'] = $objCartSess->getProductTotal($arrInfo, $arrCart[$i]['id']); … … 387 391 $objPage->tpl_total_tax = $objCartSess->getAllProductsTax($arrInfo); 388 392 // 全商品合計ポイント 389 $objPage->tpl_total_point = $objCartSess->getAllProductsPoint(); 393 if (USE_POINT === true) { 394 $objPage->tpl_total_point = $objCartSess->getAllProductsPoint(); 395 } 390 396 391 397 return $objPage; … … 509 515 $customer_id = $arrRet[0]['customer_id']; 510 516 if($customer_id != "" && $customer_id >= 1) { 511 $arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id)); 512 $point = $arrRet[0]['point']; 513 $total_point = $arrRet[0]['point'] - $use_point + $add_point; 517 if (USE_POINT === true) { 518 $arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id)); 519 $point = $arrRet[0]['point']; 520 $total_point = $arrRet[0]['point'] - $use_point + $add_point; 521 } else { 522 $total_point = ""; 523 $point = ""; 524 } 514 525 } else { 515 $total_point = "";516 $point = "";526 $total_point = 0; 527 $point = 0; 517 528 } 518 529 return array($point, $total_point); 519 530 } 520 531 532 /** 533 * 顧客番号、利用ポイント、加算ポイントから最終ポイントを取得する. 534 * 535 * @param integer $customer_id 顧客番号 536 * @param integer $use_point 利用ポイント 537 * @param integer $add_point 加算ポイント 538 * @return array 最終ポイントの配列 539 */ 540 function sfGetCustomerPointFromCid($customer_id, $use_point, $add_point) { 541 $objQuery = new SC_Query(); 542 if (USE_POINT === true) { 543 $arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id)); 544 $point = $arrRet[0]['point']; 545 $total_point = $arrRet[0]['point'] - $use_point + $add_point; 546 } else { 547 $total_point = 0; 548 $point = 0; 549 } 550 return array($point, $total_point); 551 } 521 552 /** 522 553 * カテゴリツリーの取得を行う. … … 593 624 $arrRet = $objQuery->select($col, $from, $where); 594 625 595 $arrCategory_id = $this->sfGetCategoryId($product_id , $status);626 $arrCategory_id = $this->sfGetCategoryId($product_id); 596 627 597 628 $arrCatTree = array(); … … 1199 1230 1200 1231 // 自身のランクを取得する 1201 $rank = $objQuery->get($tableName, "rank", "$keyIdColumn = ? ", array($keyId));1232 $rank = $objQuery->get($tableName, "rank", "$keyIdColumn = ? AND " . $where, array($keyId)); 1202 1233 1203 1234 $max = $objQuery->max($tableName, "rank", $where); 1204 1235 // 値の調整(逆順) 1205 1236 if($pos > $max) { 1206 1237 $position = 1; … … 1210 1241 $position = $max - $pos + 1; 1211 1242 } 1212 1243 1213 1244 //入れ替え先の順位が入れ換え元の順位より大きい場合 1214 1245 if( $position > $rank ) $term = "rank - 1"; … … 1225 1256 $sql.= " AND $where"; 1226 1257 } 1227 1258 if( $position > $rank ) $objQuery->exec( $sql, array($rank, $position)); 1228 1259 if( $position < $rank ) $objQuery->exec( $sql, array($position, $rank)); 1229 1260 // 指定した順位へrankを書き換える。 1230 1261 $sql = "UPDATE $tableName SET rank = ? WHERE $keyIdColumn = ? "; 1231 1262 if($where != "") { 1232 1263 $sql.= " AND $where"; 1233 1264 } 1234 1265 $objQuery->exec( $sql, array( $position, $keyId ) ); 1235 1266 $objQuery->commit(); 1236 1267 } … … 1374 1405 * @return string 指定の都道府県, 支払い方法の配送料金 1375 1406 */ 1376 function sfGetDelivFee($pref, $payment_id = "") { 1407 function sfGetDelivFee($arrData) { 1408 $pref = $arrData['deliv_pref']; 1409 $payment_id = isset($arrData['payment_id']) ? $arrData['payment_id'] : ""; 1410 1377 1411 $objQuery = new SC_Query(); 1378 1412 … … 1444 1478 if (OPTION_DELIV_FEE == 1) { 1445 1479 // 送料の合計を計算する 1446 $arrData['deliv_fee'] 1447 += $this->sfGetDelivFee($arrData['deliv_pref'], 1448 $arrData['payment_id']); 1449 1480 $arrData['deliv_fee'] += $this->sfGetDelivFee($arrData); 1450 1481 } 1451 1482 … … 1472 1503 $arrData['payment_total'] = $arrData['total'] - ($arrData['use_point'] * POINT_VALUE); 1473 1504 // 加算ポイントの計算 1474 $arrData['add_point'] = SC_Utils::sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point'], $arrInfo); 1475 1476 if($objCustomer != "") { 1477 // 誕生日月であった場合 1478 if($objCustomer->isBirthMonth()) { 1479 $arrData['birth_point'] = BIRTH_MONTH_POINT; 1480 $arrData['add_point'] += $arrData['birth_point']; 1505 if (USE_POINT === false) { 1506 $arrData['add_point'] = 0; 1507 } else { 1508 $arrData['add_point'] = SC_Utils::sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point'], $arrInfo); 1509 1510 if($objCustomer != "") { 1511 // 誕生日月であった場合 1512 if($objCustomer->isBirthMonth()) { 1513 $arrData['birth_point'] = BIRTH_MONTH_POINT; 1514 $arrData['add_point'] += $arrData['birth_point']; 1515 } 1481 1516 } 1482 1517 }
Note: See TracChangeset
for help on using the changeset viewer.