Changeset 18378
- Timestamp:
- 2009/11/11 11:00:03 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php
r18304 r18378 116 116 case 'pre_edit': 117 117 case 'copy' : 118 // 編集時 119 if(SC_Utils_Ex::sfIsInt($_POST['product_id'])){ 120 // DBから商品情報の読込 121 $arrForm = $this->lfGetProduct($_POST['product_id']); 122 // DBデータから画像ファイル名の読込 123 $this->objUpFile->setDBFileList($arrForm); 124 125 if($_POST['mode'] == "copy"){ 126 $arrForm["copy_product_id"] = $arrForm["product_id"]; 127 $arrForm["product_id"] = ""; 128 // 画像ファイルのコピー 129 $arrKey = $this->objUpFile->keyname; 130 $arrSaveFile = $this->objUpFile->save_file; 131 132 foreach($arrSaveFile as $key => $val){ 133 $this->lfMakeScaleImage($arrKey[$key], $arrKey[$key], true); 134 } 118 if (!SC_Utils_Ex::sfIsInt($_POST['product_id'])) { 119 SC_Utils_Ex::sfDispException(); 120 } 121 122 // DBから商品情報の読込 123 $this->arrForm = $this->lfGetProduct($_POST['product_id']); 124 // DBデータから画像ファイル名の読込 125 $this->objUpFile->setDBFileList($this->arrForm); 126 127 // 商品ステータスの変換 128 $arrRet = SC_Utils_Ex::sfSplitCBValue($this->arrForm['product_flag'], "product_flag"); 129 $this->arrForm = array_merge($this->arrForm, $arrRet); 130 // DBから関連商品の読み込み 131 $this->lfPreGetRecommendProducts($_POST['product_id']); 132 133 $this->lfProductPage(); // 商品登録ページ 134 135 if($_POST['mode'] == "copy"){ 136 $this->arrForm["copy_product_id"] = $this->arrForm["product_id"]; 137 $this->arrForm["product_id"] = ""; 138 // 画像ファイルのコピー 139 $arrKey = $this->objUpFile->keyname; 140 $arrSaveFile = $this->objUpFile->save_file; 141 142 foreach($arrSaveFile as $key => $val){ 143 $this->lfMakeScaleImage($arrKey[$key], $arrKey[$key], true); 135 144 } 136 $this->arrForm = $arrForm;137 138 // 商品ステータスの変換139 $arrRet = SC_Utils_Ex::sfSplitCBValue($this->arrForm['product_flag'], "product_flag");140 $this->arrForm = array_merge($this->arrForm, $arrRet);141 // DBから関連商品の読み込み142 $this->arrRecommend = $this->lfPreGetRecommendProducts($_POST['product_id']);143 144 $this->lfProductPage(); // 商品登録ページ145 145 } 146 146 break; … … 207 207 } 208 208 209 if($_POST['mode'] != 'pre_edit') { 210 // 関連商品の読み込み 211 $this->arrRecommend = $this->lfGetRecommendProducts(); 212 } 209 // 関連商品の読み込み 210 $this->arrRecommend = $this->lfGetRecommendProducts(); 213 211 214 212 // 基本情報を渡す … … 249 247 } 250 248 251 /* 関連商品の読み込み */ 249 /** 250 * 関連商品の名称などを商品マスタから読み込み、一つの配列にまとめて返す 251 * 252 * @return array 関連商品の情報を格納した2次元配列 253 */ 252 254 function lfGetRecommendProducts() { 253 255 $objQuery = new SC_Query(); … … 258 260 $commentkey = "recommend_comment" . $i; 259 261 260 if (!isset($ _POST[$delkey])) $_POST[$delkey] = null;261 262 if((isset($ _POST[$keyname]) && !empty($_POST[$keyname])) && $_POST[$delkey] != 1) {263 $arrRet = $objQuery->select("main_list_image, product_code_min, name", "vw_products_allclass AS allcls", "product_id = ?", array($ _POST[$keyname]));262 if (!isset($this->arrForm[$delkey])) $this->arrForm[$delkey] = null; 263 264 if((isset($this->arrForm[$keyname]) && !empty($this->arrForm[$keyname])) && $this->arrForm[$delkey] != 1) { 265 $arrRet = $objQuery->select("main_list_image, product_code_min, name", "vw_products_allclass AS allcls", "product_id = ?", array($this->arrForm[$keyname])); 264 266 $arrRecommend[$i] = $arrRet[0]; 265 $arrRecommend[$i]['product_id'] = $ _POST[$keyname];267 $arrRecommend[$i]['product_id'] = $this->arrForm[$keyname]; 266 268 $arrRecommend[$i]['comment'] = $this->arrForm[$commentkey]; 267 269 } … … 296 298 } 297 299 298 /* 登録済み関連商品の読み込み */ 300 /** 301 * 指定商品の関連商品をDBから読み込む 302 * 303 * @param string $product_id 商品ID 304 * @return void 305 */ 299 306 function lfPreGetRecommendProducts($product_id) { 300 $arrRecommend = array();301 307 $objQuery = new SC_Query(); 302 308 $objQuery->setorder("rank DESC"); 303 309 $arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id)); 304 $max = count($arrRet);305 310 $no = 1; 306 311 307 for($i = 0; $i < $max; $i++) { 308 $arrProductInfo = $objQuery->select("main_list_image, product_code_min, name", "vw_products_allclass AS allcls", "product_id = ?", array($arrRet[$i]['recommend_product_id'])); 309 $arrRecommend[$no] = $arrProductInfo[0]; 310 $arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id']; 311 $arrRecommend[$no]['comment'] = $arrRet[$i]['comment']; 312 foreach ($arrRet as $ret) { 313 $this->arrForm['recommend_id' . $no] = $ret['recommend_product_id']; 314 $this->arrForm['recommend_comment' . $no] = $ret['comment']; 312 315 $no++; 313 316 } 314 return $arrRecommend;315 317 } 316 318
Note: See TracChangeset
for help on using the changeset viewer.