PHP generated dropdown as custom field in Hikashop registration

  • Posts: 41
  • Thank you received: 9
7 years 9 months ago #261126

-- HikaShop version -- : 3.0.0
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.5.38
-- Browser(s) name and version -- : Chrome 56.0

Hello!

I'm using Hikashop registration form as default way of registration in my Joomla website. It has nice function like ability to add custom fields (especially dropdowns) to registration form.

Now, what I'd like to do, is add additional custom field (dropdown) during registration. This custom field will be called "Refer to member who invited you to join" and it should return dropdown list of already registred members from my Joomla user category called "Old members". I found the PHP code snippet that allows to return list of members in question (this returns all registred users right now):

$db =& JFactory::getDBO();
$query = "SELECT * FROM #__users" ;
$db->setQuery($query);

$rows = $db->loadObjectList();
foreach ($rows as $row) {
  echo $row->id.'|'.$row->username.'|'.$row->email;
}
But question remains - how to pass this code snippet to Hikashop registration form custom field?

I would be very very thankful if somebody would help me by pointing out, which files should be modified to get expected result. Thanks in advance!

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 9 months ago #261127

Hi,

I'm afraid that I don't understand what you want to do with the list of all users in your Joomla "users" table.

If you want to create your own custom field ; it is possible to do so thanks to a custom plugin (in the way that it requires a specific development).
There is for example the plugin "datepicker" in HikaShop which is working in such kind of way. It is a plugin but it provide a new type of custom field.

Another solution is to create a "classical" custom field and change how that field is displayed during the registration.
It means that the field will be seen as a simple input box for the rest of the website (like in the backend).
That technique is easier to implement, it just require a view override (but need to target the right view) for the implementation.
The user registration can be done via a page (user / registration) or during the checkout (same view if legacy mode ; checkout / sub_block_login_registration otherwise).

More about customization : www.hikashop.com/support/documentation/1...ize-the-display.html
More about development in HikaShop (mostly triggers) : www.hikashop.com/support/documentation/6...r-documentation.html

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.

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

Time to create page: 0.061 seconds
Powered by Kunena Forum