- Timestamp:
- 2012/07/03 18:48:58 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_Detail.php
r21900 r21953 149 149 switch ($this->mode) { 150 150 case 'cart': 151 $this->arrErr = $this->lfCheckError($this->mode,$this->objFormParam, 152 $this->tpl_classcat_find1, 153 $this->tpl_classcat_find2); 154 if (count($this->arrErr) == 0) { 155 $objCartSess = new SC_CartSession_Ex(); 156 $product_class_id = $this->objFormParam->getValue('product_class_id'); 157 158 $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity')); 159 160 161 SC_Response_Ex::sendRedirect(CART_URLPATH); 162 SC_Response_Ex::actionExit(); 163 } 151 $this->doCart(); 164 152 break; 153 165 154 case 'add_favorite': 166 // ログイン中のユーザが商品をお気に入りにいれる処理 167 if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) { 168 $this->arrErr = $this->lfCheckError($this->mode,$this->objFormParam); 169 if (count($this->arrErr) == 0) { 170 if (!$this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'),$objCustomer->getValue('customer_id'))) { 171 172 $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg); 173 $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite', array($this)); 174 175 SC_Response_Ex::actionExit(); 176 } 177 } 178 } 155 $this->doAddFavorite($objCustomer); 179 156 break; 180 157 181 158 case 'add_favorite_sphone': 182 // ログイン中のユーザが商品をお気に入りにいれる処理(スマートフォン用) 183 if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) { 184 $this->arrErr = $this->lfCheckError($this->mode,$this->objFormParam); 185 if (count($this->arrErr) == 0) { 186 if ($this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'),$objCustomer->getValue('customer_id'))) { 187 188 $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg); 189 $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite_sphone', array($this)); 190 191 print 'true'; 192 SC_Response_Ex::actionExit(); 193 } 194 } 195 print 'error'; 196 SC_Response_Ex::actionExit(); 197 } 159 $this->doAddFavoriteSphone($objCustomer); 198 160 break; 199 161 … … 209 171 210 172 default: 211 // カート「戻るボタン」用に保持 212 $netURL = new Net_URL(); 213 $_SESSION['cart_referer_url'] = $netURL->getURL(); 173 $this->doDefault(); 214 174 break; 215 175 } … … 219 179 switch ($this->mode) { 220 180 case 'select': 221 // 規格1が設定されている場合 222 if ($this->tpl_classcat_find1) { 223 // templateの変更 224 $this->tpl_mainpage = 'products/select_find1.tpl'; 225 break; 226 } 227 228 // 数量の入力を行う 229 $this->tpl_mainpage = 'products/select_item.tpl'; 181 $this->doMobileSelect(); 230 182 break; 231 183 232 184 case 'select2': 233 $this->arrErr = $this->lfCheckError($this->mode,$this->objFormParam,$this->tpl_classcat_find1,$this->tpl_classcat_find2); 234 235 // 規格1が設定されていて、エラーを検出した場合 236 if ($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) { 237 // templateの変更 238 $this->tpl_mainpage = 'products/select_find1.tpl'; 239 break; 240 } 241 242 // 規格2が設定されている場合 243 if ($this->tpl_classcat_find2) { 244 $this->arrErr = array(); 245 246 $this->tpl_mainpage = 'products/select_find2.tpl'; 247 break; 248 } 185 $this->doMobileSelect2(); 186 break; 249 187 250 188 case 'selectItem': 251 $this->arrErr = $this->lfCheckError($this->mode,$this->objFormParam,$this->tpl_classcat_find1,$this->tpl_classcat_find2); 252 253 // 規格2が設定されていて、エラーを検出した場合 254 if ($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) { 255 // templateの変更 256 $this->tpl_mainpage = 'products/select_find2.tpl'; 257 break; 258 } 259 260 $value1 = $this->objFormParam->getValue('classcategory_id1'); 261 262 // 規格2が設定されている場合. 263 if (SC_Utils_Ex::isBlank($this->objFormParam->getValue('classcategory_id2')) == false){ 264 $value2 = '#' . $this->objFormParam->getValue('classcategory_id2'); 265 } else { 266 $value2 = '#0'; 267 } 268 269 if (strlen($value1) === 0) { 270 $value1 = '__unselected'; 271 } 272 273 $this->tpl_product_class_id = $objProduct->classCategories[$product_id][$value1][$value2]['product_class_id']; 274 275 // この段階では、数量の入力チェックエラーを出させない。 276 unset($this->arrErr['quantity']); 277 278 // 数量の入力を行う 279 $this->tpl_mainpage = 'products/select_item.tpl'; 189 $this->doMobileSelectItem(); 280 190 break; 281 191 282 192 case 'cart': 283 // この段階でエラーが出る場合は、数量の入力エラーのはず 284 if (count($this->arrErr)) { 285 // 数量の入力を行う 286 $this->tpl_mainpage = 'products/select_item.tpl'; 287 } 193 $this->doMobileCart(); 288 194 break; 289 195 290 196 default: 291 $this-> tpl_mainpage = 'products/detail.tpl';197 $this->doMobileDefault(); 292 198 break; 293 199 } … … 577 483 } 578 484 } 485 486 /** 487 * Add product(s) into the cart. 488 * 489 * @return void 490 */ 491 function doCart() { 492 $this->arrErr = $this->lfCheckError($this->mode,$this->objFormParam, 493 $this->tpl_classcat_find1, 494 $this->tpl_classcat_find2); 495 if (count($this->arrErr) == 0) { 496 $objCartSess = new SC_CartSession_Ex(); 497 $product_class_id = $this->objFormParam->getValue('product_class_id'); 498 499 $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity')); 500 501 502 SC_Response_Ex::sendRedirect(CART_URLPATH); 503 SC_Response_Ex::actionExit(); 504 } 505 } 506 507 /** 508 * Add product to authenticated user's favorites. 509 * 510 * @param type $objCustomer 511 * @return void 512 */ 513 function doAddFavorite(&$objCustomer) { 514 // ログイン中のユーザが商品をお気に入りにいれる処理 515 if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) { 516 $this->arrErr = $this->lfCheckError($this->mode,$this->objFormParam); 517 if (count($this->arrErr) == 0) { 518 if (!$this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'),$objCustomer->getValue('customer_id'))) { 519 520 $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg); 521 $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite', array($this)); 522 523 SC_Response_Ex::actionExit(); 524 } 525 } 526 } 527 } 528 529 /** 530 * Add product to authenticated user's favorites. (for Smart phone) 531 * 532 * @param type $objCustomer 533 * @return void 534 */ 535 function doAddFavoriteSphone($objCustomer) { 536 // ログイン中のユーザが商品をお気に入りにいれる処理(スマートフォン用) 537 if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) { 538 $this->arrErr = $this->lfCheckError($this->mode,$this->objFormParam); 539 if (count($this->arrErr) == 0) { 540 if ($this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'),$objCustomer->getValue('customer_id'))) { 541 542 $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg); 543 $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite_sphone', array($this)); 544 545 print 'true'; 546 SC_Response_Ex::actionExit(); 547 } 548 } 549 print 'error'; 550 SC_Response_Ex::actionExit(); 551 } 552 } 553 554 /** 555 * 556 * 557 * @return void 558 */ 559 function doDefault() { 560 // カート「戻るボタン」用に保持 561 $netURL = new Net_URL(); 562 $_SESSION['cart_referer_url'] = $netURL->getURL(); 563 } 564 565 /** 566 * 567 * @return void 568 */ 569 function doMobileSelect() { 570 // 規格1が設定されている場合 571 if ($this->tpl_classcat_find1) { 572 // templateの変更 573 $this->tpl_mainpage = 'products/select_find1.tpl'; 574 return; 575 } 576 577 // 数量の入力を行う 578 $this->tpl_mainpage = 'products/select_item.tpl'; 579 } 580 581 /** 582 * 583 * @return type 584 */ 585 function doMobileSelect2() { 586 $this->arrErr = $this->lfCheckError($this->mode,$this->objFormParam,$this->tpl_classcat_find1,$this->tpl_classcat_find2); 587 588 // 規格1が設定されていて、エラーを検出した場合 589 if ($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) { 590 // templateの変更 591 $this->tpl_mainpage = 'products/select_find1.tpl'; 592 return; 593 } 594 595 // 規格2が設定されている場合 596 if ($this->tpl_classcat_find2) { 597 $this->arrErr = array(); 598 599 $this->tpl_mainpage = 'products/select_find2.tpl'; 600 return; 601 } 602 603 $this->doMobileSelectItem(); 604 } 605 606 /** 607 * 608 * @return void 609 */ 610 function doMobileSelectItem() { 611 $this->arrErr = $this->lfCheckError($this->mode,$this->objFormParam,$this->tpl_classcat_find1,$this->tpl_classcat_find2); 612 613 // 規格2が設定されていて、エラーを検出した場合 614 if ($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) { 615 // templateの変更 616 $this->tpl_mainpage = 'products/select_find2.tpl'; 617 break; 618 } 619 620 $value1 = $this->objFormParam->getValue('classcategory_id1'); 621 622 // 規格2が設定されている場合. 623 if (SC_Utils_Ex::isBlank($this->objFormParam->getValue('classcategory_id2')) == false){ 624 $value2 = '#' . $this->objFormParam->getValue('classcategory_id2'); 625 } else { 626 $value2 = '#0'; 627 } 628 629 if (strlen($value1) === 0) { 630 $value1 = '__unselected'; 631 } 632 633 $this->tpl_product_class_id = $objProduct->classCategories[$product_id][$value1][$value2]['product_class_id']; 634 635 // この段階では、数量の入力チェックエラーを出させない。 636 unset($this->arrErr['quantity']); 637 638 // 数量の入力を行う 639 $this->tpl_mainpage = 'products/select_item.tpl'; 640 } 641 642 /** 643 * 644 * @return void 645 */ 646 function doMobileCart() { 647 // この段階でエラーが出る場合は、数量の入力エラーのはず 648 if (count($this->arrErr)) { 649 // 数量の入力を行う 650 $this->tpl_mainpage = 'products/select_item.tpl'; 651 } 652 } 653 654 /** 655 * 656 * @return void 657 */ 658 function doMobileDefault() { 659 $this->tpl_mainpage = 'products/detail.tpl'; 660 } 579 661 }
Note: See TracChangeset
for help on using the changeset viewer.