function lfInsertProductClass($arrList, $product_id)
 {
     $objQuery = new SC_Query();
     $objQuery->begin();
     // 既存規格の削除
     $where = "product_id = ?";
     $objQuery->delete("dtb_products_class", $where, array($product_id));
     $cnt = 1;
     // すべての規格を登録する。
     while ($arrList["classcategory_id1:" . $cnt] != "") {
         if ($arrList["check:" . $cnt] == 1) {
             $sqlval = array();
             $sqlval['product_id'] = $product_id;
             $sqlval['classcategory_id1'] = $arrList["classcategory_id1:" . $cnt];
             $sqlval['classcategory_id2'] = $arrList["classcategory_id2:" . $cnt];
             if (strlen($arrList["product_class_id:" . $cnt]) > 0) {
                 $sqlval['product_class_id'] = $arrList["product_class_id:" . $cnt];
             }
             $sqlval['product_code'] = $arrList["product_code:" . $cnt];
             $sqlval['stock'] = $arrList["stock:" . $cnt];
             $sqlval['stock_unlimited'] = $arrList["stock_unlimited:" . $cnt];
             $sqlval['price01'] = $arrList['price01:' . $cnt];
             $sqlval['price02'] = $arrList['price02:' . $cnt];
             $sqlval['creator_id'] = $_SESSION['member_id'];
             $sqlval['create_date'] = "now()";
             $sqlval['update_date'] = "now()";
             // INSERTの実行
             $objQuery->insert("dtb_products_class", $sqlval);
         }
         $cnt++;
     }
     $objQuery->commit();
 }
 static function productSupportinitial($device_id, SC_Query $objQuery)
 {
     $objQuery->delete("cp_dtb_device_products", "device_id=?", (array) $device_id);
     $objQuery->insert("cp_dtb_device_products", array(), array("product_id" => "product_id", "device_id" => "device_id"), array(), "\n                FROM       dtb_product_categories\n                INNER JOIN cp_dtb_device_categories USING(category_id)\n                WHERE      product_id  IN (SELECT product_id FROM cp_dtb_device_products)\n                  AND      device_id   =  ?", (array) $device_id);
     $objQuery->commit();
 }
