|
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/ |
Upload File : |
<style>
.count-input>.quantity{
text-align: center;
}
</style>
<div class="w-grid">
<div class="container">
<?php if($this->session->flashdata('message')) {
echo $this->session->flashdata('message');
} ?>
<div class="table-responsive" style="overflow-x:unset;padding: 2rem 0;">
<?php $grand_total = 0; ?>
<?php if ($cart = $this->cart->contents()): ?>
<table class="table" style="border-top:1px solid #999999; border-bottom:1px solid #999999; width: 100%;">
<thead>
<tr>
<th style="width:13%;">PRODUK</th>
<th style="width:36%; text-align: left;"></th>
<th style="width:15%; text-align: left;">HARGA SATUAN</th>
<th style="width:15%; text-align: center;">KUANTITAS</th>
<th style="width:15%; text-align: left;">SUBTOTAL</th>
<th style="width:15%; text-align: left;">DARI</th>
<th style="width:6%">HAPUS</th>
</tr>
</thead>
<tbody>
<?php $count = 0; ?>
<?php $grand_total = 0; ?>
<?php foreach ($cart as $item): ?>
<?php $count = $count + 1; ?>
<?php
//get product image
$image_thumb = $this->product_m->get_image($item['id']);
//get product alias
$this->db->select('alias')->from('products')->where('id_products', $item['id']);
$product_alias = $this->db->get()->row()->alias;
?>
<tr>
<td style="padding-bottom: 0px">
<p style="margin-bottom: 0px !important">
<a href="<?= base_url() . 'product/' . $product_alias; ?>">
<?php if($image_thumb->image1 != null): ?>
<?php if (file_exists(FCPATH.'/uploads/product/thumbnail/' . $image_thumb->image1)):?>
<img src="<?= base_url('uploads/product/thumbnail') .'/'. $image_thumb->image1; ?>">
<?php else: ?>
<img src="<?= base_url('uploads/product/thumbnail/placeholder.jpg'); ?>">
<?php endif; ?>
<?php else: ?>
<img src="<?= base_url('uploads/product/thumbnail/placeholder.jpg'); ?>">
<?php endif; ?>
</a>
</p>
</td>
<td>
<a style="color:black; text-decoration: none;" href="<?= base_url() . 'product/' . $product_alias; ?>"><?= strtoupper($item['name']); ?></a>
</td>
<td id="price<?= $count; ?>">IDR <?= number_format($item['price']); ?></td>
<td style="text-align:center;">
<?= $item['qty']; ?>
<!-- <?php if($fs_cek_product != null): ?>
<div class="count-input space-bottom" style="display: inline-block;">
<input readonly="readonly" class="quantity productQuantity<?= $count; ?>" type="text" name="quantity" value="<?= $item['qty']; ?>"/>
</div>
<?php else: ?>
<div class="count-input space-bottom" style="display: inline-block;text-align: center;">
<a class="incr-btn btnMin<?= $count; ?>" data-action="decrease" href="#">–</a>
<input readonly="readonly" class="quantity productQuantity<?= $count; ?>" style="width: 50%;" type="text" name="quantity" value="<?= $item['qty']; ?>"/>
<a class="incr-btn btnAdd<?= $count; ?>" data-action="increase" href="#">+</a>
</div>
<?php endif; ?>
<p class="noStock<?= $count; ?>" style="color:red;"><?= $this->session->flashdata('no_stock' . $item['id']); ?></p> -->
</td>
<td id="subTotal<?= $count; ?>">IDR <?php echo number_format($item['price'] * $item['qty']); ?></td>
<?php if($fs_cek_product == null): ?>
<script>
$('.btnMin<?= $count; ?>').click(function() {
var qty = $('.productQuantity<?= $count; ?>').val();
qty--;
if(qty == 0) {
qty = 1;
}
$('.productQuantity<?= $count; ?>').val(qty);
ajax_check_stock<?= $count; ?>(qty);
ajax_set_subtotal<?= $count; ?>(qty);
});
$('.btnAdd<?= $count; ?>').click(function() {
var qty = $('.productQuantity<?= $count; ?>').val();
qty++;
$('.productQuantity<?= $count; ?>').val(qty);
ajax_check_stock<?= $count; ?>(qty);
ajax_set_subtotal<?= $count; ?>(qty);
});
function ajax_check_stock<?= $count; ?>(qty) {
$.ajax({
'url' : '<?= base_url(); ?>' + 'ajax/ajax_check_stock',
'type' : 'POST',
'data' : {
'qty' : qty,
'row_id': '<?= $item['rowid']; ?>',
'sub_total': <?= $item['subtotal']; ?>,
'product_id' : <?= $item['id']; ?>,
'<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
},
'success' : function(data) {
if (data) {
/*---if stock not enough----*/
if(data === 'stok tidak cukup') {
$('.noStock<?= $count; ?>').html(data);
$('.buyButton').hide();
} else {
$('.noStock<?= $count; ?>').html('');
$('.buyButton').show();
}
};
}
});
}
function ajax_set_subtotal<?= $count; ?>(qty){
$.ajax({
'url' : '<?= base_url(); ?>' + 'ajax/ajax_set_subtotal',
'type' : 'POST',
'data' : {
'qty' : qty,
'row_id': '<?= $item['rowid']; ?>',
'price': <?= $item['price']; ?>,
'product_id' : <?= $item['id']; ?>,
'<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
},
'success' : function(data) {
if (data) {
var hasil = JSON.parse(data);
$('#price<?= $count; ?>').html(hasil.price);
$('#subTotal<?= $count; ?>').html(hasil.subtotal);
$('#totalAmount').html(hasil.grand_total);
$('#cart_total').html(hasil.total_cart);
};
}
});
}
</script>
<?php endif; ?>
<td><?= $item['option']['warehouse_name']; ?></td>
<td style="padding-left: 30px;">
<a title="Hapus" href="<?= base_url('cart/remove') . '/' . $item['rowid']; ?>">
<i class="fa fa-trash"></i>
</a>
</td>
</tr>
<?php $grand_total = $grand_total + $item['subtotal']; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php else : ?>
<p style="margin-top: 25px; margin-bottom: 100px; font-size: 15px; font-weight: bold;" class="clearfix">
KERANJANG ANDA KOSONG ...
</p>
<?php endif; ?>
</div><!-- end myCart -->
<!-- </div> --><!-- end tableResponsive -->
<p style="text-align: right; border-bottom:1px solid #999999; padding-bottom: 10px; font-weight: bold;">
<span style="font-size:120%;" id="totalAmount">TOTAL: IDR <?= number_format($grand_total); ?></span>
</p>
<p style="margin-top: 25px; margin-bottom: 100px; font-size: 15px; font-weight: bold;" class="clearfix">
<?php if($this->session->userdata('productpage_to_cart')) : ?>
<a class="btn btn-primary btn-buy" id="button_continue" href="<?= $this->session->userdata('productpage_to_cart'); ?>" style="width: 200px;float: none;">
<i class="fa fa-chevron-left" aria-hidden="true"></i> LANJUT BELANJA
</a>
<?php else : ?>
<a class="btn btn-primary btn-buy" id="button_continue" href="<?= base_url(); ?>" style="width: 170px;float: none;">
<i class="fa fa-chevron-left" aria-hidden="true"></i> LANJUT BELANJA
</a>
<?php endif; ?>
<style>
.btn-buy{
width:195px;
float: right;
margin-right: 0px;
margin-top: 0px;
}
</style>
<?php if ($cart = $this->cart->contents()): ?>
<a href="<?= base_url('shipping'); ?>" class="btn btn-primary buyButton btn-buy" style="text-align:right">CHECKOUT <i class="fa fa-chevron-right" aria-hidden="true"></i></a>
<?php endif; ?>
</p>
</div>
</div>