Beispiel #1
0
 /**
  * 商品規格登録を行う.
  *
  * FIXME: 商品規格登録の実処理自体は、LC_Page_Admin_Products_Productと共通化して欲しい。
  *
  * @param  Query $objQuery         Queryインスタンス
  * @param  array    $arrList          商品規格情報配列
  * @param  integer  $product_id       商品ID
  * @param  integer  $product_class_id 商品規格ID
  * @return void
  */
 public function lfRegistProductClass($objQuery, $arrList, $product_id, $product_class_id)
 {
     /* @var $objProduct Product */
     $objProduct = Application::alias('eccube.product');
     // FIXME: dtb_csvテーブルの中で古いカラム名(右辺)が設定されている。sfArrayIntersectKeysでフィルタされてしまうので、名称を変更する必要がある
     if (array_key_exists('classcategory_id', $arrList) && $arrList['classcategory_id'] != '') {
         $arrList['classcategory_id1'] = $arrList['classcategory_id'];
     }
     if (array_key_exists('parent_classcategory_id', $arrList) && $arrList['classcategory_id'] != '') {
         $arrList['classcategory_id2'] = $arrList['parent_classcategory_id'];
     }
     // 商品規格登録情報を生成する。
     // 商品規格テーブルのカラムに存在しているもののうち、Form投入設定されていないデータは上書きしない。
     $sqlval = Utils::sfArrayIntersectKeys($arrList, $this->arrProductClassColumn);
     if ($product_class_id == '') {
         // 新規登録
         // 必須入力では無い項目だが、空文字では問題のある特殊なカラム値の初期値設定
         $sqlval = $this->lfSetProductClassDefaultData($sqlval);
         $sqlval['product_id'] = $product_id;
         $sqlval['product_class_id'] = $objQuery->nextVal('dtb_products_class_product_class_id');
         $sqlval['create_date'] = $arrList['update_date'];
         // INSERTの実行
         $objQuery->insert('dtb_products_class', $sqlval);
         $product_class_id = $sqlval['product_class_id'];
     } else {
         // UPDATEの実行
         // 必須入力では無い項目だが、空文字では問題のある特殊なカラム値の初期値設定
         $sqlval = $this->lfSetProductClassDefaultData($sqlval, true);
         $where = 'product_class_id = ?';
         $objQuery->update('dtb_products_class', $sqlval, $where, array($product_class_id));
     }
 }
 /**
  * 子孫カテゴリーの表示順を一括して下げる.
  *
  * @param Query $objQuery
  * @param int $category_id
  * @param int $count
  * @return array|bool
  */
 private function reduceBranchRank(Query $objQuery, $category_id, $count)
 {
     $table = 'dtb_category';
     /* @var $objDb DbHelper */
     $objDb = Application::alias('eccube.helper.db');
     // 子ID一覧を取得
     $arrRet = $objDb->getChildrenArray($table, 'parent_category_id', 'category_id', $category_id);
     $line = Utils::sfGetCommaList($arrRet);
     $where = "category_id IN ({$line}) AND del_flg = 0";
     $arrRawVal = array('rank' => "(rank - {$count})");
     return $objQuery->update($table, array(), $where, array(), $arrRawVal);
 }
Beispiel #3
0
 /**
  * カテゴリ変更時の移動処理を行う.
  *
  * ※この関数って、どこからも呼ばれていないのでは??
  *
  * @param  Query $objQuery  Query インスタンス
  * @param  string   $table     テーブル名
  * @param  string   $id_name   ID名
  * @param  string   $cat_name  カテゴリ名
  * @param  integer  $old_catid 旧カテゴリID
  * @param  integer  $new_catid 新カテゴリID
  * @param  integer  $id        ID
  * @return void
  */
 public function moveCatRank($objQuery, $table, $id_name, $cat_name, $old_catid, $new_catid, $id)
 {
     if ($old_catid == $new_catid) {
         return;
     }
     // 旧カテゴリでのランク削除処理
     // 移動レコードのランクを取得する。
     $sqlval = array();
     $where = "{$id_name} = ?";
     $rank = $objQuery->get('rank', $table, $where, array($id));
     // 削除レコードのランクより上のレコードを一つ下にずらす。
     $where = "rank > ? AND {$cat_name} = ?";
     $arrWhereVal = array($rank, $old_catid);
     $arrRawSql = array('rank' => '(rank - 1)');
     $objQuery->update($table, $sqlval, $where, $arrWhereVal, $arrRawSql);
     // 新カテゴリでの登録処理
     // 新カテゴリの最大ランクを取得する。
     $max_rank = $objQuery->max('rank', $table, "{$cat_name} = ?", array($new_catid)) + 1;
     $sqlval = array('rank' => $max_rank);
     $where = "{$id_name} = ?";
     $arrWhereVal = array($id);
     $objQuery->update($table, $sqlval, $where, $arrWhereVal);
 }
Beispiel #4
0
 /**
  * レコードの削除(削除フラグをONにする).
  *
  * @param  Query      $objQuery
  * @param  integer     $id       削除対象のmember_id
  * @return void|UPDATE の結果フラグ
  */
 public function deleteRecode(&$objQuery, $id)
 {
     // Updateする値を作成する.
     $sqlVal = array();
     $sqlVal['rank'] = 0;
     $sqlVal['del_flg'] = 1;
     $where = 'member_id = ?';
     // UPDATEの実行 - ランクを最下位にする、DELフラグON
     return $objQuery->update('dtb_member', $sqlVal, $where, array($id));
 }
Beispiel #5
0
 /**
  * @param Query $objQuery
  * @param string $table
  * @param string $pid_name
  * @param string $id_name
  * @param integer $count
  */
 public function lfDownRankChilds($objQuery, $table, $pid_name, $id_name, $id, $count)
 {
     /* @var $objDb DbHelper */
     $objDb = Application::alias('eccube.helper.db');
     // 子ID一覧を取得
     $arrRet = $objDb->getChildrenArray($table, $pid_name, $id_name, $id);
     $line = Utils::sfGetCommaList($arrRet);
     $where = "{$id_name} IN ({$line}) AND del_flg = 0";
     $arrRawVal = array('rank' => "(rank - {$count})");
     return $objQuery->update($table, array(), $where, array(), $arrRawVal);
 }