|
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/ptbos.biz/public_html/application/views/admin/resellers/ |
Upload File : |
<div class="row">
<div class="col-sm-12">
<p><a href="<?= base_url('admin/reseller_page'); ?>"><i class="fa fa-arrow-left" aria-hidden="true"></i> Back to Reseller Page</a></p>
<h2>Product Reseller Price</h2>
<?= $this->session->flashdata('success'); //to display success message ?>
<?= $this->session->flashdata('result'); //to display result message ?>
</div><!-- end class="col-sm-12" -->
</div> <!-- end row -->
<div class="row">
<div class="col-sm-12">
<table class="table table-striped">
<thead>
<tr>
<th>Product Name</th>
<th>SKU</th>
<th>Options</th>
<th>Stocks</th>
<th>Retail (Rp)</th>
<?php
//get reseller categories
$this->db->select('id_resellers, reseller_name')->from('resellers')->where('active', 'yes')->order_by('id_resellers', 'ASC');
$resellers = $this->db->get()->result();
?>
<?php foreach($resellers as $reseller) : ?>
<th><?= ucwords($reseller->reseller_name); ?> (Rp)</th>
<th>Min Qty</th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php if(count($products)) : ?>
<?= form_open('admin/resellers/update_product_price'); ?>
<div style="text-align:right;">
<input type="submit" name="update_price" value="UPDATE PRICE" class="btn btn-primary">
</div>
<?php foreach($products as $product): ?>
<tr>
<td>
<?php
//get product name
$this->db->select('title')->from('products')->where('id_products', $product->product_id);
$product_name = $this->db->get()->row()->title;
?>
<?= ucwords($product_name); ?>
</td>
<td><?= $product->sku; ?></td>
<td><?= $product->attributes; ?></td>
<td><?= $product->stock; ?></td>
<td><?= $product->price; ?></td>
<?php foreach($resellers as $reseller) : ?>
<td><input class="form-control"
<?php
//check if the reseller price already exists in reseller_price table. If not exit, so use the value from retail price
$this->db->select('id_resellers_price')->from('resellers_price')->where('product_detail_id', $product->id_product_details)->where('reseller_id', $reseller->id_resellers);
$count_price = $this->db->get()->num_rows();
?>
<?php if($count_price == 0) : ?>
value="<?= $product->price; ?>"
<?php else : ?>
<?php
//get price
$this->db->select('price')->from('resellers_price')->where('product_detail_id', $product->id_product_details)->where('reseller_id', $reseller->id_resellers);
$reseller_price = $this->db->get()->row()->price;
?>
value="<?= $reseller_price; ?>"
<?php endif; ?>
type="text" name="price[<?= $product->id_product_details; ?>][<?= $reseller->id_resellers; ?>][]" required></td>
<td><input class="form-control"
<?php
//check if the min qty already exists in reseller_price table. If not exit, so use the default value of 1
$this->db->select('id_resellers_price')->from('resellers_price')->where('product_detail_id', $product->id_product_details)->where('reseller_id', $reseller->id_resellers);
$count_qty = $this->db->get()->num_rows();
?>
<?php if($count_qty == 0) : ?>
value="1"
<?php else : ?>
<?php
//get min qty
$this->db->select('min_quantity')->from('resellers_price')->where('product_detail_id', $product->id_product_details)->where('reseller_id', $reseller->id_resellers);
$min_quantity = $this->db->get()->row()->min_quantity;
?>
value="<?= $min_quantity; ?>"
<?php endif; ?>
type="text" name="quantity[<?= $product->id_product_details; ?>][<?= $reseller->id_resellers; ?>][]" required></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="3">We could not find any product.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<div style="text-align:right;">
<input type="submit" name="update_price" value="UPDATE PRICE" class="btn btn-primary">
</div>
<?= form_close(); ?>
</div><!-- end class="col-sm-12" -->
</div> <!-- end row -->
<div class="row">
<div class="col-sm-12">
<?php if(isset($use_pagination)) : ?>
<div style="text-align:center;"><?= $this->pagination->create_links(); ?></div>
<?php endif; ?>
</div><!-- end class="col-sm-12" -->
</div> <!-- end row -->