本文整理汇总了PHP中SC_Utils_Ex::arrayDefineIndexes方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Utils_Ex::arrayDefineIndexes方法的具体用法?PHP SC_Utils_Ex::arrayDefineIndexes怎么用?PHP SC_Utils_Ex::arrayDefineIndexes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Utils_Ex
的用法示例。
在下文中一共展示了SC_Utils_Ex::arrayDefineIndexes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lfInsertDummyProductClass
/**
* 規格を設定していない商品を商品規格テーブルに登録
*
* @param array $arrList
* @return void
*/
function lfInsertDummyProductClass($arrList)
{
$objQuery =& SC_Query_Ex::getSingletonInstance();
$objDb = new SC_Helper_DB_Ex();
// 配列の添字を定義
$checkArray = array('product_class_id', 'product_id', 'product_code', 'stock', 'stock_unlimited', 'price01', 'price02', 'sale_limit', 'deliv_fee', 'point_rate', 'product_type_id', 'down_filename', 'down_realfilename');
$sqlval = SC_Utils_Ex::sfArrayIntersectKeys($arrList, $checkArray);
$sqlval = SC_Utils_Ex::arrayDefineIndexes($sqlval, $checkArray);
$sqlval['stock_unlimited'] = $sqlval['stock_unlimited'] ? UNLIMITED_FLG_UNLIMITED : UNLIMITED_FLG_LIMITED;
$sqlval['creator_id'] = strlen($_SESSION['member_id']) >= 1 ? $_SESSION['member_id'] : '0';
if (strlen($sqlval['product_class_id']) == 0) {
$sqlval['product_class_id'] = $objQuery->nextVal('dtb_products_class_product_class_id');
$sqlval['create_date'] = 'CURRENT_TIMESTAMP';
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
// INSERTの実行
$objQuery->insert('dtb_products_class', $sqlval);
} else {
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
// UPDATEの実行
$objQuery->update('dtb_products_class', $sqlval, 'product_class_id = ?', array($sqlval['product_class_id']));
}
}
示例2: 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;
}
示例3: sfInsertProductClass
function sfInsertProductClass($objQuery, $arrList, $product_id, $product_class_id = "")
{
// すでに規格登録があるかどうかをチェックする。
$where = "product_id = ? AND classcategory_id1 <> 0 AND classcategory_id1 <> 0";
$count = $objQuery->count("dtb_products_class", $where, array($product_id));
// すでに規格登録がない場合
if ($count == 0) {
// 既存規格の削除
$where = "product_id = ?";
$objQuery->delete("dtb_products_class", $where, array($product_id));
// 配列の添字を定義
$checkArray = array("product_code", "stock", "stock_unlimited", "price01", "price02");
$arrList = SC_Utils_Ex::arrayDefineIndexes($arrList, $checkArray);
$sqlval['product_id'] = $product_id;
if (strlen($product_class_id) > 0) {
$sqlval['product_class_id'] = $product_class_id;
}
$sqlval['classcategory_id1'] = '0';
$sqlval['classcategory_id2'] = '0';
$sqlval['product_code'] = $arrList["product_code"];
$sqlval['stock'] = $arrList["stock"];
$sqlval['stock_unlimited'] = $arrList["stock_unlimited"];
$sqlval['price01'] = $arrList['price01'];
$sqlval['price02'] = $arrList['price02'];
$sqlval['creator_id'] = $_SESSION['member_id'];
$sqlval['create_date'] = "now()";
if ($_SESSION['member_id'] == "") {
$sqlval['creator_id'] = '0';
}
// INSERTの実行
$objQuery->insert("dtb_products_class", $sqlval);
}
}