- Timestamp:
- 2012/02/11 05:48:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/helper/SC_Helper_DB.php
r21479 r21481 137 137 $arrRet = $objQuery->select('*', 'dtb_baseinfo'); 138 138 } else { 139 $arrRet = $objQuery->select($col, "dtb_baseinfo");139 $arrRet = $objQuery->select($col, 'dtb_baseinfo'); 140 140 } 141 141 … … 158 158 $objQuery =& SC_Query_Ex::getSingletonInstance(); 159 159 160 return $objQuery->count( "dtb_baseinfo");160 return $objQuery->count('dtb_baseinfo'); 161 161 } 162 162 … … 212 212 function sfGetRollbackPoint($order_id, $use_point, $add_point, $order_status) { 213 213 $objQuery = new SC_Query_Ex(); 214 $arrRet = $objQuery->select( "customer_id", "dtb_order", "order_id = ?", array($order_id));214 $arrRet = $objQuery->select('customer_id', 'dtb_order', "order_id = ?", array($order_id)); 215 215 $customer_id = $arrRet[0]['customer_id']; 216 216 if ($customer_id != "" && $customer_id >= 1) { 217 $arrRet = $objQuery->select('point', "dtb_customer", "customer_id = ?", array($customer_id));217 $arrRet = $objQuery->select('point', 'dtb_customer', "customer_id = ?", array($customer_id)); 218 218 $point = $arrRet[0]['point']; 219 219 $rollback_point = $arrRet[0]['point']; … … 361 361 // 商品が属するカテゴリIDを縦に取得 362 362 $objQuery =& SC_Query_Ex::getSingletonInstance(); 363 $arrCatID = $this->sfGetParents( "dtb_category", "parent_category_id", "category_id", $category_id);363 $arrCatID = $this->sfGetParents('dtb_category', 'parent_category_id', 'category_id', $category_id); 364 364 $ConbName = ""; 365 365 … … 403 403 $objQuery =& SC_Query_Ex::getSingletonInstance(); 404 404 $arrRet = array(); 405 $arrCatID = $this->sfGetParents( "dtb_category", "parent_category_id", "category_id", $category_id);405 $arrCatID = $this->sfGetParents('dtb_category', 'parent_category_id', 'category_id', $category_id); 406 406 $arrRet['id'] = $arrCatID[0]; 407 407 … … 440 440 } else { 441 441 $col = "category_id, category_name, level"; 442 $from = "dtb_category";442 $from = 'dtb_category'; 443 443 } 444 444 … … 469 469 $where = "del_flg = 0"; 470 470 $objQuery->setOption("ORDER BY level"); 471 $arrRet = $objQuery->select($col, "dtb_category", $where);471 $arrRet = $objQuery->select($col, 'dtb_category', $where); 472 472 $arrCatName = array(); 473 473 foreach ($arrRet as $arrTmp) { … … 481 481 $where = "del_flg = 0"; 482 482 $objQuery->setOption("ORDER BY rank DESC"); 483 $arrRet = $objQuery->select($col, "dtb_category", $where);483 $arrRet = $objQuery->select($col, 'dtb_category', $where); 484 484 $max = count($arrRet); 485 485 … … 517 517 $category_id = (int) $category_id; 518 518 $product_id = (int) $product_id; 519 if (SC_Utils_Ex::sfIsInt($category_id) && $category_id != 0 && SC_Helper_DB_Ex::sfIsRecord( "dtb_category","category_id", $category_id)) {519 if (SC_Utils_Ex::sfIsInt($category_id) && $category_id != 0 && SC_Helper_DB_Ex::sfIsRecord('dtb_category','category_id', $category_id)) { 520 520 $category_id = array($category_id); 521 } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && SC_Helper_DB_Ex::sfIsRecord( "dtb_products","product_id", $product_id, $status)) {521 } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && SC_Helper_DB_Ex::sfIsRecord('dtb_products','product_id', $product_id, $status)) { 522 522 $objQuery =& SC_Query_Ex::getSingletonInstance(); 523 523 $where = "product_id = ?"; 524 $category_id = $objQuery->getCol( "category_id", "dtb_product_categories", "product_id = ?", array($product_id));524 $category_id = $objQuery->getCol('category_id', 'dtb_product_categories', "product_id = ?", array($product_id)); 525 525 } else { 526 526 // 不正な場合は、空の配列を返す。 … … 539 539 function addProductBeforCategories($category_id, $product_id) { 540 540 541 $sqlval = array( "category_id"=> $category_id,542 "product_id"=> $product_id);541 $sqlval = array('category_id' => $category_id, 542 'product_id' => $product_id); 543 543 544 544 $objQuery =& SC_Query_Ex::getSingletonInstance(); … … 546 546 // 現在の商品カテゴリを取得 547 547 $arrCat = $objQuery->select("product_id, category_id, rank", 548 "dtb_product_categories",548 'dtb_product_categories', 549 549 "category_id = ?", 550 550 array($category_id)); 551 551 552 $max = "0";552 $max = '0'; 553 553 foreach ($arrCat as $val) { 554 554 // 同一商品が存在する場合は登録しない 555 if ($val[ "product_id"] == $product_id) {555 if ($val['product_id'] == $product_id) { 556 556 return; 557 557 } … … 560 560 } 561 561 $sqlval['rank'] = $max + 1; 562 $objQuery->insert( "dtb_product_categories", $sqlval);562 $objQuery->insert('dtb_product_categories', $sqlval); 563 563 } 564 564 … … 571 571 */ 572 572 function addProductAfterCategories($category_id, $product_id) { 573 $sqlval = array( "category_id"=> $category_id,574 "product_id"=> $product_id);573 $sqlval = array('category_id' => $category_id, 574 'product_id' => $product_id); 575 575 576 576 $objQuery =& SC_Query_Ex::getSingletonInstance(); … … 578 578 // 現在の商品カテゴリを取得 579 579 $arrCat = $objQuery->select("product_id, category_id, rank", 580 "dtb_product_categories",580 'dtb_product_categories', 581 581 "category_id = ?", 582 582 array($category_id)); … … 585 585 foreach ($arrCat as $val) { 586 586 // 同一商品が存在する場合は登録しない 587 if ($val[ "product_id"] == $product_id) {587 if ($val['product_id'] == $product_id) { 588 588 return; 589 589 } … … 592 592 } 593 593 $sqlval['rank'] = $min; 594 $objQuery->insert( "dtb_product_categories", $sqlval);594 $objQuery->insert('dtb_product_categories', $sqlval); 595 595 } 596 596 … … 604 604 function removeProductByCategories($category_id, $product_id) { 605 605 $objQuery =& SC_Query_Ex::getSingletonInstance(); 606 $objQuery->delete( "dtb_product_categories",606 $objQuery->delete('dtb_product_categories', 607 607 "category_id = ? AND product_id = ?", array($category_id, $product_id)); 608 608 } … … 620 620 // 現在のカテゴリ情報を取得 621 621 $arrCurrentCat = $objQuery->select("product_id, category_id, rank", 622 "dtb_product_categories",622 'dtb_product_categories', 623 623 "product_id = ?", 624 624 array($product_id)); … … 628 628 629 629 // 登録しないカテゴリを削除 630 if (!in_array($val[ "category_id"], $arrCategory_id)) {631 $this->removeProductByCategories($val[ "category_id"], $product_id);630 if (!in_array($val['category_id'], $arrCategory_id)) { 631 $this->removeProductByCategories($val['category_id'], $product_id); 632 632 } 633 633 } … … 897 897 $ret = $id; 898 898 899 while ($ret != "0"&& !SC_Utils_Ex::isBlank($ret)) {899 while ($ret != '0' && !SC_Utils_Ex::isBlank($ret)) { 900 900 $arrParents[] = $ret; 901 901 $ret = SC_Helper_DB_Ex::sfGetParentsArraySub($table, $pid_name, $id_name, $ret); … … 928 928 function sfGetCatWhere($category_id) { 929 929 // 子カテゴリIDの取得 930 $arrRet = SC_Helper_DB_Ex::sfGetChildrenArray( "dtb_category", "parent_category_id", "category_id", $category_id);930 $arrRet = SC_Helper_DB_Ex::sfGetChildrenArray('dtb_category', 'parent_category_id', 'category_id', $category_id); 931 931 932 932 $where = "category_id IN (" . implode(',', array_fill(0, count($arrRet), '?')) . ")"; … … 1311 1311 $maker_id = (int) $maker_id; 1312 1312 $product_id = (int) $product_id; 1313 if (SC_Utils_Ex::sfIsInt($maker_id) && $maker_id != 0 && $this->sfIsRecord( "dtb_maker","maker_id", $maker_id)) {1313 if (SC_Utils_Ex::sfIsInt($maker_id) && $maker_id != 0 && $this->sfIsRecord('dtb_maker','maker_id', $maker_id)) { 1314 1314 $this->g_maker_id = array($maker_id); 1315 } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && $this->sfIsRecord( "dtb_products","product_id", $product_id, $status)) {1315 } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && $this->sfIsRecord('dtb_products','product_id', $product_id, $status)) { 1316 1316 $objQuery =& SC_Query_Ex::getSingletonInstance(); 1317 1317 $where = "product_id = ?"; 1318 $maker_id = $objQuery->getCol( "maker_id", "dtb_products", "product_id = ?", array($product_id));1318 $maker_id = $objQuery->getCol('maker_id', 'dtb_products', "product_id = ?", array($product_id)); 1319 1319 $this->g_maker_id = $maker_id; 1320 1320 } else { … … 1351 1351 } else { 1352 1352 $col = "maker_id, name"; 1353 $from = "dtb_maker";1353 $from = 'dtb_maker'; 1354 1354 } 1355 1355
Note: See TracChangeset
for help on using the changeset viewer.