Post by Scott2018s » Fri May 18, 2018 8:17 am

Hello

Please,I need help , when a client add review her full name appears, how can add and change this how add username field when client register and when add review

User avatar
New member

Posts

Joined
Fri May 18, 2018 7:59 am

Post by yodapt » Fri May 18, 2018 9:22 pm

Do you have that username field already created?

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com


User avatar
Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm


Post by sw!tch » Sat May 19, 2018 3:03 am

If you look at the DB table for reviews you will see author. All OC is doing is pre-filling the customer name when they are signed in.

Really, if review is your only concern, then you should be able to easily allow a customer to specify the review name without touching the controller or adding additional DB columns.

For the default theme -

catalog/view/theme/default/template/product/product.twig

Find

Code: Select all

<label class="control-label" for="input-name">{{ entry_name }}</label>
<input type="text" name="name" value="{{ customer_name }}" id="input-name" class="form-control" />
Replace

Code: Select all

 <label class="control-label" for="input-name">{{ entry_name }}</label>
 <input type="text" name="name" id="input-name" class="form-control" />
You can add a new language definition in place of {{ entry_name }} or put a note that the name used will be shown publicly.

Backup, untested, try at your own risk.

If the above doesn't work then another option would be to just show the first name and first letter of the last name. (e.g John Doe, would become John D.).

You would need to do this from the controller, which is separate code.

Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by Scott2018s » Sat May 19, 2018 9:13 am

sw!tch wrote:
Sat May 19, 2018 3:03 am
If you look at the DB table for reviews you will see author. All OC is doing is pre-filling the customer name when they are signed in.

Really, if review is your only concern, then you should be able to easily allow a customer to specify the review name without touching the controller or adding additional DB columns.

For the default theme -

catalog/view/theme/default/template/product/product.twig

Find

Code: Select all

<label class="control-label" for="input-name">{{ entry_name }}</label>
<input type="text" name="name" value="{{ customer_name }}" id="input-name" class="form-control" />
Replace

Code: Select all

 <label class="control-label" for="input-name">{{ entry_name }}</label>
 <input type="text" name="name" id="input-name" class="form-control" />
You can add a new language definition in place of {{ entry_name }} or put a note that the name used will be shown publicly.

Backup, untested, try at your own risk.

If the above doesn't work then another option would be to just show the first name and first letter of the last name. (e.g John Doe, would become John D.).

You would need to do this from the controller, which is separate code.
Thanks a lot for useful information provided, best wishes

User avatar
New member

Posts

Joined
Fri May 18, 2018 7:59 am

Post by Scott2018s » Sat May 19, 2018 9:20 am

yodapt wrote:
Fri May 18, 2018 9:22 pm
Do you have that username field already created?
in register page there are no username field

User avatar
New member

Posts

Joined
Fri May 18, 2018 7:59 am
Who is online

Users browsing this forum: JNeuhoff and 20 guests