Page 1 of 1

Add new field to customer table

Posted: 19 Apr 2018, 15:06
by michal.fehér
Hi, I am trying to add new field to customer (users - I am using laravel) table - Chamber of Commerce number (COC) alongside with existing VAT ID.

I read this forum and there are several topics regarding this, most of them are suggesting extending managers and items, which I find as an overkill for such a common thing (and I am also getting "AccessDeniedHttpException").

You also mentioned this can be done by "reference attribute items via the list table".
Can you please give me more information what does it mean exactly?

Thank you.

Re: Add new field to customer table

Posted: 20 Apr 2018, 09:01
by aimeos
You can use the customer/lists manager to store references to items of other domains, e.g. to attribute items. Attributes can be shared between multiple items but this isn't the case here because your value is specific to for the customer item.

The cleaner approach would be to create add a users_property and users_property_type table using the existing common property and type managers but that doesn't exist yet. If you want to help, we can add that together to the core.

Re: Add new field to customer table

Posted: 20 Apr 2018, 14:30
by michal.fehér
Yes, I can try. Where should I start? What do you suggest?

Re: Add new field to customer table

Posted: 21 Apr 2018, 12:07
by aimeos
Great! :-)

Here are the first steps:
- Add the new property and property type table to the customer schema file
- Create a new customer property and customer property type managers using the common property and common type manager (use the product domain as reference)
- Add the SQL statements for the customer property manager (copy and adapt product property manager SQL)
- Add getPropertyItems() to the customer item and add the necessary code in customer manager searchItems() (also use product manager as reference)