|
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/themes/2/ |
Upload File : |
<?php $slide_categories = $this->db->select('image_mobile')->from('home_slideshow')->where('status', '1')->where('slide_type', 'category')->where('id_categories', $category->id_categories)->order_by('priority', 'ASC')->get()->result(); ?>
<?php if (!empty($slide_categories)) : ?>
<section id="categoryPortfolio" class="py-1">
<div class="container">
<h2>Portofolio & Klien</h2>
<div class="swiper-container swiper1">
<div class="swiper-wrapper">
<?php foreach ($slide_categories as $slide) : ?>
<div class="swiper-slide">
<img src="<?= base_url() . 'uploads/banners/' . $slide->image_mobile; ?>" alt="" />
</div>
<?php endforeach; ?>
</div>
<div class="swiper-button-prev swiper-button-black"></div>
<div class="swiper-button-next swiper-button-black"></div>
</div>
</div>
</section>
<?php endif; ?>
<section id="categoryProducts">
<div class="container py-1">
<div id="categoryTitleBlock">
<div>
<?php if ($brand->brand != null) : ?>
<h3> <?= ucfirst($brand->brand) ?></h3>
<?php endif; ?>
<h3>
<?php if (isset($level1_title)) : ?>
<?= ucfirst($level1_title); ?>
<?php endif; ?>
<?php if (isset($level2_title)) : ?>
<i class="fa fa-chevron-right" style="font-size: 1.2rem;"></i> <?= ucfirst($level2_title); ?>
<?php endif; ?>
<?php if (isset($level3_title)) : ?>
<i class="fa fa-chevron-right" style="font-size: 1.2rem;"></i> <?= ucfirst($level3_title); ?>
<?php endif; ?>
</h3>
<?php if (!empty($brand->id_brands)) : ?>
<?php
$this->db->select('*');
$this->db->from('products');
$this->db->where('brand_id', $brand->id_brands);
$this->db->where('products.product_status', '1');
$query = $this->db->get(); ?>
<p>Menampilkan <?= count($products); ?> dari total <?= $query->num_rows() ?> produk</p>
<?php else : ?>
<?php
$this->db->select('*');
$this->db->from('products');
$this->db->join('category_product', 'products.id_products = category_product.id_product');
$this->db->where('category_product.id_category', $category->id_categories);
$this->db->where('products.product_status', '1');
$query = $this->db->get(); ?>
<p>Menampilkan <?= count($products); ?> dari total <?= $query->num_rows() ?> produk</p>
<?php endif; ?>
</div>
<div class="filter_c">
<?= form_open('category/' . $category->alias); ?>
<div class="select_box sel_2">
<select name="sort_product" class="selbx " style="padding:0.5rem; border:2px solid #000;border-radius:5px;" onchange="this.form.submit();">
<option value="" <?php if ($sort_product_by == '') : ?> selected <?php endif; ?>>Urutkan Product</option>
<option value="price-asc" <?php if ($sort_product_by == 'price-asc') : ?> selected <?php endif; ?>>Harga dari Rendah-Tinggi</option>
<option value="price-desc" <?php if ($sort_product_by == 'price-desc') : ?> selected <?php endif; ?>>Harga dari Tinggi-Rendah</option>
<option value="name-asc" <?php if ($sort_product_by == 'name-asc') : ?> selected <?php endif; ?>>Urutkan dari A-Z</option>
<option value="name-desc" <?php if ($sort_product_by == 'name-desc') : ?> selected <?php endif; ?>>Urutkan dari Z-A</option>
</select>
</div>
<?= form_close(); ?>
</div>
</div>
<div class="wrapper">
<div class="filter card">
<h3>Kategori</h3>
<ul class="filterCategory">
<!-- get all child category -->
<?php
$child_categories = $this->db->select('*')->from('categories')->where('parent', $level1_id)->order_by('priority', 'ASC')->get()->result();
?>
<?php if ($child_categories != null) : ?>
<?php foreach ($child_categories as $child_category) : ?>
<li><a <?php if (isset($child_category->alias)) : ?> href="<?= base_url('category/') . $level1_alias . '/' . $child_category->alias; ?>" <?php endif; ?>><?= ucfirst($child_category->category); ?></a>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
<h3>Merek</h3>
<ul class="filterBrand">
<!-- get all brand for this category -->
<?php
$category = $this->db->select('category')->from('categories')->where('id_categories', $level1_id)->get()->row()->category;
$brands_id = $this->db->distinct()->select('brand_id')->from('products')->like('categories', $category, 'after')->get()->result();
foreach ($brands_id as $brand_id) {
$get_brand = $this->db->select('*')->from('brands')->where('id_brands', $brand_id->brand_id)->get()->row();
if ($get_brand->status == 1) {
$get_all_brands[] = $get_brand;
}
}
foreach ($get_all_brands as $brand) : ?>
<li>
<a href="<?= base_url('brand/' . $brand->alias); ?>">
<?= ucfirst($brand->brand); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<div id="homeProductsItems">
<!-- product display -->
<?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;
}
}
?>
<?php if ($products != null) : ?>
<?php foreach ($products 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="" />
<?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
/*get brand id*/
$get_brand_id = $this->db->select('brand_id')->from('products')->where('id_products', $item->id_products)->get()->row()->brand_id;
/*get brand id*/
$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', $get_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; ?>
<!-- setting price -->
<?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; ?>
<div class="pull-right">
<?= $this->pagination->create_links() ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</section>