Custom field values should not exceed total members

  • Leon Treff
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 10 months ago #116792 by Leon Treff
Hello,

For a specific event with group registration, for which I do not need any detailed info of the members, I have created two custom fields "Adults" and "Childs" of type number to simply know the quantity of adults and childs being participating members of the group.
How can I check that the sum of the values entered for "Adults" and "Childs" does not exceed the quantity of members to be indicated in a group registration ?

Sincerely,
Leon

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

More
6 years 10 months ago #116802 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Custom field values should not exceed total members
Hi Leon

Unfortunately, there is no way to do that using Events Booking. If you just want to have simple thing like that, maybe you should not use group registration and use individual registration instead

Tuan

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

  • Leon Treff
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 10 months ago - 6 years 10 months ago #116819 by Leon Treff
Hello,

the price for the event is 15 € per participant.
If I use individual registration, and the user indicates 3 adults and 2 children as participants in the custom number fields, I did not achieve to get the total amount of 3*15 + 2*15 = 75, instead the total amount to pay remains at 15.
How to set up the fee formulas to get the expected result?

Sincerely,
Leon
Last edit: 6 years 10 months ago by Leon Treff.

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

More
6 years 10 months ago #116821 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Custom field values should not exceed total members
Why not? How you allow members to enter number of adult and registrants? Enter it directly using a textbox input? Or allow selecting the numbers from dropdown?

Please let us know so that we can guide you with correct setup

Tuan

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

  • Leon Treff
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 10 months ago - 6 years 10 months ago #116823 by Leon Treff
The custom fields are number fields with min value 1, max value 10 and step 1.
At registration, the user can type his value, e.g. 3 or select the value by scrolling the selection between 1 and 10.

If my field is called Nb_adults, I tried to use the following fee formula, but I did not succeed:
[SUB_TOTAL]=[NB_ADULTS]*[INDIVIDUAL_PRICE
]
Leon
Last edit: 6 years 10 months ago by Leon Treff.

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

  • Leon Treff
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
6 years 10 months ago #116838 by Leon Treff
Finally,
I achieved to set up the custom fields and the fee formulas to work correctly as expected.

Now, I want to add a server side rule for checking that the total quantity of members indicated at registration is in the range from 6 to 10.

I defined the following rule in the file validator.php:

<?php
/**
* @package Joomla
* @subpackage Event Booking
* @author Tuan Pham Ngoc
* @copyright Copyright (C) 2010 - 2018 Ossolution Team
* @license GNU/GPL, see LICENSE.php
*/

defined('_JEXEC') or die;

Valitron\Validator::addRule('Adultchild', function($field, $value, array $params, array $fields) {
if (($value + $fields[1]) < 6) OR (($value + $fields[1]) > 10)
{
return false;
}

return true;
}, 'Group must have 6 to 10 persons');
>

and in the custom field I call the rule with: Adultchild($fields=>'[NB_CHILDREN]')

But this does not work yet. Could someone explain me the correct calling syntax?

Thank you.
Leon

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

Moderators: Tuan Pham Ngoc