Ejemplo n.º 3
0
    /**
     * カテゴリ数の登録を行う.
     *
     *
     * @param  SC_Query $objQuery           SC_Query インスタンス
     * @param  boolean  $is_force_all_count 全カテゴリの集計を強制する場合 true
     * @return void
     */
    public function sfCountCategory($objQuery = NULL, $is_force_all_count = false)
    {
        $objProduct = new SC_Product_Ex();
        if ($objQuery == NULL) {
            $objQuery =& SC_Query_Ex::getSingletonInstance();
        }
        $is_out_trans = false;
        if (!$objQuery->inTransaction()) {
            $objQuery->begin();
            $is_out_trans = true;
        }
        //共通のfrom/where文の構築
        $sql_where = SC_Product_Ex::getProductDispConditions('alldtl');
        // 在庫無し商品の非表示
        if (NOSTOCK_HIDDEN) {
            $where_products_class = '(stock >= 1 OR stock_unlimited = 1)';
            $from = $objProduct->alldtlSQL($where_products_class);
        } else {
            $from = 'dtb_products as alldtl';
        }
        //dtb_category_countの構成
        // 各カテゴリに所属する商品の数を集計。集計対象には子カテゴリを含まない。
        //まずテーブル内容の元を取得
        if (!$is_force_all_count) {
            $arrCategoryCountOld = $objQuery->select('category_id,product_count', 'dtb_category_count');
        } else {
            $arrCategoryCountOld = array();
        }
        //各カテゴリ内の商品数を数えて取得
        $sql = <<<__EOS__
            SELECT T1.category_id, count(T2.category_id) as product_count
            FROM dtb_category AS T1
                LEFT JOIN dtb_product_categories AS T2
                    ON T1.category_id = T2.category_id
                LEFT JOIN {$from}
                    ON T2.product_id = alldtl.product_id
            WHERE {$sql_where}
            GROUP BY T1.category_id, T2.category_id
__EOS__;
        $arrCategoryCountNew = $objQuery->getAll($sql);
        // 各カテゴリに所属する商品の数を集計。集計対象には子カテゴリを「含む」。
        //差分を取得して、更新対象カテゴリだけを確認する。
        //各カテゴリ毎のデータ値において以前との差を見る
        //古いデータの構造入れ替え
        $arrOld = array();
        foreach ($arrCategoryCountOld as $item) {
            $arrOld[$item['category_id']] = $item['product_count'];
        }
        //新しいデータの構造入れ替え
        $arrNew = array();
        foreach ($arrCategoryCountNew as $item) {
            $arrNew[$item['category_id']] = $item['product_count'];
        }
        unset($arrCategoryCountOld);
        unset($arrCategoryCountNew);
        $arrDiffCategory_id = array();
        //新しいカテゴリ一覧から見て商品数が異なるデータが無いか確認
        foreach ($arrNew as $cid => $count) {
            if ($arrOld[$cid] != $count) {
                $arrDiffCategory_id[] = $cid;
            }
        }
        //削除カテゴリを想定して、古いカテゴリ一覧から見て商品数が異なるデータが無いか確認。
        foreach ($arrOld as $cid => $count) {
            if ($arrNew[$cid] != $count && $count > 0) {
                $arrDiffCategory_id[] = $cid;
            }
        }
        //対象IDが無ければ終了
        if (count($arrDiffCategory_id) == 0) {
            if ($is_out_trans) {
                $objQuery->commit();
            }
            return;
        }
        //差分対象カテゴリIDの重複を除去
        $arrDiffCategory_id = array_unique($arrDiffCategory_id);
        //dtb_category_countの更新 差分のあったカテゴリだけ更新する。
        foreach ($arrDiffCategory_id as $cid) {
            $sqlval = array();
            $sqlval['create_date'] = 'CURRENT_TIMESTAMP';
            $sqlval['product_count'] = (string) $arrNew[$cid];
            if ($sqlval['product_count'] == '') {
                $sqlval['product_count'] = (string) '0';
            }
            if (isset($arrOld[$cid])) {
                $objQuery->update('dtb_category_count', $sqlval, 'category_id = ?', array($cid));
            } else {
                if ($is_force_all_count) {
                    $ret = $objQuery->update('dtb_category_count', $sqlval, 'category_id = ?', array($cid));
                    if ($ret > 0) {
                        continue;
                    }
                }
                $sqlval['category_id'] = $cid;
                $objQuery->insert('dtb_category_count', $sqlval);
            }
        }
        unset($arrOld);
        unset($arrNew);
        //差分があったIDとその親カテゴリIDのリストを取得する
        $arrTgtCategory_id = array();
        foreach ($arrDiffCategory_id as $parent_category_id) {
            $arrTgtCategory_id[] = $parent_category_id;
            $arrParentID = $this->sfGetParents('dtb_category', 'parent_category_id', 'category_id', $parent_category_id);
            $arrTgtCategory_id = array_unique(array_merge($arrTgtCategory_id, $arrParentID));
        }
        unset($arrDiffCategory_id);
        //dtb_category_total_count 集計処理開始
        //更新対象カテゴリIDだけ集計しなおす。
        $arrUpdateData = array();
        $where_products_class = '';
        if (NOSTOCK_HIDDEN) {
            $where_products_class .= '(stock >= 1 OR stock_unlimited = 1)';
        }
        $from = $objProduct->alldtlSQL($where_products_class);
        foreach ($arrTgtCategory_id as $category_id) {
            $arrWhereVal = array();
            list($tmp_where, $arrTmpVal) = $this->sfGetCatWhere($category_id);
            if ($tmp_where != '') {
                $sql_where_product_ids = 'product_id IN (SELECT product_id FROM dtb_product_categories WHERE ' . $tmp_where . ')';
                $arrWhereVal = $arrTmpVal;
            } else {
                $sql_where_product_ids = '0<>0';
                // 一致させない
            }
            $where = "({$sql_where}) AND ({$sql_where_product_ids})";
            $arrUpdateData[$category_id] = $objQuery->count($from, $where, $arrWhereVal);
        }
        unset($arrTgtCategory_id);
        // 更新対象だけを更新。
        foreach ($arrUpdateData as $cid => $count) {
            $sqlval = array();
            $sqlval['create_date'] = 'CURRENT_TIMESTAMP';
            $sqlval['product_count'] = $count;
            if ($sqlval['product_count'] == '') {
                $sqlval['product_count'] = (string) '0';
            }
            $ret = $objQuery->update('dtb_category_total_count', $sqlval, 'category_id = ?', array($cid));
            if (!$ret) {
                $sqlval['category_id'] = $cid;
                $objQuery->insert('dtb_category_total_count', $sqlval);
            }
        }
        // トランザクション終了処理
        if ($is_out_trans) {
            $objQuery->commit();
        }
    }
 function lfInsertClass()
 {
     $objQuery = new SC_Query();
     $objQuery->begin();
     // 親規格IDの存在チェック
     $where = "del_flg <> 1 AND class_id = ?";
     $ret = $objQuery->get("dtb_class", "class_id", $where, array($_POST['class_id']));
     if ($ret != "") {
         // INSERTする値を作成する。
         $sqlval['name'] = $_POST['name'];
         $sqlval['class_id'] = $_POST['class_id'];
         $sqlval['creator_id'] = $_SESSION['member_id'];
         $sqlval['rank'] = $objQuery->max("dtb_classcategory", "rank", $where, array($_POST['class_id'])) + 1;
         $sqlval['create_date'] = "now()";
         $sqlval['update_date'] = "now()";
         // INSERTの実行
         $ret = $objQuery->insert("dtb_classcategory", $sqlval);
     }
     $objQuery->commit();
     return $ret;
 }
