Skip to content

Commit

Permalink
General Update 8
Browse files Browse the repository at this point in the history
Admin Page -> Order Detail :Currency Value and ID Added.
Total Price Added,
Cargo Type Added,
Payment Type added
Home Page -> Currency System : Complete currency calculating changed.
: Currency value info and currency info added
mySQL Database      : Currency database changed.
: Order database changed.
and Many fixed errors..
  • Loading branch information
jolyjokerz committed May 13, 2015
1 parent d9136cc commit 5753d00
Show file tree
Hide file tree
Showing 18 changed files with 179 additions and 112 deletions.
1 change: 1 addition & 0 deletions application/controllers/admin/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function check(){
$this->load->view('admin/account/login');
}else{
$this->session->set_flashdata('action_message', 'Hosgeldiniz, Welcome, <font size="4">أهلاً وسهلاً</font>, Bienvenida, Benvenuto, Bienvenue ');
$this->session->set_flashdata('action_message_type', 'success');
redirect('admin/dashboard');
}

Expand Down
10 changes: 5 additions & 5 deletions application/controllers/admin/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public function detail(){

foreach($order_products as $product) {
$products[$count++] = array(
'oid' => $product->oid,
'name' => $product->name,
'count' => $product->count,
'price' => $product->price,
'options' => $this->order_model->product_options($product->options)
'oid' => $product->oid,
'name' => $product->name,
'count' => $product->count,
'price' => $product->price,
'options' => $this->order_model->product_options($product->options)

);
}
Expand Down
3 changes: 1 addition & 2 deletions application/controllers/basket.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public function add(){
$total_option_price = $this->products_model->option_price_total($option);
}

$product_price = $product['0']->price * $this->data['currency_currency'];
$total_price = $product_price + $total_option_price;
$total_price = $product['0']->price + $total_option_price;
$final_price = $total_price * $qty;

$data = array(
Expand Down
5 changes: 2 additions & 3 deletions application/controllers/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ public function index(){
$this->lang->load('cart', $this->session->userdata('lang_file'));

foreach($this->cart->contents() AS $carts){
$product = $this->products_model->product($carts['id']);
$cart[] = array(
'rowid' => $carts['rowid'],
'name' => $carts['name'],
'qty' => $carts['qty'],
'subtotal' => ''.$this->cart->format_number($carts['price']),
'price' => ''.$this->cart->format_number($product['0']->price * $this->data['currency_currency']),
'subtotal' => $carts['subtotal'],
'price' => $carts['price'],
'options' => $this->products_model->cart_product_options($carts['options']),

);
Expand Down
18 changes: 7 additions & 11 deletions application/controllers/currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@
class Currency extends KoController {

public function set(){

$this->load->model('currency_model');
$id = $this->security->xss_clean($this->uri->segment(3));

if($id == 1){
$this->cart->destroy();
$this->session->set_userdata('currency', '1');
}

if($id == 2){
$this->cart->destroy();
$this->session->set_userdata('currency', '2');
}

$is_valid = $this->currency_model->id_is_valid($id);

if($id != "" & $is_valid == true){
$this->session->set_userdata('currency', $id);
}

redirect($_SERVER['HTTP_REFERER']);

Expand Down
6 changes: 4 additions & 2 deletions application/controllers/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public function complete(){
'rowid' => $carts['rowid'],
'name' => $carts['name'],
'qty' => $carts['qty'],
'subtotal' => ''.$this->cart->format_number($carts['price']),
'price' => ''.$this->cart->format_number($product['0']->price * $this->data['currency_currency']),
'subtotal' => $carts['price'],
'price' => $product['0']->price,
'options' => $this->products_model->cart_product_options($carts['options']),

);
Expand Down Expand Up @@ -195,6 +195,8 @@ public function confirm(){
'cargo_region' => $this->session->userdata('cargo_region'),
'cargo_type' => $this->session->userdata('cargo_type'),
'payment_type' => $this->session->userdata('payment_type'),
'currency_symbol' => $this->data['currency_symbol'],
'currency_currency' => $this->data['currency_currency'],
'status' => 1,
'comment' => '',
'total' => $this->cart->total(),
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function seolink(){
'product_id' => $products->product_id,
'rank' => $products->rank,
'category_id' => $products->category_id,
'price' => ''.$this->cart->format_number($products->price * $this->data['currency_currency']),
'price' => $products->price,
'stock' => $products->stock,
'image' => $products->image,
'url' => $products->url,
Expand Down
4 changes: 2 additions & 2 deletions application/core/MY_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function __construct(){
* Variables: $this->cart->total(), $this->cart->total_items(),
* example: $this->cart->total()
*/
$this->data['cart_total'] = ''.$this->cart->format_number($this->cart->total()).' '.$this->data['currency_symbol'].'';
}
$this->data['cart_total'] = $this->cart->format_number(($this->cart->total()) * $this->data['currency_currency']);
}

public function setLang(){
$this->lang->load('home', $this->session->userdata('lang_file'));
Expand Down
4 changes: 4 additions & 0 deletions application/models/admin/order_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ function product($id){

}
public function detail($id){
$this->db->select('order.*, cargo.name AS cargo_name, cargo.price AS cargo_price, extension.name AS payment_name');
$this->db->where('order_id', $id);
$this->db->where('extension.type', 'payment');
$this->db->join('cargo', 'cargo.id = order.cargo_type');
$this->db->join('extension', 'extension.id = order.payment_type');
$query = $this->db->get("order");
return $query->result();

Expand Down
24 changes: 24 additions & 0 deletions application/models/currency_model.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
class Currency_model extends CI_Model {

function __construct()
{
// Call the Model constructor
parent::__construct();
}

function id_is_valid($id) {
$this->db->where('id', $id);
$query = $this->db->get("currency");
if ($query->num_rows() > 0){
return true;
}
else{
return false;
}
}




}
48 changes: 35 additions & 13 deletions application/views/admin/order/detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,28 @@
<?php
foreach($order as $order_detail) { ?>
<table class="table table-striped">
<tr>
<tr>
<td>Order ID#</td>
<td><?php echo $order_detail->order_id; ?></td>

</tr>
<tr>
</tr>
<tr>
<td>Customer ID#</td>
<td><?php if($order_detail->customer_id == 0){ ?> Visitor <? } else { ?> <?php echo $result->customer_id; ?> <?php } ?></td>
</tr>
<tr>
</tr>
<tr>
<td>Total</td>
<td><?php echo $order_detail->total; ?></td>
</tr>
<tr>
<td><?php echo $this->cart->format_number(($order_detail->total + $order_detail->cargo_price) * $order_detail->currency_currency); ?> <?php echo $order_detail->currency_symbol; ?></td>
</tr>
<tr>
<td>Currency ID</td>
<td><?php echo $order_detail->currency_symbol; ?></td>
</tr>
<tr>
<td>Currency Value</td>
<td><?php echo $order_detail->currency_currency; ?></td>
</tr>
<tr>
<td>Date</td>
<td><?php echo $order_detail->date; ?></td>
</tr>
Expand Down Expand Up @@ -102,6 +110,10 @@
<?php
foreach($order as $order_detail) { ?>
<table class="table table-striped">
<tr>
<td>Payment Type</td>
<td><?php echo $order_detail->payment_name; ?></td>
</tr>
<tr>
<td>First Name</td>
<td><?php echo $order_detail->billing_first_name; ?></td>
Expand Down Expand Up @@ -165,6 +177,10 @@
<?php
foreach($order as $order_detail) { ?>
<table class="table table-striped">
<tr>
<td>Cargo Name</td>
<td><?php echo $order_detail->cargo_name; ?></td>
</tr>
<tr>
<td>First Name</td>
<td><?php echo $order_detail->cargo_first_name; ?></td>
Expand Down Expand Up @@ -228,7 +244,7 @@
<th>Action</th>
</tr>
</thead>
<tbody>
<tbody>
<?php foreach($products as $product){ ?>

<tr>
Expand All @@ -238,23 +254,29 @@
<br>
<?php foreach($product['options'] AS $option){ ?>

<b>&not;</b> <small><?php echo $option->value_name; ?> (<?php echo $option->operation; ?> <?php echo $this->cart->format_number($option->price * $currency); ?> <?php echo $symbol; ?>)</small>
<b>&not;</b> <small><?php echo $option->value_name; ?> (<?php echo $option->operation; ?> <?php echo $this->cart->format_number($option->price * $order_detail->currency_currency); ?> <?php echo $order_detail->currency_symbol; ?>)</small>
<?php } ?>

<? } ?>


</td>
<td><?php echo $product['count']; ?></td>
<td><?php echo $product['price']; ?></td>
<td><?php echo $product['count'] * $product['price']; ?></td>
<td><?php echo $this->cart->format_number($product['price'] * $order_detail->currency_currency); ?> <?php echo $order_detail->currency_symbol; ?></td>
<td><?php echo $this->cart->format_number(($product['count'] * $product['price']) * $order_detail->currency_currency); ?> <?php echo $order_detail->currency_symbol; ?></td>
<td>
<a href="<?php echo $this->config->item('admin_url'); ?>order/product_delete/<?php echo $product['oid']; ?>"><span class="glyphicon glyphicon-remove"></span></a></td>

</tr>

<? } ?>
</tbody>
<tr>
<td colspan="2"></td><td><b>Cargo Price</b></td><td><?php echo $this->cart->format_number($order_detail->cargo_price * $order_detail->currency_currency); ?> <?php echo $order_detail->currency_symbol; ?></td>
</tr>
<tr>
<td colspan="2"></td><td><b>Total Price</b></td><td><?php echo $this->cart->format_number(($order_detail->total + $order_detail->cargo_price) * $order_detail->currency_currency); ?> <?php echo $order_detail->currency_symbol; ?></td>
</tr>
</tbody>
</table>
<form action="<?php echo $this->config->item('admin_url'); ?>order/product_add" method="post" accept-charset="utf-8" class="form-horizontal" role="form">
<div class="form-group">
Expand Down
6 changes: 3 additions & 3 deletions application/views/basket.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<li class="dropdown">
<a href="#" data-toggle="dropdown">
<small> <?php echo $this->lang->line('total'); ?> : <?php echo $this->cart->total_items(); ?> | (<?php echo $cart_total; ?>)</small>
<small> <?php echo $this->lang->line('total'); ?> : <?php echo $this->cart->total_items(); ?> | (<?php echo $cart_total; ?> <?php echo $currency_symbol; ?>)</small>
</a>
<ul class="dropdown-menu">

Expand All @@ -18,8 +18,8 @@
</td>
<td style="text-align:right">
<input type="text" name="qty[]" value="<?php echo $items['qty']; ?>" maxlength="3" size="3" />
x
<?php echo $items['price']; ?>
x <br />
<?php echo $last_price = $this->cart->format_number(($items['price'] * $currency_currency)); ?> <?php echo $currency_symbol; ?>
</td>
<td style="text-align:right">
<?php echo anchor('cart/remove/'.$items['rowid'], $this->lang->line('delete')); ?>
Expand Down
10 changes: 5 additions & 5 deletions application/views/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,18 @@
<?php } ?>

<? } ?>
</td>
<td style="text-align:right"><?php echo $items['price']; ?> <?php echo $currency_symbol; ?></td>
<td style="text-align:right"> <?php echo $items['subtotal']; ?> <?php echo $currency_symbol; ?></td>
</td>
<td style="text-align:right"><?php echo $this->cart->format_number(($items['price'] * $currency_currency)); ?> <?php echo $currency_symbol; ?></td>
<td style="text-align:right"><?php echo $this->cart->format_number(($items['subtotal'] * $currency_currency)); ?> <?php echo $currency_symbol; ?></td>
<td style="text-align:right"><?php echo anchor('cart/remove/'.$items['rowid'], $this->lang->line('cart_delete')); ?> </td>
</tr>

<?php } ?>

<tr>
<td colspan="2"></td>
<td class="right"><strong><?php echo $this->lang->line('total'); ?> <?php echo $currency_symbol; ?></strong></td>
<td class="right"><?php echo $cart_total; ?> </td>
<td class="right"><strong><?php echo $this->lang->line('total'); ?> </strong></td>
<td class="right"><?php echo $cart_total; ?> <?php echo $currency_symbol; ?></td>
</tr>

</table>
Expand Down
2 changes: 1 addition & 1 deletion application/views/order/cargo.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<?php foreach($cargos as $cargo){ ?>
<div class="checkbox">
<label>
<input type="radio" name="cargo_type" value="<?php echo $cargo->id; ?>"> <?php echo $cargo->name; ?> | <?php echo $cargo->price; ?>
<input type="radio" name="cargo_type" value="<?php echo $cargo->id; ?>"> <?php echo $cargo->name; ?> | <?php echo $this->cart->format_number(($cargo->price * $currency_currency)); ?> <?php echo $currency_symbol; ?>
</label>
</div>

Expand Down
8 changes: 4 additions & 4 deletions application/views/order/complete.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

<? } ?>
</td>
<td style="text-align:right"><?php echo $items['price']; ?> <?php echo $currency_symbol; ?></td>
<td style="text-align:right"> <?php echo $items['subtotal']; ?> <?php echo $currency_symbol; ?></td>
<td style="text-align:right"><?php echo $this->cart->format_number($items['price'] * $currency_currency); ?> <?php echo $currency_symbol; ?></td>
<td style="text-align:right"> <?php echo $this->cart->format_number($items['subtotal'] * $currency_currency); ?> <?php echo $currency_symbol; ?></td>
</tr>

<?php } ?>
Expand All @@ -47,15 +47,15 @@
<tr>
<td colspan="2"></td>
<td class="right">Cargo : <strong><?php echo $cargo->name; ?></strong></td>
<td class="right">$<?php echo $this->cart->format_number($cargo->price); ?> <?php echo $currency_symbol; ?></td>
<td class="right"><?php echo $this->cart->format_number($cargo->price * $currency_currency); ?> <?php echo $currency_symbol; ?></td>
</tr>

<? } ?>
<tr>
<td colspan="2"></td>
<td class="right"><strong>Total</strong></td>

<td class="right">$<?php echo $this->cart->format_number($this->cart->total() + $cargo->price); ?> <?php echo $currency_symbol; ?></td>
<td class="right"><?php echo $this->cart->format_number(($this->cart->total() + $cargo->price) * $currency_currency); ?> <?php echo $currency_symbol; ?></td>
</tr>

</table>
Expand Down
Loading

0 comments on commit 5753d00

Please sign in to comment.