Changeset 19843
- Timestamp:
- 2011/01/06 18:50:32 (13 years ago)
- Location:
- branches/version-2_5-dev/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/Smarty/templates/mobile/products/select_item.tpl
r19833 r19843 34 34 <input type="hidden" name="classcategory_id2" value="<!--{$arrForm.classcategory_id2.value}-->"> 35 35 <input type="hidden" name="product_id" value="<!--{$tpl_product_id}-->"> 36 <input type="hidden" name="product_class_id" value="<!--{$tpl_product_class_id}-->"> 37 <input type="hidden" name="product_type" value="<!--{$tpl_product_type}-->"> 36 38 <center><input type="submit" name="submit" value="かごに入れる"></center> 37 39 </form> -
branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php
r19833 r19843 94 94 // XXX 削除可能か、SC_SiteViewクラスコンストラクタ内の処理を要確認 95 95 $objView = new SC_SiteView(strlen($_POST['mode']) == 0); 96 96 97 97 $objCustomer = new SC_Customer(); 98 98 $objDb = new SC_Helper_DB_Ex(); 99 $objProduct = new SC_Product();100 99 101 100 // ログイン中のユーザが商品をお気に入りにいれる処理 … … 133 132 134 133 // 規格選択セレクトボックスの作成 134 $this->lfMakeSelect($product_id); 135 136 $objProduct = new SC_Product(); 137 $objProduct->setProductsClassByProductIds(array($product_id)); 138 139 // 規格1クラス名 140 $this->tpl_class_name1 = $objProduct->className1[$product_id]; 141 142 // 規格2クラス名 143 $this->tpl_class_name2 = $objProduct->className2[$product_id]; 144 145 // 規格1 146 $this->arrClassCat1 = $objProduct->classCats1[$product_id]; 147 148 // 規格1が設定されている 149 $this->tpl_classcat_find1 = $objProduct->classCat1_find[$product_id]; 150 // 規格2が設定されている 151 $this->tpl_classcat_find2 = $objProduct->classCat2_find[$product_id]; 152 153 $this->tpl_stock_find = $objProduct->stock_find[$product_id]; 154 $this->tpl_product_class_id = $objProduct->classCategories[$product_id]['']['']['product_class_id']; 155 $this->tpl_product_type = $objProduct->classCategories[$product_id]['']['']['product_type']; 156 157 $objJson = new Services_JSON(); 158 $this->tpl_javascript .= 'classCategories = ' . $objJson->encode($objProduct->classCategories[$product_id]) . ';'; 159 $this->tpl_javascript .= 'function lnOnLoad(){' . $this->js_lnOnload . '}'; 160 $this->tpl_onload .= 'lnOnLoad();'; 161 162 // モバイル用 規格選択セレクトボックスの作成 135 163 if(Net_UserAgent_Mobile::isMobile() === true) { 136 164 $this->lfMakeSelectMobile($this, $product_id); 137 } else {138 $this->lfMakeSelect($product_id);139 140 $objProduct->setProductsClassByProductIds(array($product_id));141 142 // 規格1クラス名143 $this->tpl_class_name1 = $objProduct->className1[$product_id];144 145 // 規格2クラス名146 $this->tpl_class_name2 = $objProduct->className2[$product_id];147 148 // 規格1149 $this->arrClassCat1 = $objProduct->classCats1[$product_id];150 151 // 規格1が設定されている152 $this->tpl_classcat_find1 = $objProduct->classCat1_find[$product_id];153 // 規格2が設定されている154 $this->tpl_classcat_find2 = $objProduct->classCat2_find[$product_id];155 156 $this->tpl_stock_find = $objProduct->stock_find[$product_id];157 $this->tpl_product_class_id = $objProduct->classCategories[$product_id]['']['']['product_class_id'];158 $this->tpl_product_type = $objProduct->classCategories[$product_id]['']['']['product_type'];159 160 $objJson = new Services_JSON();161 $this->tpl_javascript .= 'classCategories = ' . $objJson->encode($objProduct->classCategories[$product_id]) . ';';162 $this->tpl_javascript .= 'function lnOnLoad(){' . $this->js_lnOnload . '}';163 $this->tpl_onload .= 'lnOnLoad();';164 165 } 165 166 … … 167 168 $this->tpl_product_id = $product_id; 168 169 169 // POSTされるmodeにより処理切り替え170 170 if (!isset($_POST['mode'])) $_POST['mode'] = ""; 171 172 switch($_POST['mode']) { 173 case 'cart': 174 // 入力値の変換 175 $this->objFormParam->convParam(); 176 $this->arrErr = $this->lfCheckError(); 177 if (count($this->arrErr) == 0) { 178 $objCartSess = new SC_CartSession(); 179 $classcategory_id1 = $_POST['classcategory_id1']; 180 $classcategory_id2 = $_POST['classcategory_id2']; 181 $product_class_id = $_POST['product_class_id']; 182 $product_type = $_POST['product_type']; 183 184 if (!empty($_POST['gmo_oneclick'])) { 185 $objCartSess->delAllProducts(); 186 } 187 188 // 規格1が設定されていない場合 189 if(!$this->tpl_classcat_find1) { 190 $classcategory_id1 = '0'; 191 } 192 193 // 規格2が設定されていない場合 194 if(!$this->tpl_classcat_find2) { 195 $classcategory_id2 = '0'; 196 } 197 $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'), $product_type); 198 199 if (!empty($_POST['gmo_oneclick'])) { 200 $objSiteSess = new SC_SiteSession; 201 $objSiteSess->setRegistFlag(); 202 $objCartSess->saveCurrentCart($objSiteSess->getUniqId()); 203 204 $this->objDisplay->redirect($this->getLocation( 205 URL_PATH . USER_DIR . 'gmopg_oneclick_confirm.php', array(), true)); 206 exit; 207 } 208 209 $this->objDisplay->redirect($this->getLocation(CART_URL_PATH)); 210 exit; 211 } 212 break; 213 214 default: 215 break; 216 } 217 218 // モバイル用 ポストバック処理 171 219 if(Net_UserAgent_Mobile::isMobile() === true) { 172 $this->lfPostActionMobile(); 173 } else { 174 $this->arrErr = $this->lfPostAction(); 220 switch($_POST['mode']) { 221 case 'select': 222 // 規格1が設定されている場合 223 echo $this->tpl_classcat_find1; 224 if($this->tpl_classcat_find1) { 225 // templateの変更 226 $this->tpl_mainpage = "products/select_find1.tpl"; 227 break; 228 } 229 230 case 'select2': 231 $this->arrErr = $this->lfCheckError(); 232 233 // 規格1が設定されている場合 234 if($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) { 235 // templateの変更 236 $this->tpl_mainpage = "products/select_find1.tpl"; 237 break; 238 } 239 240 // 規格2が設定されている場合 241 if($this->tpl_classcat_find2) { 242 $this->arrErr = array(); 243 244 $this->tpl_mainpage = "products/select_find2.tpl"; 245 break; 246 } 247 248 case 'selectItem': 249 $this->arrErr = $this->lfCheckError(); 250 251 // 規格1が設定されている場合 252 if($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) { 253 // templateの変更 254 $this->tpl_mainpage = "products/select_find2.tpl"; 255 break; 256 } 257 // 商品数の選択を行う 258 $this->tpl_mainpage = "products/select_item.tpl"; 259 break; 260 261 default: 262 $this->tpl_mainpage = "products/detail.tpl"; 263 break; 264 } 175 265 } 176 266 … … 221 311 function destroy() { 222 312 parent::destroy(); 223 }224 225 /**226 * POSTされるmodeにより処理切り替え227 *228 * @return array Error messages.229 */230 function lfPostAction() {231 $arrErr = array();232 233 switch($_POST['mode']) {234 case 'cart':235 // 入力値の変換236 $this->objFormParam->convParam();237 $arrErr = $this->lfCheckError();238 if (count($arrErr) == 0) {239 $objCartSess = new SC_CartSession();240 $classcategory_id1 = $_POST['classcategory_id1'];241 $classcategory_id2 = $_POST['classcategory_id2'];242 $product_class_id = $_POST['product_class_id'];243 $product_type = $_POST['product_type'];244 245 if (!empty($_POST['gmo_oneclick'])) {246 $objCartSess->delAllProducts();247 }248 249 // 規格1が設定されていない場合250 if(!$this->tpl_classcat_find1) {251 $classcategory_id1 = '0';252 }253 254 // 規格2が設定されていない場合255 if(!$this->tpl_classcat_find2) {256 $classcategory_id2 = '0';257 }258 $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'), $product_type);259 260 if (!empty($_POST['gmo_oneclick'])) {261 $objSiteSess = new SC_SiteSession;262 $objSiteSess->setRegistFlag();263 $objCartSess->saveCurrentCart($objSiteSess->getUniqId());264 265 $this->objDisplay->redirect($this->getLocation(266 URL_PATH . USER_DIR . 'gmopg_oneclick_confirm.php', array(), true));267 exit;268 }269 270 $this->objDisplay->redirect($this->getLocation(CART_URL_PATH));271 exit;272 }273 break;274 275 default:276 break;277 }278 279 return $arrErr;280 }281 282 /**283 * POSTされるmodeにより処理切り替え(モバイル)284 *285 * @return void286 */287 function lfPostActionMobile() {288 switch($_POST['mode']) {289 case 'select':290 // 規格1が設定されている場合291 if($this->tpl_classcat_find1) {292 // templateの変更293 $this->tpl_mainpage = "products/select_find1.tpl";294 break;295 }296 297 case 'select2':298 $this->arrErr = $this->lfCheckError();299 300 // 規格1が設定されている場合301 if($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) {302 // templateの変更303 $this->tpl_mainpage = "products/select_find1.tpl";304 break;305 }306 307 // 規格2が設定されている場合308 if($this->tpl_classcat_find2) {309 $this->arrErr = array();310 311 $this->tpl_mainpage = "products/select_find2.tpl";312 break;313 }314 315 case 'selectItem':316 $this->arrErr = $this->lfCheckError();317 318 // 規格1が設定されている場合319 if($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) {320 // templateの変更321 $this->tpl_mainpage = "products/select_find2.tpl";322 break;323 }324 // 商品数の選択を行う325 $this->tpl_mainpage = "products/select_item.tpl";326 break;327 328 case 'cart':329 // 入力値の変換330 $this->objFormParam->convParam();331 $this->arrErr = $this->lfCheckError();332 if(count($this->arrErr) == 0) {333 $objCartSess = new SC_CartSession();334 $product_class_id = $_POST['product_class_id'];335 $classcategory_id1 = $_POST['classcategory_id1'];336 $classcategory_id2 = $_POST['classcategory_id2'];337 338 // 規格1が設定されていない場合339 if(!$this->tpl_classcat_find1) {340 $classcategory_id1 = '0';341 }342 343 // 規格2が設定されていない場合344 if(!$this->tpl_classcat_find2) {345 $classcategory_id2 = '0';346 }347 348 $objCartSess->addProduct(array($_POST['product_id'], $product_class_id, $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity'));349 $this->objDisplay->redirect($this->getLocation(CART_URL_PATH));350 exit;351 }352 break;353 354 default:355 $this->tpl_mainpage = "products/detail.tpl";356 break;357 }358 313 } 359 314 … … 481 436 482 437 // 規格1が設定されている 483 if( $arrProductsClass[0]['classcategory_id1'] != '0') {438 if(isset($arrProductsClass[0]['classcategory_id1']) && $arrProductsClass[0]['classcategory_id1'] != '0') { 484 439 $classcat_find1 = true; 485 440 } 486 441 487 442 // 規格2が設定されている 488 if( $arrProductsClass[0]['classcategory_id2'] != '0') {443 if(isset($arrProductsClass[0]['classcategory_id2']) && $arrProductsClass[0]['classcategory_id2'] != '0') { 489 444 $classcat_find2 = true; 490 445 }
Note: See TracChangeset
for help on using the changeset viewer.