Ejemplo n.º 5
0
<?php

/*
 * This file is part of EC-CUBE
 *
 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
 *
 * http://www.lockon.co.jp/
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once "../../require.php";
$objQuery = new SC_Query();
$objQuery->begin();
$arrCustomerMail = $objQuery->getAll("\nUPDATE dtb_customer\nSET mailmaga_flg = (\nSELECT mail_flag\nFROM dtb_customer_mail\nWHERE dtb_customer.email = dtb_customer_mail.email\n)");
$objQuery->commit();
echo "正常に移行が完了致しました。";
 /**
  * 配送情報を登録する
  *
  * @return $deliv_id 
  */
 function lfRegistData()
 {
     $arrRet = $this->objFormParam->getHashArray();
     $objQuery = new SC_Query();
     $objQuery->begin();
     // 入力データを渡す。
     $sqlval['name'] = $arrRet['name'];
     $sqlval['service_name'] = $arrRet['service_name'];
     $sqlval['confirm_url'] = $arrRet['confirm_url'];
     $sqlval['creator_id'] = $_SESSION['member_id'];
     $sqlval['update_date'] = 'Now()';
     // deliv_id が決まっていた場合
     if ($_POST['deliv_id'] != "") {
         $deliv_id = $_POST['deliv_id'];
         $where = "deliv_id = ?";
         $objQuery->update("dtb_deliv", $sqlval, $where, array($deliv_id));
         // 配送時間の登録
         $table = "dtb_delivtime";
         $where = "deliv_id = ? AND time_id = ?";
         for ($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
             $sqlval = array();
             $keyname = "deliv_time" . $cnt;
             $arrval = array($deliv_id, $cnt * $deliv_id);
             // 既存データの有無を確認
             $curData = $objQuery->select("*", $table, $where, $arrval);
             if (strcmp($arrRet[$keyname], "") != 0) {
                 $sqlval['deliv_time'] = $arrRet[$keyname];
                 // 入力が空ではなく、DBに情報があれば更新
                 if (count($curData)) {
                     $objQuery->update($table, $sqlval, $where, $arrval);
                 } else {
                     $sqlval['deliv_id'] = $deliv_id;
                     $sqlval['time_id'] = $cnt * $deliv_id;
                     $objQuery->insert($table, $sqlval);
                 }
             } else {
                 if (count($curData)) {
                     $objQuery->delete($table, $where, $arrval);
                 }
             }
         }
         // 配送料の登録
         if (INPUT_DELIV_FEE) {
             for ($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
                 $keyname = "fee" . $cnt;
                 if (strcmp($arrRet[$keyname], "") != 0) {
                     $sqlval = array('fee' => $arrRet[$keyname]);
                     $objQuery->update("dtb_delivfee", $sqlval, "deliv_id = ? AND pref = ?", array($deliv_id, $cnt));
                 }
             }
         }
     } else {
         // 登録する配送業者IDの取得
         if (DB_TYPE == "pgsql") {
             $deliv_id = $objQuery->nextval('dtb_deliv', 'deliv_id');
             $sqlval['deliv_id'] = $deliv_id;
         }
         $sqlval['rank'] = $objQuery->max("dtb_deliv", "rank") + 1;
         $sqlval['create_date'] = 'Now()';
         // INSERTの実行
         $objQuery->insert("dtb_deliv", $sqlval);
         if (DB_TYPE == "mysql") {
             $deliv_id = $objQuery->nextval('dtb_deliv', 'deliv_id');
         }
         $sqlval = array();
         // 配送時間の設定
         for ($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++) {
             $keyname = "deliv_time{$cnt}";
             if ($arrRet[$keyname] != "") {
                 $sqlval['deliv_id'] = $deliv_id;
                 $sqlval['time_id'] = $cnt * $deliv_id;
                 $sqlval['deliv_time'] = $arrRet[$keyname];
                 // INSERTの実行
                 $objQuery->insert("dtb_delivtime", $sqlval);
             }
         }
         if (INPUT_DELIV_FEE) {
             $sqlval = array();
             // 配送料金の設定
             for ($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++) {
                 $keyname = "fee{$cnt}";
                 if ($arrRet[$keyname] != "") {
                     $sqlval['deliv_id'] = $deliv_id;
                     $sqlval['fee'] = $arrRet[$keyname];
                     $sqlval['pref'] = $cnt;
                     // INSERTの実行
                     $objQuery->insert("dtb_delivfee", $sqlval);
                 }
             }
         }
     }
     $objQuery->commit();
     return $deliv_id;
 }
 function lfInsertCat($parent_category_id)
 {
     $objQuery = new SC_Query();
     $objQuery->begin();
     // トランザクションの開始
     if ($parent_category_id == 0) {
         // ROOT階層で最大のランクを取得する。
         $where = "parent_category_id = ?";
         $rank = $objQuery->max("dtb_category", "rank", $where, array($parent_category_id)) + 1;
     } else {
         // 親のランクを自分のランクとする。
         $where = "category_id = ?";
         $rank = $objQuery->get("dtb_category", "rank", $where, array($parent_category_id));
         // 追加レコードのランク以上のレコードを一つあげる。
         $sqlup = "UPDATE dtb_category SET rank = (rank + 1) WHERE rank >= ?";
         $objQuery->exec($sqlup, array($rank));
     }
     $where = "category_id = ?";
     // 自分のレベルを取得する(親のレベル + 1)
     $level = $objQuery->get("dtb_category", "level", $where, array($parent_category_id)) + 1;
     // 入力データを渡す。
     $sqlval = $this->objFormParam->getHashArray();
     $sqlval['create_date'] = "Now()";
     $sqlval['update_date'] = "Now()";
     $sqlval['creator_id'] = $_SESSION['member_id'];
     $sqlval['parent_category_id'] = $parent_category_id;
     $sqlval['rank'] = $rank;
     $sqlval['level'] = $level;
     // INSERTの実行
     $objQuery->insert("dtb_category", $sqlval);
     $objQuery->commit();
     // トランザクションの終了
 }
 /**
  * 規格データをコピーする
  *
  * @param  array   $arrList  フォーム入力パラメーター配列
  * @param  SC_Query  $objQuery SC_Queryインスタンス
  * @return boolean エラーフラグ
  */
 public function lfCopyProductClass($arrList, &$objQuery)
 {
     // 複製元のdtb_products_classを取得(規格なしのため、1件のみの取得)
     $col = '*';
     $table = 'dtb_products_class';
     $where = 'product_id = ?';
     $arrProductClass = $objQuery->select($col, $table, $where, array($arrList['copy_product_id']));
     //トランザクション開始
     $objQuery->begin();
     $err_flag = false;
     //非編集項目は複製、編集項目は上書きして登録
     foreach ($arrProductClass as $records) {
         foreach ($records as $key => $value) {
             if (isset($arrList[$key])) {
                 switch ($key) {
                     case 'stock_unlimited':
                         $records[$key] = (int) $arrList[$key];
                         break;
                     default:
                         $records[$key] = $arrList[$key];
                         break;
                 }
             }
         }
         $records['product_class_id'] = $objQuery->nextVal('dtb_products_class_product_class_id');
         $records['update_date'] = 'CURRENT_TIMESTAMP';
         $records['create_date'] = 'CURRENT_TIMESTAMP';
         $objQuery->insert($table, $records);
         //エラー発生時は中断
         if ($objQuery->isError()) {
             $err_flag = true;
             continue;
         }
     }
     //トランザクション終了
     if ($err_flag) {
         $objQuery->rollback();
     } else {
         $objQuery->commit();
     }
     return !$err_flag;
 }
