Changeset 18833 for branches/version-2_5-dev/data/class
- Timestamp:
- 2010/09/30 15:08:00 (14 years ago)
- bzr:base-revision:
- ohkouchi@loop-az.jp-20100929090334-re3rzc4b55n2u27e
- bzr:committer:
- Kentaro Ohkouchi <ohkouchi@loop-az.jp>
- bzr:file-ids:
data/Smarty/templates/default/cart/index.tpl 15732@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Fcart%2Findex.tpl
data/Smarty/templates/default/detail.tpl 15747@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Fdetail.tpl
data/Smarty/templates/default/list.tpl 15747@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Flist.tpl
data/Smarty/templates/default/shopping/confirm.tpl 15732@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Fshopping%2Fconfirm.tpl
data/class/SC_CartSession.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2FSC_CartSession.php
data/class/SC_Product.php 18277@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcomu-ver2%2Fdata%2Fclass%2FSC_Product.php
data/class/helper/SC_Helper_DB.php 15176@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fhelper%2FSC_Helper_DB.php
data/class/pages/cart/LC_Page_Cart.php 15179@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fcart%2FLC_Page_Cart.php
data/class/pages/products/LC_Page_Products_Detail.php 15154@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fproducts%2FLC_Page_Products_Detail.php
data/class/pages/products/LC_Page_Products_List.php 15154@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fproducts%2FLC_Page_Products_List.php
data/class/pages/shopping/LC_Page_Shopping_Confirm.php 15223@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fshopping%2FLC_Page_Shopping_Confirm.php
data/install.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Finstall.php- bzr:mapping-version:
- v4
- bzr:merge:
ohkouchi@loop-az.jp-20100929085951-ed40npvm1q5txdmv- bzr:repository-uuid:
- 1e3b908f-19a9-db11-a64c-001125224ba8
- bzr:revision-id:
- ohkouchi@loop-az.jp-20100930060755-1z3dc9de1pcn9jrj
- bzr:revno:
- 2314
- bzr:revprop:branch-nick:
- branches/version-2_5-dev
- bzr:root:
- branches/version-2_5-dev
- bzr:text-revisions:
data/class/SC_Product.php ohkouchi@loop-az.jp-20100928093438-g5wswg21p437hwy6
data/class/pages/products/LC_Page_Products_List.php ohkouchi@loop-az.jp-20100928093438-g5wswg21p437hwy6- bzr:timestamp:
- 2010-09-30 15:07:55.907999992 +0900
- bzr:user-agent:
- bzr2.2.0+bzr-svn1.0.3
- svn:original-date:
- 2010-09-30T06:07:55.908000Z
- Location:
- branches/version-2_5-dev/data/class
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_CartSession.php
r18830 r18833 24 24 /* カートセッション管理クラス */ 25 25 class SC_CartSession { 26 var $key;27 26 var $key_tmp; // ユニークIDを指定する。 28 27 29 28 /* コンストラクタ */ 30 function SC_CartSession($key = 'cart') { 31 SC_Utils::sfDomainSessionStart(); 32 33 if($key == "") $key = "cart"; 34 $this->key = $key; 29 function SC_CartSession() { 35 30 } 36 31 … … 52 47 53 48 // 商品購入中の変更があったかをチェックする。 54 function getCancelPurchase() { 55 $ret = isset($_SESSION[$this->key]['cancel_purchase']) 56 ? $_SESSION[$this->key]['cancel_purchase'] : ""; 57 $_SESSION[$this->key]['cancel_purchase'] = false; 49 function getCancelPurchase($key) { 50 $this->addKey($key); 51 $ret = isset($_SESSION[$key]['cancel_purchase']) 52 ? $_SESSION[$key]['cancel_purchase'] : ""; 53 $_SESSION[$key]['cancel_purchase'] = false; 58 54 return $ret; 59 55 } 60 56 61 57 // 購入処理中に商品に変更がなかったかを判定 62 function checkChangeCart() { 58 function checkChangeCart($key) { 59 $this->addKey($key); 63 60 $change = false; 64 61 $max = $this->getMax(); 65 62 for($i = 1; $i <= $max; $i++) { 66 if ($_SESSION[$ this->key][$i]['quantity'] != $_SESSION[$this->key_tmp][$i]['quantity']) {63 if ($_SESSION[$key][$i]['quantity'] != $_SESSION[$this->key_tmp][$i]['quantity']) { 67 64 $change = true; 68 65 break; 69 66 } 70 if ($_SESSION[$ this->key][$i]['id'] != $_SESSION[$this->key_tmp][$i]['id']) {67 if ($_SESSION[$key][$i]['id'] != $_SESSION[$this->key_tmp][$i]['id']) { 71 68 $change = true; 72 69 break; … … 76 73 // 一時カートのクリア 77 74 unset($_SESSION[$this->key_tmp]); 78 $_SESSION[$ this->key]['cancel_purchase'] = true;75 $_SESSION[$key]['cancel_purchase'] = true; 79 76 } else { 80 $_SESSION[$ this->key]['cancel_purchase'] = false;81 } 82 return $_SESSION[$ this->key]['cancel_purchase'];77 $_SESSION[$key]['cancel_purchase'] = false; 78 } 79 return $_SESSION[$key]['cancel_purchase']; 83 80 } 84 81 85 82 // 次に割り当てるカートのIDを取得する 86 function getNextCartID() { 87 foreach($_SESSION[$this->key] as $key => $val){ 88 $arrRet[] = $_SESSION[$this->key][$key]['cart_no']; 83 function getNextCartID($key) { 84 $this->addKey($key); 85 foreach($_SESSION[$key] as $k => $val){ 86 $arrRet[] = $_SESSION[$key][$k]['cart_no']; 89 87 } 90 88 return (max($arrRet) + 1); … … 98 96 * @return string 商品ごとの合計価格(税込み) 99 97 */ 100 function getProductTotal($id) { 98 function getProductTotal($id, $key) { 99 $this->addKey($key); 101 100 $max = $this->getMax(); 102 101 for($i = 0; $i <= $max; $i++) { 103 if(isset($_SESSION[$ this->key][$i]['id'])104 && $_SESSION[$ this->key][$i]['id'] == $id) {102 if(isset($_SESSION[$key][$i]['id']) 103 && $_SESSION[$key][$i]['id'] == $id) { 105 104 106 105 // 税込み合計 107 $price = $_SESSION[$ this->key][$i]['price'];108 $quantity = $_SESSION[$ this->key][$i]['quantity'];106 $price = $_SESSION[$key][$i]['price']; 107 $quantity = $_SESSION[$key][$i]['quantity']; 109 108 $pre_tax = SC_Helper_DB_Ex::sfPreTax($price); 110 109 $total = $pre_tax * $quantity; … … 116 115 117 116 // 値のセット 118 function setProductValue($id, $key, $val) { 119 $max = $this->getMax(); 120 for($i = 0; $i <= $max; $i++) { 121 if(isset($_SESSION[$this->key][$i]['id']) 122 && $_SESSION[$this->key][$i]['id'] == $id) { 123 $_SESSION[$this->key][$i][$key] = $val; 117 function setProductValue($id, $k, $val, $key) { 118 $this->addKey($key); 119 $max = $this->getMax($key); 120 for($i = 0; $i <= $max; $i++) { 121 if(isset($_SESSION[$key][$i]['id']) 122 && $_SESSION[$key][$i]['id'] == $id) { 123 $_SESSION[$key][$i][$k] = $val; 124 124 } 125 125 } … … 127 127 128 128 // カート内商品の最大要素番号を取得する。 129 function getMax() { 129 function getMax($key) { 130 $this->addKey($key); 130 131 $cnt = 0; 131 132 $pos = 0; 132 133 $max = 0; 133 if (count($_SESSION[$ this->key]) > 0){134 foreach($_SESSION[$ this->key] as $key=> $val) {135 if (is_numeric($k ey)) {136 if($max < $k ey) {137 $max = $k ey;134 if (count($_SESSION[$key]) > 0){ 135 foreach($_SESSION[$key] as $k => $val) { 136 if (is_numeric($k)) { 137 if($max < $k) { 138 $max = $k; 138 139 } 139 140 } … … 144 145 145 146 // カート内商品数の合計 146 function getTotalQuantity() { 147 function getTotalQuantity($key) { 148 $this->addKey($key); 147 149 $total = 0; 148 $max = $this->getMax( );149 for($i = 0; $i <= $max; $i++) { 150 $total+= $_SESSION[$ this->key][$i]['quantity'];150 $max = $this->getMax($key); 151 for($i = 0; $i <= $max; $i++) { 152 $total+= $_SESSION[$key][$i]['quantity']; 151 153 } 152 154 return $total; … … 155 157 156 158 // 全商品の合計価格 157 function getAllProductsTotal() { 159 function getAllProductsTotal($key) { 160 $this->addKey($key); 158 161 // 税込み合計 159 162 $total = 0; 160 $max = $this->getMax( );161 for($i = 0; $i <= $max; $i++) { 162 163 if (!isset($_SESSION[$ this->key][$i]['price'])) {164 $_SESSION[$ this->key][$i]['price'] = "";165 } 166 $price = $_SESSION[$ this->key][$i]['price'];167 168 if (!isset($_SESSION[$ this->key][$i]['quantity'])) {169 $_SESSION[$ this->key][$i]['quantity'] = "";170 } 171 $quantity = $_SESSION[$ this->key][$i]['quantity'];163 $max = $this->getMax($key); 164 for($i = 0; $i <= $max; $i++) { 165 166 if (!isset($_SESSION[$key][$i]['price'])) { 167 $_SESSION[$key][$i]['price'] = ""; 168 } 169 $price = $_SESSION[$key][$i]['price']; 170 171 if (!isset($_SESSION[$key][$i]['quantity'])) { 172 $_SESSION[$key][$i]['quantity'] = ""; 173 } 174 $quantity = $_SESSION[$key][$i]['quantity']; 172 175 173 176 $pre_tax = SC_Helper_DB_Ex::sfPreTax($price); … … 178 181 179 182 // 全商品の合計税金 180 function getAllProductsTax() { 183 function getAllProductsTax($key) { 184 $this->addKey($key); 181 185 // 税合計 182 186 $total = 0; 183 $max = $this->getMax( );184 for($i = 0; $i <= $max; $i++) { 185 $price = $_SESSION[$ this->key][$i]['price'];186 $quantity = $_SESSION[$ this->key][$i]['quantity'];187 $max = $this->getMax($key); 188 for($i = 0; $i <= $max; $i++) { 189 $price = $_SESSION[$key][$i]['price']; 190 $quantity = $_SESSION[$key][$i]['quantity']; 187 191 $tax = SC_Helper_DB_Ex::sfTax($price); 188 192 $total+= ($tax * $quantity); … … 192 196 193 197 // 全商品の合計ポイント 194 function getAllProductsPoint() { 198 function getAllProductsPoint($key) { 199 $this->addKey($key); 195 200 // ポイント合計 196 201 $total = 0; 197 202 if (USE_POINT !== false) { 198 $max = $this->getMax( );203 $max = $this->getMax($key); 199 204 for($i = 0; $i <= $max; $i++) { 200 $price = $_SESSION[$ this->key][$i]['price'];201 $quantity = $_SESSION[$ this->key][$i]['quantity'];202 203 if (!isset($_SESSION[$ this->key][$i]['point_rate'])) {204 $_SESSION[$ this->key][$i]['point_rate'] = "";205 } 206 $point_rate = $_SESSION[$ this->key][$i]['point_rate'];207 208 if (!isset($_SESSION[$ this->key][$i]['id'][0])) {209 $_SESSION[$ this->key][$i]['id'][0] = "";210 } 211 $id = $_SESSION[$ this->key][$i]['id'][0];205 $price = $_SESSION[$key][$i]['price']; 206 $quantity = $_SESSION[$key][$i]['quantity']; 207 208 if (!isset($_SESSION[$key][$i]['point_rate'])) { 209 $_SESSION[$key][$i]['point_rate'] = ""; 210 } 211 $point_rate = $_SESSION[$key][$i]['point_rate']; 212 213 if (!isset($_SESSION[$key][$i]['id'][0])) { 214 $_SESSION[$key][$i]['id'][0] = ""; 215 } 216 $id = $_SESSION[$key][$i]['id'][0]; 212 217 $point = SC_Utils_Ex::sfPrePoint($price, $point_rate, POINT_RULE, $id); 213 218 $total+= ($point * $quantity); … … 218 223 219 224 // カートへの商品追加 220 function addProduct($id, $quantity, $campaign_id = "") { 225 function addProduct($id, $quantity, $key) { 226 $this->addKey($key); 221 227 $find = false; 222 $max = $this->getMax( );223 for($i = 0; $i <= $max; $i++) { 224 225 if($_SESSION[$ this->key][$i]['id'] == $id) {226 $val = $_SESSION[$ this->key][$i]['quantity'] + $quantity;228 $max = $this->getMax($key); 229 for($i = 0; $i <= $max; $i++) { 230 231 if($_SESSION[$key][$i]['id'] == $id) { 232 $val = $_SESSION[$key][$i]['quantity'] + $quantity; 227 233 if(strlen($val) <= INT_LEN) { 228 $_SESSION[$this->key][$i]['quantity']+= $quantity; 229 if(!empty($campaign_id)){ 230 $_SESSION[$this->key][$i]['campaign_id'] = $campaign_id; 231 $_SESSION[$this->key][$i]['is_campaign'] = true; 232 } 234 $_SESSION[$key][$i]['quantity']+= $quantity; 233 235 } 234 236 $find = true; … … 236 238 } 237 239 if(!$find) { 238 $_SESSION[$this->key][$max+1]['id'] = $id; 239 $_SESSION[$this->key][$max+1]['quantity'] = $quantity; 240 $_SESSION[$this->key][$max+1]['cart_no'] = $this->getNextCartID(); 241 if(!empty($campaign_id)){ 242 $_SESSION[$this->key][$max+1]['campaign_id'] = $campaign_id; 243 $_SESSION[$this->key][$max+1]['is_campaign'] = true; 244 } 240 $_SESSION[$key][$max+1]['id'] = $id; 241 $_SESSION[$key][$max+1]['quantity'] = $quantity; 242 $_SESSION[$key][$max+1]['cart_no'] = $this->getNextCartID($key); 245 243 } 246 244 } 247 245 248 246 // 前頁のURLを記録しておく 249 function setPrevURL($url) { 247 function setPrevURL($url, $key) { 248 $this->addKey($key); 250 249 // 前頁として記録しないページを指定する。 251 250 $arrExclude = array( … … 262 261 // 除外ページでない場合は、前頁として記録する。 263 262 if(!$exclude) { 264 $_SESSION[$ this->key]['prev_url'] = $url;263 $_SESSION[$key]['prev_url'] = $url; 265 264 } 266 265 } 267 266 268 267 // 前頁のURLを取得する 269 function getPrevURL() { 270 return isset($_SESSION[$this->key]['prev_url']) 271 ? $_SESSION[$this->key]['prev_url'] : ""; 268 function getPrevURL($key) { 269 $this->addKey($key); 270 return isset($_SESSION[$key]['prev_url']) 271 ? $_SESSION[$key]['prev_url'] : ""; 272 272 } 273 273 274 274 // キーが一致した商品の削除 275 function delProductKey($keyname, $val) { 276 $max = count($_SESSION[$this->key]); 275 function delProductKey($keyname, $val, $key) { 276 $this->addKey($key); 277 $max = count($_SESSION[$key]); 277 278 for($i = 0; $i < $max; $i++) { 278 if($_SESSION[$this->key][$i][$keyname] == $val) { 279 unset($_SESSION[$this->key][$i]); 280 } 281 } 282 } 283 284 function setValue($key, $val) { 285 $_SESSION[$this->key][$key] = $val; 286 } 287 288 function getValue($key) { 289 return $_SESSION[$this->key][$key]; 290 } 291 292 function getCartList() { 279 if($_SESSION[$key][$i][$keyname] == $val) { 280 unset($_SESSION[$key][$i]); 281 } 282 } 283 } 284 285 function setValue($k, $val, $key) { 286 $this->addKey($key); 287 $_SESSION[$key][$k] = $val; 288 } 289 290 function getValue($k, $key) { 291 $this->addKey($key); 292 return $_SESSION[$key][$k]; 293 } 294 295 function getCartList($key) { 296 $this->addKey($key); 297 $max = $this->getMax($key); 298 $arrRet = array(); 299 for($i = 0; $i <= $max; $i++) { 300 if(isset($_SESSION[$key][$i]['cart_no']) 301 && $_SESSION[$key][$i]['cart_no'] != "") { 302 $arrRet[] = $_SESSION[$key][$i]; 303 } 304 } 305 return $arrRet; 306 } 307 308 // カート内にある商品IDを全て取得する 309 function getAllProductID($key) { 310 $this->addKey($key); 311 $max = $this->getMax($key); 312 for($i = 0; $i <= $max; $i++) { 313 if($_SESSION[$key][$i]['cart_no'] != "") { 314 $arrRet[] = $_SESSION[$key][$i]['id'][0]; 315 } 316 } 317 return $arrRet; 318 } 319 // カート内にある商品ID+カテゴリIDを全て取得する 320 function getAllProductClassID($key) { 321 $this->addKey($key); 322 $max = $this->getMax($key); 323 for($i = 0; $i <= $max; $i++) { 324 if($_SESSION[$key][$i]['cart_no'] != "") { 325 $arrRet[] = $_SESSION[$key][$i]['id']; 326 } 327 } 328 return $arrRet; 329 } 330 331 function delAllProducts($key) { 332 $this->addKey($key); 333 $max = $this->getMax($key); 334 for($i = 0; $i <= $max; $i++) { 335 unset($_SESSION[$key][$i]); 336 } 337 } 338 339 // 商品の削除 340 function delProduct($cart_no, $key) { 341 $this->addKey($key); 342 $max = $this->getMax($key); 343 for($i = 0; $i <= $max; $i++) { 344 if($_SESSION[$key][$i]['cart_no'] == $cart_no) { 345 unset($_SESSION[$key][$i]); 346 } 347 } 348 } 349 350 // 数量の増加 351 function upQuantity($cart_no, $key) { 352 $this->addKey($key); 293 353 $max = $this->getMax(); 294 $arrRet = array();295 for($i = 0; $i <= $max; $i++) {296 if(isset($_SESSION[$this->key][$i]['cart_no'])297 && $_SESSION[$this->key][$i]['cart_no'] != "") {298 $arrRet[] = $_SESSION[$this->key][$i];299 } 300 } 301 return $arrRet;302 } 303 304 // カート内にある商品IDを全て取得する305 function getAllProductID() {354 for($i = 0; $i <= $max; $i++) { 355 if($_SESSION[$key][$i]['cart_no'] == $cart_no) { 356 if(strlen($_SESSION[$key][$i]['quantity'] + 1) <= INT_LEN) { 357 $_SESSION[$key][$i]['quantity']++; 358 } 359 } 360 } 361 } 362 363 // 数量の減少 364 function downQuantity($cart_no, $key) { 365 $this->addKey($key); 306 366 $max = $this->getMax(); 307 367 for($i = 0; $i <= $max; $i++) { 308 if($_SESSION[$this->key][$i]['cart_no'] != "") { 309 $arrRet[] = $_SESSION[$this->key][$i]['id'][0]; 310 } 311 } 312 return $arrRet; 313 } 314 // カート内にある商品ID+カテゴリIDを全て取得する 315 function getAllProductClassID() { 316 $max = $this->getMax(); 317 for($i = 0; $i <= $max; $i++) { 318 if($_SESSION[$this->key][$i]['cart_no'] != "") { 319 $arrRet[] = $_SESSION[$this->key][$i]['id']; 320 } 321 } 322 return $arrRet; 323 } 324 325 function delAllProducts() { 326 $max = $this->getMax(); 327 for($i = 0; $i <= $max; $i++) { 328 unset($_SESSION[$this->key][$i]); 329 } 330 } 331 332 // 商品の削除 333 function delProduct($cart_no) { 334 $max = $this->getMax(); 335 for($i = 0; $i <= $max; $i++) { 336 if($_SESSION[$this->key][$i]['cart_no'] == $cart_no) { 337 unset($_SESSION[$this->key][$i]); 338 } 339 } 340 } 341 342 // 数量の増加 343 function upQuantity($cart_no) { 344 $max = $this->getMax(); 345 for($i = 0; $i <= $max; $i++) { 346 if($_SESSION[$this->key][$i]['cart_no'] == $cart_no) { 347 if(strlen($_SESSION[$this->key][$i]['quantity'] + 1) <= INT_LEN) { 348 $_SESSION[$this->key][$i]['quantity']++; 349 } 350 } 351 } 352 } 353 354 // 数量の減少 355 function downQuantity($cart_no) { 356 $max = $this->getMax(); 357 for($i = 0; $i <= $max; $i++) { 358 if($_SESSION[$this->key][$i]['cart_no'] == $cart_no) { 359 if($_SESSION[$this->key][$i]['quantity'] > 1) { 360 $_SESSION[$this->key][$i]['quantity']--; 361 } 362 } 363 } 368 if($_SESSION[$key][$i]['cart_no'] == $cart_no) { 369 if($_SESSION[$key][$i]['quantity'] > 1) { 370 $_SESSION[$key][$i]['quantity']--; 371 } 372 } 373 } 374 } 375 376 function addKey($key) { 377 if (!in_array($this->keys, $key)) { 378 $this->keys[] = $key; 379 } 380 } 381 382 function getKeys() { 383 return $this->keys; 364 384 } 365 385 -
branches/version-2_5-dev/data/class/SC_Product.php
r18829 r18833 176 176 $classCategories['']['']['name'] = '選択してください'; 177 177 $classCategories['']['']['product_class_id'] = $arrProductClass[0]['product_class_id']; 178 // 商品種別 TODO 暫定的に down を使用する 179 $classCategories['']['']['product_type'] = $arrProductClass[0]['down']; 178 180 $this->product_class_id[$productId] = $arrProductClass[0]['product_class_id']; 181 // 商品種別 TODO 暫定的に down を使用する 182 $this->product_type[$productId] = $arrProductClass[0]['down']; 179 183 foreach ($arrProductClass as $productsClass) { 180 184 $productsClass1 = $productsClass['classcategory_id1']; … … 217 221 // 商品規格ID 218 222 $classCategories[$productsClass1][$productsClass2]['product_class_id'] = $productsClass['product_class_id']; 223 // 商品種別 TODO 暫定的に down を使用する 224 $classCategories[$productsClass1][$productsClass2]['product_type'] = $productsClass['down']; 219 225 } 220 226 -
branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_List.php
r18829 r18833 476 476 $this->tpl_stock_find = $objProduct->stock_find; 477 477 $this->tpl_product_class_id = $objProduct->product_class_id; 478 $this->tpl_product_type = $objProduct->product_type; 478 479 479 480 $productsClassCategories = $objProduct->classCategories;
Note: See TracChangeset
for help on using the changeset viewer.