- Timestamp:
- 2012/07/04 10:13:22 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_Detail.php
r21953 r21957 149 149 switch ($this->mode) { 150 150 case 'cart': 151 $this->doCart(); 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 } 152 164 break; 153 154 165 case 'add_favorite': 155 $this->doAddFavorite($objCustomer); 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 } 156 179 break; 157 180 158 181 case 'add_favorite_sphone': 159 $this->doAddFavoriteSphone($objCustomer); 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 } 160 198 break; 161 199 … … 171 209 172 210 default: 173 $this->doDefault(); 211 // カート「戻るボタン」用に保持 212 $netURL = new Net_URL(); 213 $_SESSION['cart_referer_url'] = $netURL->getURL(); 174 214 break; 175 215 } … … 179 219 switch ($this->mode) { 180 220 case 'select': 181 $this->doMobileSelect(); 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'; 182 230 break; 183 231 184 232 case 'select2': 185 $this->doMobileSelect2(); 186 break; 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 } 187 249 188 250 case 'selectItem': 189 $this->doMobileSelectItem(); 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'; 190 280 break; 191 281 192 282 case 'cart': 193 $this->doMobileCart(); 283 // この段階でエラーが出る場合は、数量の入力エラーのはず 284 if (count($this->arrErr)) { 285 // 数量の入力を行う 286 $this->tpl_mainpage = 'products/select_item.tpl'; 287 } 194 288 break; 195 289 196 290 default: 197 $this-> doMobileDefault();291 $this->tpl_mainpage = 'products/detail.tpl'; 198 292 break; 199 293 } … … 483 577 } 484 578 } 485 486 /**487 * Add product(s) into the cart.488 *489 * @return void490 */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 $objCustomer511 * @return void512 */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 $objCustomer533 * @return void534 */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 void558 */559 function doDefault() {560 // カート「戻るボタン」用に保持561 $netURL = new Net_URL();562 $_SESSION['cart_referer_url'] = $netURL->getURL();563 }564 565 /**566 *567 * @return void568 */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 type584 */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 void609 */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 void645 */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 void657 */658 function doMobileDefault() {659 $this->tpl_mainpage = 'products/detail.tpl';660 }661 579 }
Note: See TracChangeset
for help on using the changeset viewer.