Skip to content

Commit 1b222af

Browse files
author
Bitwasp
committed
Display vendors rating on an items page
1 parent c71a05a commit 1b222af

File tree

8 files changed

+17
-658
lines changed

8 files changed

+17
-658
lines changed

application/config/form_validation.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,10 @@
535535
array('field' => 'buyer_address',
536536
'label' => 'Address',
537537
'rules' => 'required|htmlentities'
538+
),
539+
array('field' => 'public_key',
540+
'label' => 'Public Key',
541+
'rules' => 'required|callback_check_public_key'
538542
)
539543
),
540544
'vendor_submit_review' => array(

application/controllers/accounts.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function view($hash) {
4949
$data['review_count']['all'] = $this->review_model->count_reviews('user', $data['user']['user_hash']);
5050
$data['review_count']['positive'] = $this->review_model->count_reviews('user', $data['user']['user_hash'], 0);
5151
$data['review_count']['disputed'] = $this->review_model->count_reviews('user', $data['user']['user_hash'], 1);
52+
$data['average_rating'] = $this->review_model->current_rating('user', $hash]);
5253

5354
// Load information for the view.
5455
$data['logged_in'] = $this->current_user->logged_in();

application/controllers/items.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,9 @@ public function get($hash) {
183183
$data['review_count']['all'] = $this->review_model->count_reviews('item', $hash);
184184
$data['review_count']['positive'] = $this->review_model->count_reviews('item', $hash, 0);
185185
$data['review_count']['disputed'] = $this->review_model->count_reviews('item', $hash, 1);
186-
$data['average'] = $this->review_model->current_rating('item', $hash);
187-
186+
$data['average_rating'] = $this->review_model->current_rating('item', $hash);
187+
$data['vendor_rating'] = $this->review_model->current_rating('user', $data['item']['vendor']['user_hash']);
188+
188189
if($data['browsing_currency']['id'] !== '0' && $data['shipping_costs'] !== FALSE){
189190
$this->load->model('currencies_model');
190191
$currency = $this->currencies_model->get($data['browsing_currency']['id']);

application/controllers/orders.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function list_purchases() {
178178
$data['orders'] = $this->order_model->my_purchases();
179179
if($data['orders'] !== FALSE) {
180180
$id_list = array();
181-
foreach($data['orders'] as $t_order){
181+
foreach($data['orders'] as $t_order) {
182182
$id_list[] = $t_order['id'];
183183
}
184184
$data['review_auth'] = $this->review_auth_model->user_tokens_by_order($id_list);
@@ -440,7 +440,7 @@ public function place($id) {
440440
$data['fees']['shipping_cost'] = $this->shipping_costs_model->costs_to_location($data['order']['items'], $data['order']['buyer']['location']);
441441
$data['fees']['fee'] = $this->fees_model->calculate(($data['order']['price']+$data['fees']['shipping_cost']));
442442
$data['fees']['total'] = $data['fees']['shipping_cost']+$data['fees']['fee'];
443-
443+
444444
if($this->form_validation->run('order_place') == TRUE) {
445445

446446
if($balance <= 0 || $balance < ($data['order']['price']+$data['fees']['total'])) {

0 commit comments

Comments
 (0)