Add new field to customer table

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
michal.fehér
Posts: 44
Joined: 05 Feb 2018, 09:57

Add new field to customer table

Post by michal.fehér » 19 Apr 2018, 15:06

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.

User avatar
aimeos
Administrator
Posts: 8239
Joined: 01 Jan 1970, 00:00

Re: Add new field to customer table

Post by aimeos » 20 Apr 2018, 09:01

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.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

michal.fehér
Posts: 44
Joined: 05 Feb 2018, 09:57

Re: Add new field to customer table

Post by michal.fehér » 20 Apr 2018, 14:30

Yes, I can try. Where should I start? What do you suggest?

User avatar
aimeos
Administrator
Posts: 8239
Joined: 01 Jan 1970, 00:00

Re: Add new field to customer table

Post by aimeos » 21 Apr 2018, 12:07

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)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply