Skip to content

Commit a007519

Browse files
author
BitWasp
committed
Display time that the item was added, as well as last time the item was updated
1 parent 8d286fb commit a007519

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

application/controllers/items.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function get($hash) {
157157
$data['item'] = $this->items_model->get($hash);
158158
if($data['item'] == FALSE)
159159
redirect('items');
160-
160+
161161
$this->load->model('shipping_costs_model');
162162

163163
$info = (array)json_decode($this->session->flashdata('returnMessage'));

application/controllers/listings.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* @package BitWasp
99
* @subpackage Controllers
10-
* @category Items
10+
* @category Listings
1111
* @author BitWasp
1212
*
1313
*/
@@ -16,11 +16,6 @@ class Listings extends CI_Controller {
1616
/**
1717
* Constructor
1818
*
19-
* @access public
20-
* @see Models/Items_Model
21-
* @see Models/Listings_Model
22-
* @see Models/Currencies_Model
23-
* @see Libraries/Image
2419
*/
2520
public function __construct() {
2621
parent::__construct();

application/models/items_model.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function get_list($opt = array()) {
5757
$this->load->model('location_model');
5858
$results = array();
5959

60-
$this->db->select('id, hash, price, vendor_hash, currency, hidden, category, name, description, main_image')
60+
$this->db->select('id, hash, price, vendor_hash, currency, hidden, category, name, add_time, update_time, description, main_image')
6161
->where('hidden !=', '1')
6262
->order_by('add_time ASC');
6363

@@ -105,6 +105,9 @@ public function get_list($opt = array()) {
105105
$row['main_image'] = $this->images_model->get($row['main_image']);
106106
$row['currency'] = $this->currencies_model->get($row['currency']);
107107
$row['price_b'] = round(($row['price']/$row['currency']['rate']), '8', PHP_ROUND_HALF_UP);
108+
$row['add_time_f'] = $this->general->format_time($row['add_time']);
109+
110+
$row['update_time_f'] = $this->general->format_time($row['update_time']);
108111
$local_currency = $this->currencies_model->get($this->current_user->currency['id']);
109112
$price_l = (float)($row['price_b']*$local_currency['rate']);
110113
$price_l = ($this->current_user->currency['id'] !== '0') ? round($price_l, '2', PHP_ROUND_HALF_UP) : round($price_l, '8', PHP_ROUND_HALF_UP);
@@ -153,7 +156,8 @@ public function get($hash) {
153156
$price_l = ($this->current_user->currency['id'] !== '0') ? round($price_l, '2', PHP_ROUND_HALF_UP) : round($price_l, '8', PHP_ROUND_HALF_UP);
154157
$row['price_l'] = $price_l;
155158
$row['price_f'] = $local_currency['symbol'].''.$row['price_l'];
156-
159+
$row['add_time_f'] = $this->general->format_time($row['add_time']);
160+
$row['update_time_f'] = $this->general->format_time($row['update_time']);
157161
$row['main_image'] = $this->images_model->get($row['main_image']);
158162
$row['ship_from_f'] = $this->location_model->location_by_id($row['ship_from']);
159163
$row['images'] = $this->images_model->by_item($hash);

application/views/items/get.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010
echo anchor('admin/delete_item/'.$item['hash'], 'Delete', 'class="btn"');
1111
} ?>
1212
<?php echo $item['name'] ?></h2>
13-
<p class="vendor">
13+
<div class="row-fluid">
1414
Vendor: <?php echo anchor('user/'.$item['vendor']['user_hash'],$item['vendor']['user_name']); ?>
15-
<span class="rating">(0)</span>
16-
</p>
15+
<span class="rating">(0)</span><br/>
16+
Added: <?php echo $item['add_time_f']; ?>
17+
<?php if($item['update_time'] !== '0') { ?>
18+
<br />Last Updated:<?php echo $item['update_time_f']; ?>
19+
<?php } ?>
20+
</div>
1721

1822
<div class="price">
1923
Price: <span class="priceValue"><?php echo $item['price_f'];?></span>

0 commit comments

Comments
 (0)