当前位置: 首页>>代码示例>>PHP>>正文


PHP SC_Helper_DB_Ex::updateProductCategories方法代码示例

本文整理汇总了PHP中SC_Helper_DB_Ex::updateProductCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Helper_DB_Ex::updateProductCategories方法的具体用法?PHP SC_Helper_DB_Ex::updateProductCategories怎么用?PHP SC_Helper_DB_Ex::updateProductCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SC_Helper_DB_Ex的用法示例。


在下文中一共展示了SC_Helper_DB_Ex::updateProductCategories方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: lfRegistProduct

 function lfRegistProduct($arrList)
 {
     $objQuery = new SC_Query();
     $objDb = new SC_Helper_DB_Ex();
     $objQuery->begin();
     // 配列の添字を定義
     $checkArray = array("name", "status", "product_flag", "main_list_comment", "main_comment", "point_rate", "deliv_fee", "comment1", "comment2", "comment3", "comment4", "comment5", "comment6", "main_list_comment", "sale_limit", "sale_unlimited", "deliv_date_id", "note");
     $arrList = SC_Utils_Ex::arrayDefineIndexes($arrList, $checkArray);
     // INSERTする値を作成する。
     $sqlval['name'] = $arrList['name'];
     $sqlval['status'] = $arrList['status'];
     $sqlval['product_flag'] = $arrList['product_flag'];
     $sqlval['main_list_comment'] = $arrList['main_list_comment'];
     $sqlval['main_comment'] = $arrList['main_comment'];
     $sqlval['point_rate'] = $arrList['point_rate'];
     $sqlval['deliv_fee'] = $arrList['deliv_fee'];
     $sqlval['comment1'] = $arrList['comment1'];
     $sqlval['comment2'] = $arrList['comment2'];
     $sqlval['comment3'] = $arrList['comment3'];
     $sqlval['comment4'] = $arrList['comment4'];
     $sqlval['comment5'] = $arrList['comment5'];
     $sqlval['comment6'] = $arrList['comment6'];
     $sqlval['main_list_comment'] = $arrList['main_list_comment'];
     $sqlval['sale_limit'] = $arrList['sale_limit'];
     $sqlval['sale_unlimited'] = $arrList['sale_unlimited'];
     $sqlval['deliv_date_id'] = $arrList['deliv_date_id'];
     $sqlval['note'] = $arrList['note'];
     $sqlval['update_date'] = "Now()";
     $sqlval['creator_id'] = $_SESSION['member_id'];
     $arrRet = $this->objUpFile->getDBFileList();
     $sqlval = array_merge($sqlval, $arrRet);
     $arrList['category_id'] = unserialize($arrList['category_id']);
     for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
         $sqlval['sub_title' . $cnt] = $arrList['sub_title' . $cnt];
         $sqlval['sub_comment' . $cnt] = $arrList['sub_comment' . $cnt];
     }
     if ($arrList['product_id'] == "") {
         // product_id 取得(PostgreSQLの場合)
         if (DB_TYPE == 'pgsql') {
             $product_id = $objQuery->nextval("dtb_products", "product_id");
             $sqlval['product_id'] = $product_id;
         }
         // INSERTの実行
         $sqlval['create_date'] = "Now()";
         $objQuery->insert("dtb_products", $sqlval);
         // product_id 取得(MySQLの場合)
         if (DB_TYPE == 'mysql') {
             $product_id = $objQuery->nextval("dtb_products", "product_id");
         }
         // カテゴリを更新
         $objDb->updateProductCategories($arrList['category_id'], $product_id);
         // コピー商品の場合には規格もコピーする
         if ($_POST["copy_product_id"] != "" and SC_Utils_Ex::sfIsInt($_POST["copy_product_id"])) {
             if ($this->tpl_nonclass) {
                 //規格なしの場合、コピーは価格等の入力が発生しているため、その内容で追加登録を行う
                 $arrList['product_id'] = $product_id;
                 $this->lfCopyProductClass($arrList, $objQuery);
             } else {
                 //規格がある場合のコピーは複製元の内容で追加登録を行う
                 // dtb_products_class のカラムを取得
                 $dbFactory = SC_DB_DBFactory_Ex::getInstance();
                 $arrColList = $dbFactory->sfGetColumnList("dtb_products_class", $objQuery);
                 $arrColList_tmp = array_flip($arrColList);
                 // コピーしない列
                 unset($arrColList[$arrColList_tmp["product_class_id"]]);
                 //規格ID
                 unset($arrColList[$arrColList_tmp["product_id"]]);
                 //商品ID
                 unset($arrColList[$arrColList_tmp["create_date"]]);
                 $col = SC_Utils_Ex::sfGetCommaList($arrColList);
                 $objQuery->query("INSERT INTO dtb_products_class (product_id, create_date, " . $col . ") SELECT ?, now(), " . $col . " FROM dtb_products_class WHERE product_id = ? ORDER BY product_class_id", array($product_id, $_POST["copy_product_id"]));
             }
         }
     } else {
         $product_id = $arrList['product_id'];
         // 削除要求のあった既存ファイルの削除
         $arrRet = $this->lfGetProduct($arrList['product_id']);
         $this->objUpFile->deleteDBFile($arrRet);
         // UPDATEの実行
         $where = "product_id = ?";
         $objQuery->update("dtb_products", $sqlval, $where, array($product_id));
         // カテゴリを更新
         $objDb->updateProductCategories($arrList['category_id'], $product_id);
     }
     //商品登録の時は規格を生成する。複製の場合は規格も複製されるのでこの処理は不要。
     if ($_POST["copy_product_id"] == "") {
         // 規格登録
         SC_Utils_Ex::sfInsertProductClass($objQuery, $arrList, $product_id, $arrList['product_class_id']);
     }
     // おすすめ商品登録
     $this->lfInsertRecommendProducts($objQuery, $arrList, $product_id);
     $objQuery->commit();
     return $product_id;
 }
