- Timestamp:
- 2009/06/28 19:24:15 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/class/pages/products/LC_Page_Products_Detail.php
r18069 r18142 78 78 */ 79 79 function process() { 80 // プロダクトIDの正当性チェック 81 $product_id = $this->lfCheckProductId(); 82 80 83 $objView = new SC_SiteView(); 81 84 $objCustomer = new SC_Customer(); … … 114 117 $this->lfInitFile(); 115 118 116 // 管理機能からの確認の場合は、非公開の商品も表示する。117 if(isset($_GET['admin']) && $_GET['admin'] == 'on') {118 SC_Utils_Ex::sfIsSuccess(new SC_Session());119 $status = true;120 $where = "del_flg = 0";121 } else {122 $status = false;123 $where = "del_flg = 0 AND status = 1";124 }125 126 if(isset($_POST['mode']) && $_POST['mode'] != "") {127 $tmp_id = $_POST['product_id'];128 } else {129 $tmp_id = $_GET['product_id'];130 }131 132 // 値の正当性チェック133 if(!SC_Utils_Ex::sfIsInt($_GET['product_id'])134 || !$objDb->sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) {135 SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);136 }137 119 // ログイン判定 138 120 if ($objCustomer->isLoginSuccess() === true) { … … 151 133 if ($rpcnt < CUSTOMER_READING_MAX){ 152 134 //閲覧履歴に新規追加 153 lfRegistReadingData($ tmp_id, $objCustomer->getValue('customer_id'));135 lfRegistReadingData($product_id, $objCustomer->getValue('customer_id')); 154 136 } else { 155 137 //閲覧履歴の中で一番古いものを削除して新規追加 … … 161 143 $objQuery->delete($table, $where, $arrval); 162 144 //追加 163 lfRegistReadingData($ tmp_id, $objCustomer->getValue('customer_id'));145 lfRegistReadingData($product_id, $objCustomer->getValue('customer_id')); 164 146 } 165 147 */ 166 148 } 167 149 168 169 150 // 規格選択セレクトボックスの作成 170 $this->lfMakeSelect($ tmp_id);151 $this->lfMakeSelect($product_id); 171 152 172 153 // 商品IDをFORM内に保持する。 173 $this->tpl_product_id = $ tmp_id;154 $this->tpl_product_id = $product_id; 174 155 175 156 if (!isset($_POST['mode'])) $_POST['mode'] = ""; … … 223 204 $objQuery = new SC_Query(); 224 205 // DBから商品情報を取得する。 225 $arrRet = $objQuery->select("*, (SELECT count(*) FROM dtb_customer_favorite_products WHERE product_id = alldtl.product_id AND customer_id = ?) AS favorite_count", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($objCustomer->getValue('customer_id'), $ tmp_id));206 $arrRet = $objQuery->select("*, (SELECT count(*) FROM dtb_customer_favorite_products WHERE product_id = alldtl.product_id AND customer_id = ?) AS favorite_count", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($objCustomer->getValue('customer_id'), $product_id)); 226 207 $this->arrProduct = $arrRet[0]; 227 208 228 209 // 商品コードの取得 229 210 $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code"; 230 $arrProductCode = $objQuery->getall($code_sql, array($ tmp_id));211 $arrProductCode = $objQuery->getall($code_sql, array($product_id)); 231 212 $arrProductCode = SC_Utils_Ex::sfswaparray($arrProductCode); 232 213 $this->arrProductCode = $arrProductCode["product_code"]; … … 243 224 244 225 // 関連カテゴリを取得 245 $this->arrRelativeCat = $objDb->sfGetMultiCatTree($ tmp_id);226 $this->arrRelativeCat = $objDb->sfGetMultiCatTree($product_id); 246 227 247 228 // 画像ファイル指定がない場合の置換処理 … … 257 238 $this->arrForm = $this->objFormParam->getFormParamList(); 258 239 //レビュー情報の取得 259 $this->arrReview = $this->lfGetReviewData($ tmp_id);240 $this->arrReview = $this->lfGetReviewData($product_id); 260 241 // トラックバック情報の取得 261 242 … … 265 246 } else { 266 247 $this->arrTrackbackView = "ON"; 267 $this->arrTrackback = $this->lfGetTrackbackData($ tmp_id);268 } 269 $this->trackback_url = TRACKBACK_TO_URL . $ tmp_id;248 $this->arrTrackback = $this->lfGetTrackbackData($product_id); 249 } 250 $this->trackback_url = TRACKBACK_TO_URL . $product_id; 270 251 //関連商品情報表示 271 $this->arrRecommend = $this->lfPreGetRecommendProducts($ tmp_id);252 $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id); 272 253 //この商品を買った人はこんな商品も買っています 273 $this->arrRelateProducts = $this->lfGetRelateProducts($ tmp_id);254 $this->arrRelateProducts = $this->lfGetRelateProducts($product_id); 274 255 275 256 $this->lfConvertParam(); … … 306 287 */ 307 288 function mobileProcess() { 289 // プロダクトIDの正当性チェック 290 $product_id = $this->lfCheckProductId(); 291 308 292 $objView = new SC_MobileView(); 309 293 $objCustomer = new SC_Customer(); … … 323 307 $this->lfInitFile(); 324 308 325 if (!isset($_POST['mode'])) $_POST['mode'] = "";326 327 if(!empty($_POST['mode'])) {328 $tmp_id = $_POST['product_id'];329 } else {330 $tmp_id = $_GET['product_id'];331 }332 333 // 値の正当性チェック334 if(!SC_Utils_Ex::sfIsInt($tmp_id)335 || !$objDb->sfIsRecord("dtb_products", "product_id", $tmp_id, 'del_flg = 0 AND status = 1')) {336 SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);337 }338 339 309 // ログイン判定 340 310 if($objCustomer->isLoginSuccess(true)) { … … 353 323 if ($rpcnt < CUSTOMER_READING_MAX){ 354 324 //閲覧履歴に新規追加 355 lfRegistReadingData($ tmp_id, $objCustomer->getValue('customer_id'));325 lfRegistReadingData($product_id, $objCustomer->getValue('customer_id')); 356 326 } else { 357 327 //閲覧履歴の中で一番古いものを削除して新規追加 … … 363 333 $objQuery->delete($table, $where, $arrval); 364 334 //追加 365 lfRegistReadingData($ tmp_id, $objCustomer->getValue('customer_id'));335 lfRegistReadingData($product_id, $objCustomer->getValue('customer_id')); 366 336 } 367 337 */ … … 370 340 371 341 // 規格選択セレクトボックスの作成 372 $this->lfMakeSelectMobile($this, $ tmp_id);342 $this->lfMakeSelectMobile($this, $product_id); 373 343 374 344 // 商品IDをFORM内に保持する。 375 $this->tpl_product_id = $ tmp_id;345 $this->tpl_product_id = $product_id; 376 346 377 347 switch($_POST['mode']) { … … 447 417 $objQuery = new SC_Query(); 448 418 // DBから商品情報を取得する。 449 $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($ tmp_id));419 $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($product_id)); 450 420 $this->arrProduct = $arrRet[0]; 451 421 452 422 // 商品コードの取得 453 423 $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code"; 454 $arrProductCode = $objQuery->getall($code_sql, array($ tmp_id));424 $arrProductCode = $objQuery->getall($code_sql, array($product_id)); 455 425 $arrProductCode = SC_Utils_Ex::sfswaparray($arrProductCode); 456 426 $this->arrProductCode = $arrProductCode["product_code"]; … … 479 449 $this->arrForm = $this->objFormParam->getFormParamList(); 480 450 //レビュー情報の取得 481 $this->arrReview = $this->lfGetReviewData($ tmp_id);451 $this->arrReview = $this->lfGetReviewData($product_id); 482 452 // タイトルに商品名を入れる 483 453 $this->tpl_title = "商品詳細 ". $this->arrProduct["name"]; 484 454 //関連商品情報表示 485 $this->arrRecommend = $this->lfPreGetRecommendProducts($ tmp_id);455 $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id); 486 456 //この商品を買った人はこんな商品も買っています 487 $this->arrRelateProducts = $this->lfGetRelateProducts($ tmp_id);457 $this->arrRelateProducts = $this->lfGetRelateProducts($product_id); 488 458 489 459 $objView->assignobj($this); 490 460 $objView->display(SITE_FRAME); 461 } 462 463 /* プロダクトIDの正当性チェック */ 464 function lfCheckProductId() { 465 // 管理機能からの確認の場合は、非公開の商品も表示する。 466 if (isset($_GET['admin']) && $_GET['admin'] == 'on') { 467 SC_Utils_Ex::sfIsSuccess(new SC_Session()); 468 $status = true; 469 $where = 'del_flg = 0'; 470 } else { 471 $status = false; 472 $where = 'del_flg = 0 AND status = 1'; 473 } 474 475 if (defined('MOBILE_SITE')) { 476 if (!isset($_POST['mode'])) $_POST['mode'] = ""; 477 if (!empty($_POST['mode'])) { 478 $product_id = $_POST['product_id']; 479 } else { 480 $product_id = $_GET['product_id']; 481 } 482 } else { 483 if(isset($_POST['mode']) && $_POST['mode'] != '') { 484 $product_id = $_POST['product_id']; 485 } else { 486 $product_id = $_GET['product_id']; 487 } 488 } 489 490 $objDb = new SC_Helper_DB_Ex(); 491 if(!SC_Utils_Ex::sfIsInt($product_id) 492 || SC_Utils_Ex::sfIsZeroFilling($product_id) 493 || !$objDb->sfIsRecord('dtb_products', 'product_id', (array)$product_id, $where)) 494 SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); 495 return $product_id; 491 496 } 492 497 … … 779 784 780 785 //閲覧履歴新規登録 781 function lfRegistReadingData($ tmp_id, $customer_id){786 function lfRegistReadingData($product_id, $customer_id){ 782 787 $objQuery = new SC_Query; 783 788 $sqlval['customer_id'] = $customer_id; 784 $sqlval['reading_product_id'] = $ tmp_id;789 $sqlval['reading_product_id'] = $product_id; 785 790 $sqlval['create_date'] = 'NOW()'; 786 791 $sqlval['update_date'] = 'NOW()'; … … 789 794 790 795 //この商品を買った人はこんな商品も買っています FIXME 791 function lfGetRelateProducts($ tmp_id) {796 function lfGetRelateProducts($product_id) { 792 797 $objQuery = new SC_Query; 793 798 //自動抽出 … … 799 804 $from = "vw_products_allclass AS allcls "; 800 805 $where = "del_flg = 0 AND status = 1 AND (stock_max <> 0 OR stock_max IS NULL) AND product_id = ? "; 801 $arrval[] = $ tmp_id;806 $arrval[] = $product_id; 802 807 //結果の取得 803 808 $arrProducts = $objQuery->select($col, $from, $where, $arrval);
Note: See TracChangeset
for help on using the changeset viewer.