Ejemplo n.º 9
0
 function lfRegistRecommendData($array, $arrRegistColumn)
 {
     // 仮登録
     foreach ($arrRegistColumn as $data) {
         if (strlen($array[$data["column"]]) > 0) {
             $arrRegist[$data["column"]] = $array[$data["column"]];
         }
     }
     $arrRegist['create_date'] = 'now()';
     $arrRegist['update_date'] = 'now()';
     $arrRegist['creator_id'] = '0';
     //-- 登録実行
     $objQuery = new SC_Query();
     $objQuery->begin();
     $objQuery->insert("dtb_review", $arrRegist);
     $objQuery->commit();
 }
Ejemplo n.º 10
0
 function lfRegistFavoriteProduct($customer_id, $product_id)
 {
     $objQuery = new SC_Query();
     $objConn = new SC_DbConn();
     $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer_favorite_products WHERE customer_id = ? AND product_id = ?", array($customer_id, $product_id));
     if ($count == 0) {
         $sqlval['customer_id'] = $customer_id;
         $sqlval['product_id'] = $product_id;
         $sqlval['update_date'] = "now()";
         $sqlval['create_date'] = "now()";
         $objQuery->begin();
         $objQuery->insert('dtb_customer_favorite_products', $sqlval);
         $objQuery->commit();
     }
 }
