function lfDownRankChilds($objQuery, $table, $pid_name, $id_name, $id, $count) { $objDb = new SC_Helper_DB_Ex(); // 子ID一覧を取得 $arrRet = $objDb->sfGetChildrenArray($table, $pid_name, $id_name, $id); $line = SC_Utils_Ex::sfGetCommaList($arrRet); $where = "{$id_name} IN ({$line}) AND del_flg = 0"; $arrRawVal = array('rank' => "(rank - {$count})"); return $objQuery->update($table, array(), $where, array(), $arrRawVal); }
function lfDownRankChilds($objQuery, $table, $pid_name, $id_name, $id, $count) { $objDb = new SC_Helper_DB_Ex(); // 子ID一覧を取得 $arrRet = $objDb->sfGetChildrenArray($table, $pid_name, $id_name, $id); $line = SC_Utils_Ex::sfGetCommaList($arrRet); $sql = "UPDATE {$table} SET rank = (rank - {$count}) WHERE {$id_name} IN ({$line}) "; $sql .= 'AND del_flg = 0'; $ret = $objQuery->exec($sql); return $ret; }
/** * カテゴリから商品を検索する場合のWHERE文と値を返す. * * @param integer $category_id カテゴリID * @return array 商品を検索する場合の配列 */ public function sfGetCatWhere($category_id) { // 子カテゴリIDの取得 $arrRet = SC_Helper_DB_Ex::sfGetChildrenArray('dtb_category', 'parent_category_id', 'category_id', $category_id); $where = 'category_id IN (' . SC_Utils_Ex::repeatStrWithSeparator('?', count($arrRet)) . ')'; return array($where, $arrRet); }
/** * カテゴリから商品を検索する場合のWHERE文と値を返す. * * @param integer $category_id カテゴリID * @return array 商品を検索する場合の配列 */ function sfGetCatWhere($category_id) { // 子カテゴリIDの取得 $arrRet = SC_Helper_DB_Ex::sfGetChildrenArray("dtb_category", "parent_category_id", "category_id", $category_id); $where = "category_id IN (" . implode(',', array_fill(0, count($arrRet), '?')) . ")"; return array($where, $arrRet); }