Changeset 23435 for branches/version-2_13-dev/data/class/pages/admin
- Timestamp:
- 2014/05/20 17:56:50 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php
r23124 r23435 67 67 public function action() 68 68 { 69 $objDb = new SC_Helper_DB_Ex();70 69 $objFormParam = new SC_FormParam_Ex(); 71 70 $objCategory = new SC_Helper_Category_Ex(); … … 87 86 // カテゴリ削除 88 87 case 'delete': 89 $this->doDelete($objFormParam , $objDb);88 $this->doDelete($objFormParam); 90 89 break; 91 90 // 表示順を上へ … … 194 193 * 195 194 * @param SC_FormParam $objFormParam 196 * @ param SC_Helper_Db $objDb197 * @return void198 */199 public function doDelete(&$objFormParam, &$objDb)200 {195 * @return void 196 */ 197 public function doDelete(&$objFormParam) 198 { 199 $objCategory = new SC_Helper_Category_Ex(false); 201 200 $category_id = $objFormParam->getValue('category_id'); 202 $objQuery =& SC_Query_Ex::getSingletonInstance();203 201 204 202 // 子カテゴリのチェック 205 $where = 'parent_category_id = ? AND del_flg = 0'; 206 $exists = $objQuery->exists('dtb_category', $where, array($category_id)); 207 if ($exists) { 203 $arrBranch = $objCategory->getTreeBranch($category_id); 204 if (count($arrBranch) > 0) { 208 205 $this->arrErr['category_name'] = '※ 子カテゴリが存在するため削除できません。<br/>'; 209 210 206 return; 211 207 } 212 208 // 登録商品のチェック 213 $table = 'dtb_product_categories AS T1 LEFT JOIN dtb_products AS T2 ON T1.product_id = T2.product_id'; 214 $where = 'T1.category_id = ? AND T2.del_flg = 0'; 215 $exists = $objQuery->exists($table, $where, array($category_id)); 216 if ($exists) { 209 $arrCategory = $objCategory->get($category_id); 210 if ($arrCategory['product_count'] > 0) { 217 211 $this->arrErr['category_name'] = '※ カテゴリ内に商品が存在するため削除できません。<br/>'; 218 219 212 return; 220 213 } 221 214 222 215 // ランク付きレコードの削除(※処理負荷を考慮してレコードごと削除する。) 223 $obj Db->sfDeleteRankRecord('dtb_category', 'category_id', $category_id, '', true);216 $objCategory->delete($category_id); 224 217 } 225 218
Note: See TracChangeset
for help on using the changeset viewer.