开发者ID:RyotaKaji,项目名称:eccube-2.4.1,代码行数:94,代码来源:LC_Page_Admin_Products_Product.php

示例2: lfRegistProduct

 /**
  * DBに商品データを登録する
  *
  * @param object $objUpFile SC_UploadFileインスタンス
  * @param object $objDownFile SC_UploadFileインスタンス
  * @param array $arrList フォーム入力パラメーター配列
  * @return integer 登録商品ID
  */
 function lfRegistProduct(&$objUpFile, &$objDownFile, $arrList)
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objDb = new SC_Helper_DB_Ex();
     // 配列の添字を定義
     $checkArray = array('name', 'status', 'main_list_comment', 'main_comment', 'deliv_fee', 'comment1', 'comment2', 'comment3', 'comment4', 'comment5', 'comment6', 'sale_limit', 'deliv_date_id', 'maker_id', 'note');
     $arrList = SC_Utils_Ex::arrayDefineIndexes($arrList, $checkArray);
     // INSERTする値を作成する。
     $sqlval['name'] = $arrList['name'];
     $sqlval['status'] = $arrList['status'];
     $sqlval['main_list_comment'] = $arrList['main_list_comment'];
     $sqlval['main_comment'] = $arrList['main_comment'];
     $sqlval['comment1'] = $arrList['comment1'];
     $sqlval['comment2'] = $arrList['comment2'];
     $sqlval['comment3'] = $arrList['comment3'];
     $sqlval['comment4'] = $arrList['comment4'];
     $sqlval['comment5'] = $arrList['comment5'];
     $sqlval['comment6'] = $arrList['comment6'];
     $sqlval['deliv_date_id'] = $arrList['deliv_date_id'];
     $sqlval['maker_id'] = $arrList['maker_id'];
     $sqlval['note'] = $arrList['note'];
     $sqlval['update_date'] = 'CURRENT_TIMESTAMP';
     $sqlval['creator_id'] = $_SESSION['member_id'];
     $arrRet = $objUpFile->getDBFileList();
     $sqlval = array_merge($sqlval, $arrRet);
     for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
         $sqlval['sub_title' . $cnt] = $arrList['sub_title' . $cnt];
         $sqlval['sub_comment' . $cnt] = $arrList['sub_comment' . $cnt];
     }
     $objQuery->begin();
     // 新規登録(複製時を含む)
     if ($arrList['product_id'] == '') {
         $product_id = $objQuery->nextVal('dtb_products_product_id');
         $sqlval['product_id'] = $product_id;
         // INSERTの実行
         $sqlval['create_date'] = 'CURRENT_TIMESTAMP';
         $objQuery->insert('dtb_products', $sqlval);
         $arrList['product_id'] = $product_id;
         // カテゴリを更新
         $objDb->updateProductCategories($arrList['category_id'], $product_id);
         // 複製商品の場合には規格も複製する
         if ($arrList['copy_product_id'] != '' && SC_Utils_Ex::sfIsInt($arrList['copy_product_id'])) {
             if (!$arrList['has_product_class']) {
                 //規格なしの場合、複製は価格等の入力が発生しているため、その内容で追加登録を行う
                 $this->lfCopyProductClass($arrList, $objQuery);
             } else {
                 //規格がある場合の複製は複製元の内容で追加登録を行う
                 // dtb_products_class のカラムを取得
                 $dbFactory = SC_DB_DBFactory_Ex::getInstance();
                 $arrColList = $objQuery->listTableFields('dtb_products_class');
                 $arrColList_tmp = array_flip($arrColList);
                 // 複製しない列
                 unset($arrColList[$arrColList_tmp['product_class_id']]);
                 //規格ID
                 unset($arrColList[$arrColList_tmp['product_id']]);
                 //商品ID
                 unset($arrColList[$arrColList_tmp['create_date']]);
                 // 複製元商品の規格データ取得
                 $col = SC_Utils_Ex::sfGetCommaList($arrColList);
                 $table = 'dtb_products_class';
                 $where = 'product_id = ?';
                 $objQuery->setOrder('product_class_id');
                 $arrProductsClass = $objQuery->select($col, $table, $where, array($arrList['copy_product_id']));
                 // 規格データ登録
                 $objQuery =& SC_Query_Ex::getSingletonInstance();
                 foreach ($arrProductsClass as $arrData) {
                     $sqlval = $arrData;
                     $sqlval['product_class_id'] = $objQuery->nextVal('dtb_products_class_product_class_id');
                     $sqlval['deliv_fee'] = $arrList['deliv_fee'];
                     $sqlval['point_rate'] = $arrList['point_rate'];
                     $sqlval['sale_limit'] = $arrList['sale_limit'];
                     $sqlval['product_id'] = $product_id;
                     $sqlval['create_date'] = 'CURRENT_TIMESTAMP';
                     $sqlval['update_date'] = 'CURRENT_TIMESTAMP';
                     $objQuery->insert($table, $sqlval);
                 }
             }
         }
         // 更新
     } else {
         $product_id = $arrList['product_id'];
         // 削除要求のあった既存ファイルの削除
         $arrRet = $this->lfGetProductData_FromDB($arrList['product_id']);
         // TODO: SC_UploadFile::deleteDBFileの画像削除条件見直し要
         $objImage = new SC_Image_Ex($objUpFile->temp_dir);
         $arrKeyName = $objUpFile->keyname;
         $arrSaveFile = $objUpFile->save_file;
         $arrImageKey = array();
         foreach ($arrKeyName as $key => $keyname) {
             if ($arrRet[$keyname] && !$arrSaveFile[$key]) {
                 $arrImageKey[] = $keyname;
                 $has_same_image = $this->lfHasSameProductImage($arrList['product_id'], $arrImageKey, $arrRet[$keyname]);
//.........这里部分代码省略.........
开发者ID:Rise-Up-Cambodia,项目名称:Rise-Up,代码行数:101,代码来源:LC_Page_Admin_Products_Product.php

示例3: lfRegistProduct

 /**
  * 商品登録を行う.
  *
  * @param SC_Query $objQuery SC_Queryインスタンス
  * @param string|integer $line 処理中の行数
  * @return void
  */
 function lfRegistProduct($objQuery, $line = "")
 {
     $objDb = new SC_Helper_DB_Ex();
     $arrRet = $this->objFormParam->getHashArray();
     // dtb_products以外に登録される値を除外する。
     foreach ($arrRet as $key => $val) {
         switch ($key) {
             case 'product_code':
             case 'price01':
             case 'price02':
             case 'stock':
             case 'product_class_id':
             case 'recommend_product_id1':
             case 'recommend_product_id2':
             case 'recommend_product_id3':
             case 'recommend_product_id4':
             case 'recommend_product_id5':
             case 'recommend_product_id6':
             case 'recommend_comment1':
             case 'recommend_comment2':
             case 'recommend_comment3':
             case 'recommend_comment4':
             case 'recommend_comment5':
             case 'recommend_comment6':
             case 'category_id':
                 break;
             default:
                 if (!ereg("^dummy", $key)) {
                     $sqlval[$key] = $val;
                 }
                 break;
         }
     }
     // 登録時間を生成(DBのnow()だとcommitした際、すべて同一の時間になってしまう)
     $time = date("Y-m-d H:i:s");
     // 秒以下を生成
     if ($line != "") {
         $microtime = sprintf("%06d", $line);
         $time .= ".{$microtime}";
     }
     $sqlval['update_date'] = $time;
     $sqlval['creator_id'] = $_SESSION['member_id'];
     if ($sqlval['sale_limit'] == "") {
         $sqlval['sale_unlimited'] = '1';
     } else {
         $sqlval['sale_unlimited'] = '0';
     }
     if ($sqlval['status'] == "") {
         $sqlval['status'] = 2;
     }
     if ($arrRet['product_id'] != "" && $arrRet['product_class_id'] != "") {
         // UPDATEの実行
         $where = "product_id = ?";
         $objQuery->update("dtb_products", $sqlval, $where, array($sqlval['product_id']));
     } else {
         // 新規登録
         // postgresqlとmysqlとで処理を分ける
         if (DB_TYPE == "pgsql") {
             $product_id = $objQuery->nextval("dtb_products", "product_id");
         } elseif (DB_TYPE == "mysql") {
             $product_id = $objQuery->get_auto_increment("dtb_products");
         }
         $sqlval['product_id'] = $product_id;
         $sqlval['create_date'] = $time;
         // INSERTの実行
         $objQuery->insert("dtb_products", $sqlval);
     }
     // カテゴリ登録
     $arrCategory_id = explode("|", $arrRet["category_id"]);
     $objDb->updateProductCategories($arrCategory_id, $sqlval['product_id']);
     // 規格登録
     $this->lfRegistProductClass($objQuery, $arrRet, $sqlval['product_id'], $arrRet['product_class_id']);
     // おすすめ商品登録
     $objQuery->delete("dtb_recommend_products", "product_id = ?", array($sqlval['product_id']));
     for ($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) {
         $keyname = "recommend_product_id" . $i;
         $comment_key = "recommend_comment" . $i;
         if ($arrRet[$keyname] != "") {
             $arrProduct = $objQuery->select("product_id", "dtb_products", "product_id = ?", array($arrRet[$keyname]));
             if ($arrProduct[0]['product_id'] != "") {
                 $arrval['product_id'] = $sqlval['product_id'];
                 $arrval['recommend_product_id'] = $arrProduct[0]['product_id'];
                 $arrval['comment'] = $arrRet[$comment_key];
                 $arrval['update_date'] = "Now()";
                 $arrval['create_date'] = "Now()";
                 $arrval['creator_id'] = $_SESSION['member_id'];
                 $arrval['rank'] = RECOMMEND_PRODUCT_MAX - $i + 1;
                 $objQuery->insert("dtb_recommend_products", $arrval);
             }
         }
     }
 }
开发者ID:khrisna,项目名称:eccubedrm,代码行数:99,代码来源:LC_Page_Admin_Products_UploadCSV.php

示例4: lfRegistProduct

 /**
  * DBに商品データを登録する
  *
  * @param object $objUpFile SC_UploadFileインスタンス
  * @param array $arrList フォーム入力パラメーター配列
  * @return integer 登録商品ID
  */
 function lfRegistProduct(&$objUpFile, $arrList)
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objDb = new SC_Helper_DB_Ex();
     // 配列の添字を定義
     $checkArray = array('name', 'status', 'main_list_comment', 'main_comment', 'deliv_fee', 'comment1', 'comment2', 'comment3', 'comment4', 'comment5', 'comment6', 'sale_limit', 'deliv_date_id', 'maker_id', 'note');
     $arrList = SC_Utils_Ex::arrayDefineIndexes($arrList, $checkArray);
     // INSERTする値を作成する。
     $sqlval['name'] = $arrList['name'];
     $sqlval['status'] = $arrList['status'];
     $sqlval['main_list_comment'] = $arrList['main_list_comment'];
     $sqlval['main_comment'] = $arrList['main_comment'];
     $sqlval['comment1'] = $arrList['comment1'];
     $sqlval['comment2'] = $arrList['comment2'];
     $sqlval['comment3'] = $arrList['comment3'];
     $sqlval['comment4'] = $arrList['comment4'];
     $sqlval['comment5'] = $arrList['comment5'];
     $sqlval['comment6'] = $arrList['comment6'];
     $sqlval['deliv_date_id'] = $arrList['deliv_date_id'];
     $sqlval['maker_id'] = $arrList['maker_id'];
     $sqlval['note'] = $arrList['note'];
     $sqlval['update_date'] = 'CURRENT_TIMESTAMP';
     $sqlval['creator_id'] = $this->memberData['member_id'];
     $arrRet = $objUpFile->getDBFileList();
     $sqlval = array_merge($sqlval, $arrRet);
     for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
         $sqlval['sub_title' . $cnt] = $arrList['sub_title' . $cnt];
         $sqlval['sub_comment' . $cnt] = $arrList['sub_comment' . $cnt];
     }
     $objQuery->begin();
     // 新規登録
     $product_id = $objQuery->nextVal('dtb_products_product_id');
     $sqlval['product_id'] = $product_id;
     // INSERTの実行
     $sqlval['create_date'] = 'CURRENT_TIMESTAMP';
     $objQuery->insert('dtb_products', $sqlval);
     $arrList['product_id'] = $product_id;
     // カテゴリを更新
     $objDb->updateProductCategories($arrList['category_id'], $product_id);
     // 規格登録
     if ($objDb->sfHasProductClass($product_id)) {
         // 規格あり商品(商品規格テーブルのうち、商品登録フォームで設定するパラメーターのみ更新)
         $this->lfUpdateProductClass($arrList);
     } else {
         // 規格なし商品(商品規格テーブルの更新)
         $this->lfInsertDummyProductClass($arrList);
     }
     // 商品ステータス設定
     $objProduct = new SC_Product_Ex();
     $this->setProductStatus($product_id, $arrList['product_status']);
     $objQuery->commit();
     return $product_id;
 }
开发者ID:rocky-ice-cream,项目名称:003_eccube_test,代码行数:60,代码来源:plg_AddProduct_AddProduct.php


注:本文中的SC_Helper_DB_Ex::updateProductCategories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。