Post by Etheravion » Sat Jul 18, 2020 12:38 am

Hi,

May I know is it possible to have custom field for customer but viewable by admin only for OC 3.0.3.3?

New member

Posts

Joined
Wed Oct 17, 2012 9:16 pm

Post by opencart.my » Mon Jul 20, 2020 12:11 pm

Hi @Etheravion,

There's a way but not directly.

Since custom fields are bound by Customer Group, you can create a hidden Customer Group for the admin-only Custom Fields you need.

Step 1:
Create a new Customer Group, and make sure it's not Selectable by your visitors during registration in admin > System > Settings > under Option tab > Account section > Customer Groups:
oc-settings-account-customergroups.png

oc-settings-account-customergroups.png (49.4 KiB) Viewed 105 times

Step 2:
Create your Custom Field, and make sure to assign the Customer Group you just created before in Step 1.
oc-customfield-customergroup.png

oc-customfield-customergroup.png (44.37 KiB) Viewed 105 times

Step 3:
Edit your customer, switch to the Customer Group your created in Step 1 to reveal the Custom Field that you have created in Step 2 to enter your data:
oc-edit-customer-customfield.png

oc-edit-customer-customfield.png (40.59 KiB) Viewed 105 times

Step 4:
Before saving, switch back to the original/Default Customer Group. Although the Custom Field will be hidden, but the value will actually get saved.

You can retrieve it again by switching the customer's Customer Group to the hidden Customer Group, and the Custom Field and its data will be revealed.

Hope it helps. Note that this is a workaround, so I'm not sure if this behaviour will stay in future OpenCart versions or not.

Developing Quality OpenCart Extensions since 2011. View my Extensions.


User avatar
New member

Posts

Joined
Mon Jan 22, 2018 6:03 pm

Who is online

Users browsing this forum: No registered users and 21 guests