Ejemplo n.º 11
0
 /**
  * ランクを含むレコードを削除する.
  *
  * レコードごと削除する場合は、$deleteをtrueにする
  *
  * @param string $table テーブル名
  * @param string $colname カラム名
  * @param string|integer $id テーブルのキー
  * @param string $andwhere SQL の AND 条件である WHERE 句
  * @param bool $delete レコードごと削除する場合 true,
  *                     レコードごと削除しない場合 false
  * @return void
  */
 function sfDeleteRankRecord($table, $colname, $id, $andwhere = "", $delete = false)
 {
     $objQuery = new SC_Query();
     $objQuery->begin();
     // 削除レコードのランクを取得する。
     $where = "{$colname} = ?";
     if ($andwhere != "") {
         $where .= " AND {$andwhere}";
     }
     $rank = $objQuery->get($table, "rank", $where, array($id));
     if (!$delete) {
         // ランクを最下位にする、DELフラグON
         $sqlup = "UPDATE {$table} SET rank = 0, del_flg = 1 ";
         $sqlup .= "WHERE {$colname} = ?";
         // UPDATEの実行
         $objQuery->exec($sqlup, array($id));
     } else {
         $objQuery->delete($table, "{$colname} = ?", array($id));
     }
     // 追加レコードのランクより上のレコードを一つずらす。
     $where = "rank > ?";
     if ($andwhere != "") {
         $where .= " AND {$andwhere}";
     }
     $sqlup = "UPDATE {$table} SET rank = (rank - 1) WHERE {$where}";
     $objQuery->exec($sqlup, array($rank));
     $objQuery->commit();
 }
