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/modules/newarrival/views/2/ |
Upload File : |
<div class="container py-2"> <h2>Produk Indolok</h2> <div id="homeProductsItems"> <?php if($new_arrivals != null): ?> <?php foreach ($new_arrivals as $item):?> <div class="card"> <a href="<?= base_url() . 'product/' . $item->alias; ?>"> <?php if($item->image1 != null): ?> <?php if (file_exists(FCPATH.'/uploads/product/small/' . $item->image1)):?> <img src="<?= base_url() . 'uploads/product/small/' . $item->image1; ?>" alt=""> <?php else: ?> <img src="<?= base_url() . 'uploads/product/small/placeholder.jpg'; ?>" alt="" /> <?php endif; ?> <?php else: ?> <img src="<?= base_url() . 'uploads/product/small/placeholder.jpg'; ?>" alt="Product"/> <?php endif; ?> </a> <h4><a href="<?= base_url() . 'product/' . $item->alias; ?>"><?= ucfirst($item->title); ?></a></h4> <!-- setting price --> <?php $reseller_id = null; if(isset($this->session->userdata('customer')['customer_id'])){ $get_id = $this->db->select('reseller_id,category_for_dealer')->from('customers')->where('id_customers', $this->session->userdata('customer')['customer_id'])->get()->row(); if($get_id->reseller_id != null){ $reseller_id = $get_id->reseller_id; } } ?> <!-- jika user adalah reseller --> <?php if($reseller_id != null): ?> <!-- cek produk masuk kategori dealer atau tidak --> <?php $cek_produk = $this->db->select('*')->from('category_product')->where('id_product',$item->id_products)->where('id_category',$get_id->category_for_dealer)->get()->row(); if($cek_produk != null): ?> <!-- produk termasuk dalam kategori dealer --> <?php $persentase_level1 = 0; $persentase_level2 = 0; //get all category id $product_categories = $this->db->select('id_category')->from('category_product')->where('id_product',$item->id_products)->get()->result(); foreach ($product_categories as $product_category) { $resellers_discount = $this->db->select('*')->from('resellers_discount')->where('reseller_id',$reseller_id)->where('category_id',$product_category->id_category)->where('brand_id',$item->brand_id)->get()->result(); foreach ($resellers_discount as $discount) { if(((1 * $item->sale_price) >= $discount->pembelian_min) && ((1 * $item->sale_price) <= $discount->pembelian_max)){ $persentase_level1 = $discount->persentase_level1; $persentase_level2 = $discount->persentase_level2; break; } } } /*jika teradapat diskon dealer*/ if(($persentase_level1 != 0) && ($persentase_level2 != 0)){ $final_price = ($item->sale_price * (1 - ($persentase_level1/100))) * (1 - ($persentase_level2/100)); $final_persentase_hemat = number_format(($item->sale_price - $final_price) / $item->sale_price * 100); $del_price = $item->sale_price; } /*jika tidak teradapat diskon dealer*/ else{ if($item->is_sale == 'no'){ $final_price = $item->sale_price; $final_persentase_hemat = 0; $del_price = 0; } else{ $final_price = $item->discounted_price; $final_persentase_hemat = number_format(($item->sale_price - $item->discounted_price) / $item->sale_price * 100); $del_price = $item->sale_price; } } ?> <?php else: ?> <!-- produk tidak termasuk dalam kategori dealer --> <?php if($item->is_sale == 'no') : ?> <?php $final_price = $item->sale_price; $final_persentase_hemat = 0; $del_price = 0; ?> <?php else: ?> <?php $final_price = $item->discounted_price; $final_persentase_hemat = number_format(($item->sale_price - $item->discounted_price) / $item->sale_price * 100); $del_price = $item->sale_price; ?> <?php endif; ?> <?php endif;?> <!-- cek produk masuk kategori dealer atau tidak --> <!-- jika user adalah non-reseller --> <?php else: ?> <?php if($item->is_sale == 'no') : ?> <?php $final_price = $item->sale_price; $final_persentase_hemat = 0; $del_price = 0; ?> <?php else: ?> <?php $final_price = $item->discounted_price; $final_persentase_hemat = number_format(($item->sale_price - $item->discounted_price) / $item->sale_price * 100); $del_price = $item->sale_price; ?> <?php endif; ?> <?php endif; ?> <?php if($final_price != 0): ?> <p class="price"> <strong> Rp <?= number_format($final_price);?> </strong> </p> <?php if($del_price != 0): ?> <p class="price priceStrike"> <strong>Rp <?= number_format($del_price); ?></strong> </p> <?php endif; ?> <?php else: ?> <!-- <p class="price"> <strong> Rp - </strong> </p> --> <a href="<?= base_url('contact')?>" style="font-size: 15px;">contact us</a> <?php endif; ?> <div class="sale-heart-hover"> <a data-value="<?= $item->id_products; ?>" style="cursor: pointer;" <?php if($this->session->userdata('customer')['customer_id']):?> id="add_wishlist_login<?= $item->id_products; ?>" data-toast data-toast-type="success" data-toast-position="topRight" data-toast-icon="icon-circle-check" data-toast-title="ADD WISHLIST" data-toast-message="successfuly added to wishlist!" <?php else: ?> id="add_wishlist_nonlogin<?= $item->id_products; ?>" <?php endif; ?> > <i class="fa fa-heart-o"></i> </a> <script> $(document).ready(function() { $('#add_wishlist_login<?= $item->id_products; ?>').click(function() { var id_product = $(this).data("value") ajax_add_wishlist<?= $item->id_products; ?>(id_product); }); $('#add_wishlist_nonlogin<?= $item->id_products; ?>').click(function() { window.location = "<?= base_url('login');?>"; }); }); function ajax_add_wishlist<?= $item->id_products; ?>(id_product) { $.ajax({ 'url' : '<?= base_url('wishlist/add_wishlist'); ?>', 'type' : 'POST', 'data' : { 'id_product' : id_product, '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }, 'success' : function(result) { swal({ position: 'center', type: 'success', title: 'Successfuly added to wishlist', showConfirmButton: false, timer: 1500 }) } }); } </script> </div> </div> <?php endforeach; ?> <?php endif; ?> </div> </div>