|
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/ |
Upload File : |
<table border="1" cellpadding="8">
<tr>
<th>Kode Produk</th>
<th>Nama Produk</th>
<th>Deskripsi Singkat Produk (HTML)</th>
<th>Deskripsi Panjang Produk (HTML)</th>
<th>Foto 1</th>
<th>Foto 2</th>
<th>Foto 3</th>
<th>Foto 4</th>
<th>Foto 5</th>
<th>Tipe Produk</th>
<th>Brand Perusahaan</th>
<th>Harga Kompetitor</th>
<th>Harga Normal</th>
<th>Harga Diskon</th>
<th>Stok Minimum</th>
<th>Bundling</th>
<th>Metode Pengiriman yg tersedia</th>
<th>Berat (gram)</th>
<th>Panjang (cm)</th>
<th>Lebar (cm)</th>
<th>Tinggi (cm)</th>
<th>Best Seller ?</th>
<th>Kategori Produk</th>
<th>Bahan Aktif</th>
<th>Display ?</th>
<th>New Arrival ?</th>
<th>Top Offer ?</th>
<th>Is Backorder ?</th>
<th>Discontinued ?</th>
<th>Jenis Kemasan</th>
<th>Warna Obat</th>
<th>Satuan Jual</th>
<th>Satuan Beli & Konversi</th>
</tr>
<?php
if( ! empty($products)){ // Jika data pada database tidak sama dengan empty (alias ada datanya)
foreach($products as $item){ // Lakukan looping pada variabel siswa dari controller
error_reporting(0);
echo "<td>".$item->product_code."</td>";
echo "<td>".$item->title."</td>";
echo "<td>".htmlentities($item->description)."</td>";
echo "<td>".htmlentities($item->long_description)."</td>";
echo "<td>".$item->image1."</td>";
echo "<td>".$item->image2."</td>";
echo "<td>".$item->image3."</td>";
echo "<td>".$item->image4."</td>";
echo "<td>".$item->image5."</td>";
echo "<td>".$item->product_type."</td>";
$brand = $this->db->select('brand')->from('brands')->where('id_brands',$item->brand_id)->get()->row()->brand;
echo "<td>".$brand."</td>";
echo "<td>".$item->competitor_price."</td>";
echo "<td>".$item->sale_price."</td>";
echo "<td>".$item->discounted_price."</td>";
echo "<td>".$item->minimum_stock."</td>";
echo "<td>".$item->bundling."</td>";
$shipment_method = $this->db->select('shipment_method_id')->from('shipment_method_product')->where('product_id',$item->id_products)->get()->result();
$shipment_id = '';
foreach ($shipment_method as $item1) {
if($shipment_id == ''){
$shipment_id = $item1->shipment_method_id;
}
else{
$shipment_id = $shipment_id.'|'.$item1->shipment_method_id;
}
}
echo "<td>".$shipment_id."</td>";
echo "<td>".$item->dimension_weight."</td>";
echo "<td>".$item->dimension_length."</td>";
echo "<td>".$item->dimension_width."</td>";
echo "<td>".$item->dimension_height."</td>";
echo "<td>".$item->best_seller."</td>";
$categories_id = $this->db->select('id_category')->from('category_product')->where('id_product',$item->id_products)->get()->result();
/*get parent first*/
$parents_id = null;
foreach ($categories_id as $category_id) {
$cek_parent = $this->db->select('parent')->from('categories')->where('id_categories',$category_id->id_category)->get()->row()->parent;
if($cek_parent == null){
$parents_id[] = $category_id->id_category;
}
}
/*get parent first*/
/*get child level 2*/
$final_product_category = '';
foreach ($parents_id as $parent_id) {
$product_category = '';
$parent_name = $this->db->select('category')->from('categories')->where('id_categories',$parent_id)->get()->row()->category;
$product_category = $parent_name;
foreach ($categories_id as $category_id) {
/*cek untuk parent 2*/
if($category_id->id_category != $parent_id){
$cek_parent2 = $this->db->select('id_categories,category,parent')->from('categories')->where('id_categories',$category_id->id_category)->get()->row();
if($cek_parent2->parent == $parent_id){
$product_category = $product_category.'-'.$cek_parent2->category;
foreach ($categories_id as $category_id) {
/*cek untuk parent 3*/
if($category_id->id_category != $cek_parent2->id_categories){
$cek_parent3 = $this->db->select('id_categories,category,parent')->from('categories')->where('id_categories',$category_id->id_category)->get()->row();
if($cek_parent3->parent == $cek_parent2->id_categories){
$product_category = $product_category.'-'.$cek_parent3->category;
}
}
/*cek untuk parent 3*/
}
}
}
/*cek untuk parent 2*/
}
if($final_product_category == ''){
$final_product_category = $product_category;
}
else{
$final_product_category = $final_product_category.'|'.$product_category;
}
}
/*get child level 2*/
echo "<td>".$final_product_category."</td>";
$active_ingredients_ids = $this->db->select('active_ingredients_id')->from('active_ingredients_products')->where('product_id',$item->id_products)->get()->result();
$ingredients_name = '';
foreach ($active_ingredients_ids as $active_ingredients_id) {
$active_ingredients_name = $this->db->select('name')->from('active_ingredients')->where('id',$active_ingredients_id->active_ingredients_id)->get()->row()->name;
if($ingredients_name == ''){
$ingredients_name = $active_ingredients_name;
}
else{
$ingredients_name = $ingredients_name.'|'.$active_ingredients_name;
}
}
echo "<td>".$ingredients_name."</td>";
switch ($item->product_status) {
case 0:
echo "<td>No</td>";
break;
case 1:
echo "<td>Yes</td>";
break;
default:
echo "Not Found Status";
}
echo "<td>".$item->new_arrival."</td>";
echo "<td>".$item->popular_product."</td>";
echo "<td>".$item->is_backorder."</td>";
echo "<td>".$item->is_discontinue."</td>";
echo "<td>".$item->text_satuan_jual."</td>";
echo "<td>".$item->golongan_obat."</td>";
$id_satuan_jual = $this->db->select('satuan_jual_id')->from('unit_convertion')->where('product_id',$item->id_products)->get()->row()->satuan_jual_id;
$satuan_jual = $this->db->select('conversion')->from('conversion')->where('id_conversion',$id_satuan_jual)->get()->row()->conversion;
echo "<td>".$satuan_jual."</td>";
$satuan_beli_dan_konversi = '';
$satuan_belis = $this->db->select('satuan_beli_id,konversi')->from('unit_convertion')->where('product_id',$item->id_products)->get()->result();
foreach ($satuan_belis as $satuan_beli) {
$satuan_beli_name = $this->db->select('conversion')->from('conversion')->where('id_conversion',$satuan_beli->satuan_beli_id)->get()->row()->conversion;
$satuan_beli_final_name = $satuan_beli_name.'-'.$satuan_beli->konversi;
if($satuan_beli_dan_konversi == ''){
$satuan_beli_dan_konversi = $satuan_beli_final_name;
}
else{
$satuan_beli_dan_konversi = $satuan_beli_dan_konversi.'|'.$satuan_beli_final_name;
}
}
echo "<td>".$satuan_beli_dan_konversi."</td>";
echo "</tr>";
}
}else{ // Jika data tidak ada
echo "<tr><td colspan='3'>Data tidak ada</td></tr>";
}
?>
</table>