Create multivariables inputs in vendor registration form

  • Posts: 105
  • Thank you received: 2
7 years 5 months ago #254301

-- HikaShop version -- : 2.6.0
-- HikaMarket version -- : 1.6.7

Hello,
i would like to create complex inputs for a vendor . For example (see image sent):
- have the possibility to add as many languages spoken by the vendor (with for each language added, a dropdown list with options coming from a database table of my own)
- give a mastery score for a list of "sectors" for the vendor (with for each competence, several radio buttons, all coming from a database table of my own)
For both of them i was able to build a complete form, loading the values, saving,....(using a $jinput function).. When I save the results, I "implode" some values (languages is a simple implode, so my database "languages" field becomes "id_language1,id_language2,..."; for the "sectors" i built a more complex way with the id of the competence and its score separated by a ::, so I have my database "sectors" field as "id_sector1::score1,id_sector2::score2,...")
I would like to integrate this type of fields/form in the vendor registration but I am stuck.
I started to do the following :
- I created vendor custom fields (languages, sectors,...)
- I edited the "registration.php" view; for each of my add custom filed, I was able to show the fields exactly as in my own form,...

but I don't know how to collect the answers, "implode them" and save them when using the Hikamarket registration form. The key problem is that because of these necessary "implodes", I need to collect the values and "implode" them before they are collected by the Hikamarket function getting the fields and saving them (which is/are the functions that I don't know of)

Could you tell me the how to do it?

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
7 years 5 months ago #254304

Hi,

In order to have the flexibility and the right interfaces everywhere (in the front-end, back-end, in vendor page, email, etc) the best is to use a custom plugin to create a new type of custom field.

The "advanced date picker" is an example of custom field provided by a plugin ; HikaMarket also provide some, like the "vendor selection" one (hikashop / market_vendorselectfield).
With the plugin you can control how the content is "display" (in edition) and how the content is "show" (vendor page, email...).
You can put a complexe structure behind the field and serialize the content into one column in your database (the column for the custom field). That process, made during the "check" can be a simple implode or a json serialization ; it's all up to you.

But the interesting point is that, once you will have you custom plugin field, it will directly work everywhere in your website without need to override a single view.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: rfonta

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.055 seconds
Powered by Kunena Forum