-1

I've followed advice from How to add custom field in review form opencart 2 . So now I can get email in my bd.

But how to show this field in review form below author field?

Community
  • 1
  • 1
Дима
  • 1
  • 2

1 Answers1

0

I first suggest you to invest some time in opencart to get some basics at least. And then please share your code first what you tried so far. SO is not a platform to get ready code. However, here is your solution

1.Open your review model admin\model\catalog\review.php and find the method getReviews(). Now change the query

$sql = "SELECT r.review_id, pd.name, r.author. r.user_email, r.rating, r.status, r.date_added FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product_description pd ON (r.product_id = pd.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";

2.Now open the controller admin\controller\catalog\review.php file and find the method getList(). Here your model has been called to get review. Find

$results = $this->model_catalog_review->getReviews($filter_data);

Now add an array element for your user email. Add this inside loop

foreach ($results as $result) {
 $data['reviews'][] = array(
   ...
   ...
   'user_email' => $result['user_email'],
   ...
   ...

  );
}

3.Now open your file admin\view\template\catalog\review_list.tpl and add an extra column in your table for user email

Abdullah Al Shakib
  • 2,034
  • 2
  • 15
  • 16