Ejemplo n.º 12
0
 function lfRegistData($array)
 {
     $objQuery = new SC_Query();
     $this->arrInfo;
     do {
         $secret = SC_Utils_Ex::sfGetUniqRandomId("r");
     } while (($result = $objQuery->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($secret))) != 0);
     $sql = "SELECT email FROM dtb_customer WHERE secret_key = ? AND status = 1";
     $email = $objQuery->getOne($sql, array($array["id"]));
     $objQuery->begin();
     $arrRegist["secret_key"] = $secret;
     // 本登録ID発行
     $arrRegist["status"] = 2;
     $arrRegist["update_date"] = "NOW()";
     $where = "secret_key = ? AND status = 1";
     $arrRet = $objQuery->select("point", "dtb_customer", $where, array($array["id"]));
     // 会員登録時の加算ポイント(購入時会員登録の場合は、ポイント加算)
     $arrRegist['point'] = $arrRet[0]['point'] + $arrInfo['welcome_point'];
     $objQuery->update("dtb_customer", $arrRegist, $where, array($array["id"]));
     /* 購入時の自動会員登録は行わないためDEL
        // 購入時登録の場合、その回の購入を会員購入とみなす。
        // 会員情報の読み込み
        $where1 = "secret_key = ? AND status = 2";
        $customer = $objQuery->select("*", "dtb_customer", $where1, array($secret));
        // 初回購入情報の読み込み
        $order_temp_id = $objQuery->get("dtb_order_temp", "order_temp_id");
        // 購入情報の更新
        if ($order_temp_id != null) {
            $arrCustomer['customer_id'] = $customer[0]['customer_id'];
            $where3 = "order_temp_id = ?";
            $objQuery->update("dtb_order_temp", $arrCustomer, $where3, array($order_temp_id));
            $objQuery->update("dtb_order", $arrCustomer, $where3, array($order_temp_id));
        }
        */
     $sql = "SELECT mailmaga_flg FROM dtb_customer WHERE email = ?";
     $result = $objQuery->getOne($sql, array($email));
     switch ($result) {
         // 仮HTML
         case '4':
             $arrRegistMail["mailmaga_flg"] = 1;
             break;
             // 仮TEXT
         // 仮TEXT
         case '5':
             $arrRegistMail["mailmaga_flg"] = 2;
             break;
             // 仮なし
         // 仮なし
         case '6':
             $arrRegistMail["mailmaga_flg"] = 3;
             break;
         default:
             $arrRegistMail["mailmaga_flg"] = $result;
             break;
     }
     $objQuery->update("dtb_customer", $arrRegistMail, "email = " . SC_Utils_Ex::sfQuoteSmart($email) . " AND del_flg = 0");
     $objQuery->commit();
     return $secret;
     // 本登録IDを返す
 }
