|
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/indolok.id/application/views/ajax/ |
Upload File : |
<a style="display:none;" id="showModal" href="#myModal" role="button" class="btn btn-warning" data-toggle="modal"><span class="glyphicon glyphicon-hand-up"></span> Click for a Modal Window!</a>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Quick Edit Product</h4>
<h4><?= ucwords($product->title); ?></h4>
<div id="successMessage"></div>
</div><!-- end modal-header -->
<div class="modal-body">
<form id="formEditProduct" method="post" action="<?= base_url('admin/products/quick_update_product'); ?>">
<input type="hidden" name="product_id" value="<?= $product->id_products; ?>">
<table class="table">
<tr>
<td>Price (IDR)</td>
<td><input type="number" name="price" value="<?= $product->price; ?>" min="0" step="1"></td>
</tr>
<tr>
<td>Discounted Price (IDR)</td>
<td><input type="number" name="discount_price" value="<?=
$product->discount_price; ?>" min="0" step="1"></td>
</tr>
<tr>
<td>Display Product</td>
<td>
<select name="product_status">
<option value="1"
<?php if ($product->product_status == '1') : ?>
selected
<?php endif; ?>
>Yes</option>
<option value="0"
<?php if ($product->product_status == '0') : ?>
selected
<?php endif; ?>
>No</option>
</select>
</td>
</tr>
<tr>
<td>Input / Edit Product Stock & SKU</td>
<td>
<table style="border:1px solid #b5b5b5;">
<tr>
<th>Size</th>
<th>Color</th>
<th>SKU</th>
<th>Stock</th>
</tr>
<?php
//get current stock and sku data from stocks table
//get sizes
$this->db->select('*')->from('product_details')->where('product_id', $product->id_products);
$current_stocks = $this->db->get()->result_array();
$count_current_stocks = count($current_stocks);
?>
<?php for($i = 0 ; $i < 21; $i++) : ?>
<tr>
<td>
<select name="select_size[]" style="width:120px;">
<option value="">Choose Size</option>
<?php
//get all size
$this->db->select('*')->from('product_size')->order_by('priority', 'ASC');
$sizes = $this->db->get()->result();
?>
<?php foreach ($sizes as $size) : ?>
<option value="<?= $size->id_product_size; ?>"
<?php if ($i < $count_current_stocks) : ?>
<?php if ($size->id_product_size == $current_stocks[$i]['size_id']) : ?>
selected
<?php endif; ?>
<?php endif; ?>
><?= $size->product_size; ?></option>
<?php endforeach; ?>
</select>
</td>
<td>
<select name="select_color[]" style="width:120px;">
<option value="">Choose Color</option>
<?php
//get all color
$this->db->select('*')->from('product_color')->order_by('product_color', 'ASC');
$colors = $this->db->get()->result();
?>
<?php foreach ($colors as $color) : ?>
<option value="<?= $color->id_product_color; ?>"
<?php if ($i < $count_current_stocks) : ?>
<?php if ($color->id_product_color == $current_stocks[$i]['color_id']) : ?>
selected
<?php endif; ?>
<?php endif; ?>
><?= ucwords($color->product_color); ?></option>
<?php endforeach; ?>
</select>
</td>
<td>
<input type="text" name="sku[]"
<?php if ($i < $count_current_stocks) : ?>
value="<?= $current_stocks[$i]['sku']; ?>"
<?php endif; ?>
style="width:120px;">
</td>
<td>
<input type="text" name="stock[]"
<?php if ($i < $count_current_stocks) : ?>
value="<?= $current_stocks[$i]['stock']; ?>"
<?php endif; ?>
style="width:120px;">
</td>
</tr>
<?php endfor; ?>
</table>
</td>
</tr>
</table>
<p style="text-align:right;">
<input name="quickeditproduct" type="submit" class="btn btn-primary" value="Update">
<button class="btn btn-default" data-dismiss="modal" type="button">Close</button>
</p>
</div><!-- end modal-body -->
</div><!-- end modal-footer -->
</div><!-- end modal-content -->
</div><!-- end modal-dialog -->
</div><!-- end myModal -->
<script>
/* $(document).ready(function() {
var controller = 'admin/products';
var base_url = '<?php echo base_url(); ?>';
$('form#formEditProduct').submit(function(e) {
e.preventDefault();
$.ajax({
'url' : base_url + controller + '/ajax_quick_update_product',
'type' : 'POST',
'data' : $('form#formEditProduct').serializeArray(),
'success' : function(data) {
var container = $('#successMessage');
container.html(data);
}
});
});
}); */
</script>