📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
e-ticaretv9.demodesign.com.tr
/
adminco
/
inc
📝
category_edit.php
← Geri Dön
<?php if(!defined('ADMIN_INCLUDED')) { exit; } ?> <?php $informations = $db->table('categories')->where('id','=',m_a_g('id'))->get(); if($informations['total_count']==0) { m_redirect(ADMIN_URL); } $info = $informations['data'][0]; ?> <div class="container-fluid"> <div class="row"> <div class="col-12"> <div class="page-title-box d-sm-flex align-items-center justify-content-between"> <a href="<?php echo ADMIN_URL; ?>/index.php?page=categories" class="menu_link"><h4 class="mb-sm-0 font-size-18"><?php echo LGA_CATEGORIES; ?></h4></a> <div class="page-title-right"> <ol class="breadcrumb m-0"> <li class="breadcrumb-item"><a href="<?php echo ADMIN_URL; ?>"><?php echo LGA_HOME; ?></a></li> <li class="breadcrumb-item active"><?php echo LGA_CATEGORIES; ?></li> </ol> </div> </div> </div> </div> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-header"> <h4 class="card-title"><?php echo LGA_CATEGORY_EDIT; ?></h4> </div> <div class="card-body p-4"> <?php if(m_p_check()) { if(DEMO) { echo m_admin_alert(LGA_ERROR,LGA_DEMO_ERROR); } else { if(m_a_p('c_id')==0 and $info['c_id']!=0) { // alt kategoriyse üst kategori oluyorsa $db->query("update products set c_id='[".$info['id']."]' where c_id LIKE '%[".$info['id']."]%'"); } else { if(m_a_p('c_id')!=0 and $info['c_id']==0) { // üst kategoriyse alt kategoriye çeviriliyorsa $sub_categories = $db->table('categories')->where('c_id','=',$info['id'])->get(); foreach($sub_categories['data'] as $sub_category) { $db->query("update categories set c_id='".m_a_p('c_id')."' where id='".$sub_category['id']."'"); $db->query("update products set c_id='[".m_a_p('c_id')."][".$sub_category['id']."]' where c_id LIKE '%[".$sub_category['id']."]%'"); } } else { // alt kategori ama üst kategorisi değişiyorsa if(m_u_p('c_id')!=0 and $info['c_id']!=0 and m_u_p('c_id')!=$info['c_id']) { $db->query("update products set c_id='[".m_a_p('c_id')."][".$info['id']."]' where c_id LIKE '%[".$info['id']."]%'"); } } } if($_FILES['image']['name']=='') { $image = m_a_p('old_image'); if($info['image']!='' and $image=='') { m_image_remover($info['image']); } } else { $upload = m_image_uploader('image','category_'.m_sef(m_a_p('title')).'_'.uniqid().'',true); if($upload[0]!='') { $image = $upload[0]; } } $data = [ 'image' => $image, 'c_id' => m_a_p('c_id'), 'title' => m_a_p('title'), 'seo_content' => m_content_tmp_replace(m_a_p('seo_content')), 'c_rank' => m_a_p('c_rank'), 'sef' => m_sef(m_a_p('title')), 'status' => m_a_p('status') ]; $query = $db->table('categories')->where('id','=',m_a_g('id'))->update($data); if($query) { echo m_admin_alert(LGA_SUCCESS,LGA_TRANSACTION_SUCCESS); } else { if($upload[0]!='') { m_image_remover($upload[0]); } echo m_admin_alert(LGA_ERROR,LGA_TRANSACTION_ERROR); } $informations = $db->table('categories')->where('id','=',m_a_g('id'))->get(); $info = $informations['data'][0]; } } ?> <form action="" method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-xl-6 col-lg-6 col-sm-12 order-xl-1 order-lg-1 order-2"> <div class="mb-3"> <div><label class="form-label"><?php echo LGA_STATUS; ?></label></div> <div class="switch-field"> <input type="radio" id="radio-one" name="status" value="1" <?php if($info['status']==1) { echo 'checked="checked"'; } ?> /> <label for="radio-one"><?php echo LGA_ENABLED; ?></label> <input type="radio" id="radio-two" name="status" value="0" <?php if($info['status']==0) { echo 'checked="checked"'; } ?> /> <label for="radio-two"><?php echo LGA_DISABLED; ?></label> </div> </div> <div class="mb-3"> <label class="form-label"><?php echo LGA_SUB_CATEGORY; ?></label> <select class="form-control select2" name="c_id"> <option value="0"><?php echo LGA_TOP_CATEGORY; ?></option> <?php $categories = $db->table('categories')->where('id','!=',$info['id'])->where('status','=','1')->order('title','asc')->get(); foreach($categories['data'] as $category) { if($info['c_id']==$category['id']) { $selected=' selected="selected"'; } else { $selected=''; } echo '<option value="'.$category['id'].'"'.$selected.'>'.$category['title'].'</option>'; } ?> <?php $categories_alt = $db->table('categories')->where('c_id','!=',0)->where('status','=',1)->order('title','asc')->get(); foreach($categories_alt['data'] as $alt_cat){ $ust_cat = ""; $id = $alt_cat['c_id']; while (true){ $ustbul = $db->table('categories')->where('id','=',$id)->get()['data'][0]; $ust_cat .= " ↩ ".$ustbul['title']; $id = $ustbul['c_id']; if($ustbul['c_id'] == 0){ break; } } if($info['c_id']==$alt_cat['id']) { $selected=' selected="selected"'; } else { $selected=''; } echo '<option value="'.$alt_cat['id'].' '.$selected.'">'.$alt_cat['title'].''.$ust_cat.'</option>'; } ?> </select> </div> <div class="mb-3"> <label class="form-label"><?php echo LGA_CATEGORY_NAME; ?></label> <input class="form-control" type="text" name="title" value="<?php echo $info['title']; ?>" required> </div> <div class="mb-3"> <label class="form-label"><?php echo LGA_RANK; ?></label> <input class="form-control" type="number" name="c_rank" value="<?php echo $info['c_rank']; ?>" required value="0"> </div> <div class="mb-3"> <label><?php echo LGA_CONTENT_ADD_IMAGE; ?></label> <div id="editor_image_input" class="mb-2"> <input class="form-control" id="editor_image_files" name="files[]" type="file" multiple accept="image/*"> </div> <br> <label class="form-label"><?php echo LGA_SEO_CONTENT; ?></label> <textarea class="summernote" name="seo_content"><?php echo $info['seo_content']; ?></textarea> <div style="float:right;margin-top:12px;margin-bottom:12px;"> <span class="btn btn-sm btn-secondary editor_content_word_count">0</span> </div> </div> </div> <div class="col-xl-6 col-lg-6 col-sm-12 order-xl-1 order-lg-1 order-1"> <div class="mb-3"> <div class="row"> <div class="col-lg-4 col-sm-12"> <label for="image_upload"><a href="<?php echo m_image_url($info['image']); ?>" data-fancybox=""><img class="img-thumbnail preview_image_url" style="max-width:200px;max-height:200px;object-fit: contain;" src="<?php echo m_image_url($info['image']); ?>"></a></label> <br> <?php if($info['image']!='') { ?> <span class="btn btn-danger btn-label btn-sm image_delete"><i class="fa fa-trash label-icon"></i> <?php echo LGA_IMAGE_DELETE; ?></span> <?php } ?> <input type="hidden" class="old_image" name="old_image" value="<?php echo $info['image']; ?>"> </div> <div class="col-lg-8 col-sm-12"> <label class="form-label"><?php echo LGA_CATEGORY_IMAGE; ?></label> <input type="file" id="image_upload" class="form-control preview_image" name="image" accept="image/*"> </div> </div> </div> </div> </div> <button type="submit" class="btn btn-success waves-effect btn-label waves-light"><i class="bx bx-check-double label-icon"></i> <?php echo LGA_SAVE; ?></button> </form> </div> </div> </div> </div> </div>
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula