Changeset 15078 for branches/feature-module-update/html/install/user_data/include/campaign/default/src/index.php
- Timestamp:
- 2007/07/20 15:58:59 (17 years ago)
- Location:
- branches/feature-module-update
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-module-update
-
Property
svn:ignore
set to
.cache
.settings
.projectOptions
-
Property
svn:ignore
set to
-
branches/feature-module-update/html/install/user_data/include/campaign/default/src/index.php
r14117 r15078 7 7 require_once("../../require.php"); 8 8 9 //---- ¥Ú¡¼¥¸É½¼¨¥¯¥é¥¹9 //---- ページ表示クラス 10 10 class LC_Page { 11 11 … … 20 20 $objCampaignSess = new SC_CampaignSession(); 21 21 22 // ¥Ç¥£¥ì¥¯¥È¥ê̾¤ò¼èÆÀ22 // ディレクトリ名を取得 23 23 $dir_name = dirname($_SERVER['PHP_SELF']); 24 24 $arrDir = split('/', $dir_name); 25 25 $dir_name = $arrDir[count($arrDir) -1]; 26 26 27 /* ¥»¥Ã¥·¥ç¥ó¤Ë¥¥ã¥ó¥Ú¡¼¥ó¥Ç¡¼¥¿¤ò½ñ¤¹þ¤à*/28 // ¥¥ã¥ó¥Ú¡¼¥ó¤«¤é¤ÎÁ«°Ü¤È¤¤¤¦¾ðÊó¤òÊÝ»ý27 /* セッションにキャンペーンデータを書き込む */ 28 // キャンペーンからの遷移という情報を保持 29 29 $objCampaignSess->setIsCampaign(); 30 // ¥¥ã¥ó¥Ú¡¼¥óID¤òÊÝ»ý30 // キャンペーンIDを保持 31 31 $campaign_id = $objQuery->get("dtb_campaign", "campaign_id", "directory_name = ? AND del_flg = 0", array($dir_name)); 32 32 $objCampaignSess->setCampaignId($campaign_id); 33 // ¥¥ã¥ó¥Ú¡¼¥ó¥Ç¥£¥ì¥¯¥È¥ê̾¤òÊÝ»ý33 // キャンペーンディレクトリ名を保持 34 34 $objCampaignSess->setCampaignDir($dir_name); 35 35 36 // ¥«¡¼¥È¤ËÆþ¤ì¤Ê¤¤¥Ú¡¼¥¸¤Î¾ì¹ç¤Î¥Ú¡¼¥¸(¿½¹þ¤Î¤ß¥Ú¡¼¥¸)¤Ø¥ê¥À¥¤¥ì¥¯¥È36 // カートに入れないページの場合のページ(申込のみページ)へリダイレクト 37 37 $cart_flg = $objQuery->get("dtb_campaign", "cart_flg", "campaign_id = ?", array($campaign_id)); 38 38 if(!$cart_flg) { … … 40 40 } 41 41 42 // ¥¥ã¥ó¥Ú¡¼¥ó¤¬³«ºÅÃ椫¤ò¥Á¥§¥Ã¥¯42 // キャンペーンが開催中かをチェック 43 43 if(lfCheckActive($dir_name)) { 44 44 $status = CAMPAIGN_TEMPLATE_ACTIVE; … … 64 64 $classcategory_id2 = $_POST[$classcategory_id. '_2']; 65 65 $quantity = "quantity". $_POST['product_id']; 66 // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç66 // 規格1が設定されていない場合 67 67 if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) { 68 68 $classcategory_id1 = '0'; 69 69 } 70 // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç70 // 規格2が設定されていない場合 71 71 if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) { 72 72 $classcategory_id2 = '0'; … … 81 81 break; 82 82 } 83 // ÆþÎϾðÊó¤òÅϤ¹83 // 入力情報を渡す 84 84 $objPage->arrForm = $_POST; 85 85 $objPage->tpl_dir_name = CAMPAIGN_TEMPLATE_PATH . $dir_name . "/" . $status; 86 86 87 //---- ¡¡¥Ú¡¼¥¸É½¼¨87 //---- ページ表示 88 88 $objView->assignobj($objPage); 89 89 $objView->display($objPage->tpl_mainpage); … … 92 92 //--------------------------------------------------------------------------------------------------------------------------------------------------------- 93 93 /* 94 * ´Ø¿ô̾¡§lfCheckActive()95 * °ú¿ô1 ¡§¥Ç¥£¥ì¥¯¥È¥ê̾96 * ÀâÌÀ¡¡¡§¥¥ã¥ó¥Ú¡¼¥óÃ椫¥Á¥§¥Ã¥¯97 * Ìá¤êÃÍ¡§¥¥ã¥ó¥Ú¡¼¥óÃæ¤Ê¤é true ½ªÎ»¤Ê¤éfalse94 * 関数名:lfCheckActive() 95 * 引数1 :ディレクトリ名 96 * 説明 :キャンペーン中かチェック 97 * 戻り値:キャンペーン中なら true 終了なら false 98 98 */ 99 99 function lfCheckActive($directory_name) { … … 105 105 $arrRet = $objQuery->select($col, "dtb_campaign", "directory_name = ? AND del_flg = 0", array($directory_name)); 106 106 107 // ³«»ÏÆü»þ¡¦Ää»ßÆü»þ¤òÀ®·¿107 // 開始日時・停止日時を成型 108 108 $start_date = (date("YmdHis", strtotime($arrRet[0]['start_date']))); 109 109 $end_date = (date("YmdHis", strtotime($arrRet[0]['end_date']))); 110 110 $now_date = (date("YmdHis")); 111 111 112 // ¥¥ã¥ó¥Ú¡¼¥ó¤¬³«ºÅ´ü´Ö¤Ç¡¢¤«¤Ä¿½¹þÀ©¸ÂÆâ¤Ç¤¢¤ë112 // キャンペーンが開催期間で、かつ申込制限内である 113 113 if($now_date > $start_date && $now_date < $end_date 114 114 && ($arrRet[0]['limit_count'] > $arrRet[0]['total_count'] || $arrRet[0]['limit_count'] < 1)) { … … 119 119 } 120 120 121 /* ¾¦ÉÊ°ìÍ÷¤Îɽ¼¨*/121 /* 商品一覧の表示 */ 122 122 function lfDispProductsList($ids) { 123 123 … … 125 125 global $objPage; 126 126 127 // µ¬³Ê̾°ìÍ÷127 // 規格名一覧 128 128 $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); 129 // µ¬³ÊʬÎà̾°ìÍ÷129 // 規格分類名一覧 130 130 $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 131 131 … … 135 135 } 136 136 137 // where ¶çÀ¸À®137 // where句生成 138 138 $count = 0; 139 139 $where = "product_id IN ("; … … 146 146 $where .= ")"; 147 147 148 // ¾¦ÉÊ°ìÍ÷148 // 商品一覧 149 149 $arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $where, $arrval); 150 150 151 151 for($i = 0; $i < count($arrProducts); $i++) { 152 152 $objPage = lfMakeSelect($arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName); 153 // ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ153 // 購入制限数を取得 154 154 $objPage = lfGetSaleLimit($arrProducts); 155 155 } … … 164 164 } 165 165 166 /* µ¬³Ê¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ®*/166 /* 規格セレクトボックスの作成 */ 167 167 function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) { 168 168 global $objPage; … … 170 170 $classcat_find1 = false; 171 171 $classcat_find2 = false; 172 // ºß¸Ë¤¢¤ê¤Î¾¦ÉʤÎÍ̵172 // 在庫ありの商品の有無 173 173 $stock_find = false; 174 174 175 // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ175 // 商品規格情報の取得 176 176 $arrProductsClass = lfGetProductsClass($product_id); 177 177 178 // µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ178 // 規格1クラス名の取得 179 179 $objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']]; 180 // µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ180 // 規格2クラス名の取得 181 181 $objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']]; 182 182 183 // ¤¹¤Ù¤Æ¤ÎÁȤ߹ç¤ï¤»¿ô183 // すべての組み合わせ数 184 184 $count = count($arrProductsClass); 185 185 … … 190 190 191 191 $list_id = 0; 192 $arrList[0] = "\tlist". $product_id. "_0 = new Array(' ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'";192 $arrList[0] = "\tlist". $product_id. "_0 = new Array('選択してください'"; 193 193 $arrVal[0] = "\tval". $product_id. "_0 = new Array(''"; 194 194 195 195 for ($i = 0; $i < $count; $i++) { 196 // ºß¸Ë¤Î¥Á¥§¥Ã¥¯196 // 在庫のチェック 197 197 if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 198 198 continue; … … 201 201 $stock_find = true; 202 202 203 // µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ203 // 規格1のセレクトボックス用 204 204 if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 205 205 $arrList[$list_id].=");\n"; … … 210 210 } 211 211 212 // µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ212 // 規格2のセレクトボックス用 213 213 $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 214 214 215 // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ215 // セレクトボックス表示値 216 216 if($arrList[$list_id] == "") { 217 $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array(' ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'";217 $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('選択してください', '". $arrClassCatName[$classcat_id2]. "'"; 218 218 } else { 219 219 $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 220 220 } 221 221 222 // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ222 // セレクトボックスPOST値 223 223 if($arrVal[$list_id] == "") { 224 224 $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; … … 231 231 $arrVal[$list_id].=");\n"; 232 232 233 // µ¬³Ê1233 // 規格1 234 234 $objPage->arrClassCat1[$product_id] = $arrSele; 235 235 … … 260 260 $objPage->tpl_javascript.= $vals.");\n"; 261 261 262 // ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID262 // 選択されている規格2ID 263 263 $classcategory_id = "classcategory_id". $product_id; 264 264 $objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); "; 265 265 266 // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë266 // 規格1が設定されている 267 267 if($arrProductsClass[0]['classcategory_id1'] != '0') { 268 268 $classcat_find1 = true; 269 269 } 270 270 271 // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë271 // 規格2が設定されている 272 272 if($arrProductsClass[0]['classcategory_id2'] != '0') { 273 273 $classcat_find2 = true; … … 281 281 } 282 282 283 /* ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ*/283 /* 商品規格情報の取得 */ 284 284 function lfGetProductsClass($product_id) { 285 285 $arrRet = array(); 286 286 if(sfIsInt($product_id)) { 287 // ¾¦Éʵ¬³Ê¼èÆÀ287 // 商品規格取得 288 288 $objQuery = new SC_Query(); 289 289 $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; … … 296 296 } 297 297 298 /* ÆþÎÏÆâÍƤΥÁ¥§¥Ã¥¯*/298 /* 入力内容のチェック */ 299 299 function lfCheckError($id) { 300 300 global $objPage; 301 301 302 // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£302 // 入力データを渡す。 303 303 $objErr = new SC_CheckError(); 304 304 … … 306 306 $classcategory_id2 = "classcategory_id". $id. "_2"; 307 307 $quantity = "quantity". $id; 308 // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯308 // 複数項目チェック 309 309 if ($objPage->tpl_classcat_find1[$id]) { 310 $objErr->doFunc(array(" µ¬³Ê1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));310 $objErr->doFunc(array("規格1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 311 311 } 312 312 if ($objPage->tpl_classcat_find2[$id]) { 313 $objErr->doFunc(array(" µ¬³Ê2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));314 } 315 $objErr->doFunc(array(" ¸Ä¿ô", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));313 $objErr->doFunc(array("規格2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 314 } 315 $objErr->doFunc(array("個数", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 316 316 317 317 return $objErr->arrErr; 318 318 } 319 319 320 // ¹ØÆþÀ©¸Â¿ô¤ÎÀßÄê320 // 購入制限数の設定 321 321 function lfGetSaleLimit($product) { 322 322 global $objPage; 323 // ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃͤ¬ÀßÄêÃͤè¤êÂ礤¤¾ì¹ç323 //在庫が無限または購入制限値が設定値より大きい場合 324 324 if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 325 325 $objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; … … 331 331 } 332 332 333 // »ÙʧÊýË¡¤Î¼èÆÀ334 //payment_id 1: Âå¶â°ú´¹¡¡2:¶ä¹Ô¿¶¤ê¹þ¤ß¡¡3:¸½¶â½ñα333 //支払方法の取得 334 //payment_id 1:代金引換 2:銀行振り込み 3:現金書留 335 335 function lfGetPayment() { 336 336 $objQuery = new SC_Query;
Note: See TracChangeset
for help on using the changeset viewer.