whats is it about: A form for a customer request. The request comes from a phone call or via mail, so the form is filled by an admin/ team member (and not by the customer). Fields: topic, the request, customer name, mail, address, phone etc.
here is the challenge: Customers contact data (like name, phone, mail…) should be saved also somewhere else (article? free object?), so these information are available separated from the article with the request.
To avoid duplicate data, there should be also a possibility to check if the customer already exists. if he/ she exists then the existing data should be used for the new request.
It would be really great, if the request is filled with only one step. Filling the request data and the new customer data / filling the request data and choosing the existing customers data and connect it with the request for further steps.
Would not be fair to expect a perfect and detailed solution here for a complex problem like this one (but feel free to do it if you want :) ). It would enough if someone could give me some approach how to start this thing.
Woow, just a brilliant approach! Thx a lot Bucklash! Did not thought about the validation thing at all. And the second idea is also great.
What about editing the customer data in the request article after the first procedure? It often happens, that there is a little typing error like the phone number, zip code etc. So the admin can go back to the request article and changes the customer data directly there.
thx a lot for sharing your thoughts and ideas. also for being so active here generally. really appreciated.
I am focusing on two approaches:
Alternative 1: Entering the customer data in the request form
The admin enters the request data in the form
He also can enter the customer directly in this form: For this approach, i am going to use your great tutorial about creating content dynamically: here
With the beforeStore plugin, i can give the request the art_id of the customer by referencing to the most recent id + 1. (also explained in your tutorial)
Alternative 2: Entering customer data, then request data
The admin enters the customer data in the customer data form and save
This form has a Button „New Request“, which only appears after the the customer form is saved for the first time (workflow: edit).
The Button opens the request form (maybe in a modal window). I give the button the article id of the customer via url-parameter
The request form takes the parameter for referencing to the customer.
Both forms have a list field with the the corresponding customer data/ request(s)
About avoiding duplicate customer data:
Unfortunately only one field (like mail or last name) would not enough for validation. Is there a possibility to combine multiple fields for ajax validation? Example:
first name last name adress zip
exists in this combination. If yes don't save and give a possibility for getting the existing data to the request form. If no, create a new customer.
Unique customer ID and request ID
Also i have some thoughts about a unique, auto_increment customer id and also a request id. Since customer data and the requests are Joomla articles, which is fine for me, article id would not works here. Instead the article id i thought about this:
A new field with storage standard | article | customer_id | int
With beforeStore Plugin, i check the most recent customer_id and give a „+1“ for the next one (also using your tutorial mentioned above). For internal referencing, Joomlas article id would be enough. The customer_id and request_id could be used for other purposes. Otherwise, maybe i could use them also or referencing. I would appreciated if you could also give a thought to this.