Post by paola_84 » Thu Jul 10, 2025 3:20 am

Hello,
in Admin, version 3.0.3.8, I'd like to see which customer left each review (I don't allow guests to post reviews).
I saw that the "oc_review" table in the database contains the customer ID so how can I display the customer's name in the review list?
Thank you!

Newbie

Posts

Joined
Fri Mar 21, 2025 2:39 am

Post by paulfeakins » Thu Jul 10, 2025 7:44 pm

paola_84 wrote:
Thu Jul 10, 2025 3:20 am
I saw that the "oc_review" table in the database contains the customer ID so how can I display the customer's name in the review list?
Try:

Code: Select all

SELECT * FROM `oc_review` r
JOIN `oc_customer` c 
ON r.customer_id = c.customer_id;

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by paola_84 » Fri Jul 11, 2025 12:59 am

Thank you Paul!
I'm not SQL savvy enough. I know I need to edit admin/model/review.php but I don't know exactly where.
Should I change this:

Code: Select all

public function getReviews($data = array()) {
		$sql = "SELECT r.review_id, pd.name, r.author, 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') . "'";
or create a new function?

Newbie

Posts

Joined
Fri Mar 21, 2025 2:39 am

Post by paulfeakins » Fri Jul 11, 2025 6:45 pm

paola_84 wrote:
Fri Jul 11, 2025 12:59 am
I'm not SQL savvy enough.
This really is such a simple thing that if it doesn't make sense, you probably shouldn't be poking around with any code at all on a live ecommerce shop.

You should probably find a freelancer from the Commercial Support Forum.

However, it does seem to already output the Author name "r.author" - isn't that working on yours?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by paola_84 » Fri Jul 11, 2025 7:52 pm

Don't worry, it's not online yet. I know HTML and CSS well, a little PHP but not SQL. "Author" is what customers enter when they write the review and can be different from their real name. I'd just like to be able to link reviews to customers in the admin area. It's one of those things that I don't understand why it hasn't been done, given that the database is already set up to do so.
Thank you anyway for your time! :)

Newbie

Posts

Joined
Fri Mar 21, 2025 2:39 am
Who is online

Users browsing this forum: No registered users and 6 guests