Ejemplo n.º 13
0
 function lfRegistNewData()
 {
     $objQuery = new SC_Query();
     $objQuery->begin();
     // 入力データを渡す。
     $arrRet = $this->objFormParam->getHashArray();
     foreach ($arrRet as $key => $val) {
         // 配列は登録しない
         if (!is_array($val)) {
             $sqlval[$key] = $val;
         }
     }
     // postgresqlとmysqlとで処理を分ける
     if (DB_TYPE == "pgsql") {
         $order_id = $objQuery->nextval("dtb_order", "order_id");
     } elseif (DB_TYPE == "mysql") {
         $order_id = $objQuery->get_auto_increment("dtb_order");
     }
     $sqlval['order_id'] = $order_id;
     $sqlval['create_date'] = "Now()";
     // 注文ステータス:指定が無ければ新規受付に設定
     if ($sqlval["status"] == "") {
         $sqlval['status'] = '1';
     }
     // customer_id
     if ($sqlval["customer_id"] == "") {
         $sqlval['customer_id'] = '0';
     }
     unset($sqlval['total_point']);
     unset($sqlval['point']);
     $where = "order_id = ?";
     // 受注ステータスの判定
     if ($sqlval['status'] == ODERSTATUS_COMMIT) {
         // 受注テーブルの発送済み日を更新する
         $sqlval['commit_date'] = "Now()";
     }
     // 受注テーブルの登録
     $objQuery->insert("dtb_order", $sqlval);
     $sql = "";
     $sql .= " UPDATE";
     $sql .= "     dtb_order";
     $sql .= " SET";
     $sql .= "     payment_method = (SELECT payment_method FROM dtb_payment WHERE payment_id = ?)";
     $sql .= "     ,deliv_time = (SELECT deliv_time FROM dtb_delivtime WHERE time_id = ? AND deliv_id = (SELECT deliv_id FROM dtb_payment WHERE payment_id = ? ))";
     $sql .= " WHERE order_id = ?";
     if ($arrRet['deliv_time_id'] == "") {
         $deliv_time_id = 0;
     } else {
         $deliv_time_id = $arrRet['deliv_time_id'];
     }
     $arrUpdData = array($arrRet['payment_id'], $deliv_time_id, $arrRet['payment_id'], $order_id);
     $objQuery->query($sql, $arrUpdData);
     // 受注詳細データの更新
     $arrDetail = $this->objFormParam->getSwapArray(array("product_id", "product_code", "product_name", "price", "quantity", "point_rate", "classcategory_id1", "classcategory_id2", "classcategory_name1", "classcategory_name2"));
     $objQuery->delete("dtb_order_detail", $where, array($order_id));
     $max = count($arrDetail);
     for ($i = 0; $i < $max; $i++) {
         $sqlval = array();
         $sqlval['order_id'] = $order_id;
         $sqlval['product_id'] = $arrDetail[$i]['product_id'];
         $sqlval['product_code'] = $arrDetail[$i]['product_code'];
         $sqlval['product_name'] = $arrDetail[$i]['product_name'];
         $sqlval['price'] = $arrDetail[$i]['price'];
         $sqlval['quantity'] = $arrDetail[$i]['quantity'];
         $sqlval['point_rate'] = $arrDetail[$i]['point_rate'];
         $sqlval['classcategory_id1'] = $arrDetail[$i]['classcategory_id1'];
         $sqlval['classcategory_id2'] = $arrDetail[$i]['classcategory_id2'];
         $sqlval['classcategory_name1'] = $arrDetail[$i]['classcategory_name1'];
         $sqlval['classcategory_name2'] = $arrDetail[$i]['classcategory_name2'];
         $objQuery->insert("dtb_order_detail", $sqlval);
     }
     $objQuery->commit();
     return $order_id;
 }
Ejemplo n.º 14
0
 function lfDeleteFavoriteProduct($customer_id, $product_id)
 {
     $objQuery = new SC_Query();
     $objConn = new SC_DbConn();
     $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer_favorite_products WHERE customer_id = ? AND product_id = ?", array($customer_id, $product_id));
     if ($count > 0) {
         $where = "customer_id = ? AND product_id = ?";
         $sqlval['customer_id'] = $customer_id;
         $sqlval['product_id'] = $product_id;
         $objQuery->begin();
         $objQuery->delete('dtb_customer_favorite_products', $where, $sqlval);
         $objQuery->commit();
     }
 }