public function setWhereByOR($arrWhere) { $count = count($arrWhere); for ($i = 0; $i < $count; $i++) { if (isset($arrWhere[$i]['value'])) { $statement .= $arrWhere[$i]['column'] . ' = ' . Utils::sfQuoteSmart($arrWhere[$i]['value']) . ' OR '; } } $statement = '(' . rtrim($statement, ' OR ') . ')'; if ($this->where) { $this->where .= ' AND ' . $statement; } else { $this->where = 'WHERE ' . $statement; } }
/** * 並び順を下げる * * @param integer $class_id 規格ID * @param integer $classcategory_id 規格分類ID * @return void */ public function lfDownRank($class_id, $classcategory_id) { /* @var $objDb DbHelper */ $objDb = Application::alias('eccube.helper.db'); $where = 'class_id = ' . Utils::sfQuoteSmart($class_id); $objDb->rankDown('dtb_classcategory', 'classcategory_id', $classcategory_id, $where); }
/** * マスターデータを更新する. * * 引数 $masterData の値でマスターデータを更新する. * $masterData は key => value 形式の配列である必要がある. * * @param string $name マスターデータ名 * @param array $columns [0] => キー, [1] => 表示文字列, [2] => 表示順 * を表すカラム名を格納した配列 * @param array $masterData マスターデータ * @param bool $autoCommit トランザクションを自動的に commit する場合 true * @return integer マスターデータの更新数 */ public function updateMasterData($name, $columns, $masterData, $autoCommit = true) { $columns = $this->getDefaultColumnName($columns); /* @var $objQuery Query */ $objQuery = Application::alias('eccube.query'); if ($autoCommit) { $objQuery->begin(); } // 指定のデータを更新 $i = 0; foreach ($masterData as $key => $val) { $sqlVal = array($columns[1] => $val); $objQuery->update($name, $sqlVal, $columns[0] . ' = ' . Utils::sfQuoteSmart($key)); $i++; } if ($autoCommit) { $objQuery->commit(); } return $i; }
/** * @param DbHelper $objDb */ public function lfRankMove(&$objDb, $parent_category_id, $product_id) { $key = 'pos-' . $product_id; $input_pos = mb_convert_kana($_POST[$key], 'n'); if (Utils::sfIsInt($input_pos)) { $where = 'category_id = ' . Utils::sfQuoteSmart($parent_category_id); $objDb->moveRank('dtb_product_categories', 'product_id', $product_id, $input_pos, $where); } }