Hallo,
Op http://laurenswebdesign.nl/speeddating/ ... page=test2 ben ik bezig om een speeddating-website op te zetten.
Mensen komen in een overzicht terecht van alle evenementen die in de toekomst zullen plaatsvinden.
Om evenementen toe te voegen gebruik ik de Products-module.
Ik heb een extra veld aangemaakt genaamd 'Plaats' om het aantal plaatsen voor dit evenement weer te geven. Nu wil ik dat mensen zich kunnen inschrijven. Dit moet wel automatisch gebeuren, dus elke inschrijving moet automatisch worden opgeslagen in een bestand met een bijbehorende bestandsnaam. Voor elk evenement een ander bestand.
Als er een inschrijving plaatsvind, moet het aantal plaatsen in de Products-module verminderd worden met één.
Hoe kan ik dit het beste aanpakken?
Groeten
Combinatie Products en Formbuilder ->HELP!
Moderator: velden
-
- Forum Members
- Posts: 61
- Joined: Mon Mar 15, 2010 10:40 am
Combinatie Products en Formbuilder ->HELP!
Last edited by laurensschuitemaker on Sat Jun 26, 2010 3:20 pm, edited 1 time in total.
-
- Forum Members
- Posts: 61
- Joined: Mon Mar 15, 2010 10:40 am
Re: Beschikbare plaatsen
Ik heb onderstaand al uitgeprobeerd, maar dit werkt alleen met het alias van Form Builder. Elke keer dat je op submit klikt, wordt de waarde van het alias verminderd met 1. Nu zou ik graag een script willen dat i.p.v. het alias van Form Builder een waarde van een extra veld van de Products-module verminderd met 1.
Iemand een idee?
Alvast bedankt!
################################################################################
# documentation
################################################################################
/*
{update_counter} is a UDT that can be used to update the 'field_alias" value from a FormBuilder element.
- set up the {current_counter} UDT first
- double check the configuration options below
- connect this UDT to the Event Manager -> Form Builder -> OnFormBuilderFormSubmit event
@todo
- find a solution for double posts
- make the configuration options dynamic using parameters
*/
################################################################################
# configuration
################################################################################
/* since this UDT is specific to 1 form and 1 field specify the following values */
$field_name = 'counter';
################################################################################
# program
################################################################################
if ( isset($params['form_id'])) {
global $gCms;
$db =& $gCms->GetDb();
$query = "SELECT t3.option_id AS option_id
FROM ".cms_db_prefix()."module_fb_form t1,
".cms_db_prefix()."module_fb_field t2,
".cms_db_prefix()."module_fb_field_opt t3
WHERE t1.form_id = t2.form_id
AND t1.form_id = ?
AND t2.name = ?
AND t2.field_id = t3.field_id
AND t3.name = 'field_alias'";
$option_id = $db->GetOne($query, array($params['form_id'], $field_name));
$query = "UPDATE ".cms_db_prefix()."module_fb_field_opt
SET value = value-1
WHERE option_id = ?";
$db->Execute($query, array($option_id));
}
Iemand een idee?
Alvast bedankt!
################################################################################
# documentation
################################################################################
/*
{update_counter} is a UDT that can be used to update the 'field_alias" value from a FormBuilder element.
- set up the {current_counter} UDT first
- double check the configuration options below
- connect this UDT to the Event Manager -> Form Builder -> OnFormBuilderFormSubmit event
@todo
- find a solution for double posts
- make the configuration options dynamic using parameters
*/
################################################################################
# configuration
################################################################################
/* since this UDT is specific to 1 form and 1 field specify the following values */
$field_name = 'counter';
################################################################################
# program
################################################################################
if ( isset($params['form_id'])) {
global $gCms;
$db =& $gCms->GetDb();
$query = "SELECT t3.option_id AS option_id
FROM ".cms_db_prefix()."module_fb_form t1,
".cms_db_prefix()."module_fb_field t2,
".cms_db_prefix()."module_fb_field_opt t3
WHERE t1.form_id = t2.form_id
AND t1.form_id = ?
AND t2.name = ?
AND t2.field_id = t3.field_id
AND t3.name = 'field_alias'";
$option_id = $db->GetOne($query, array($params['form_id'], $field_name));
$query = "UPDATE ".cms_db_prefix()."module_fb_field_opt
SET value = value-1
WHERE option_id = ?";
$db->Execute($query, array($option_id));
}
-
- Forum Members
- Posts: 61
- Joined: Mon Mar 15, 2010 10:40 am
Re: Beschikbare plaatsen
Kan iemand me hier mee helpen?
Ik kom er zelf echt niet uit, en het is dringend.
Alvast bedankt!
Ik kom er zelf echt niet uit, en het is dringend.
Alvast bedankt!
-
- Forum Members
- Posts: 61
- Joined: Mon Mar 15, 2010 10:40 am
Re: Beschikbare plaatsen
Ik heb onderstaand uitgeprobeerd maar dat werkt ook niet
################################################################################
# documentation
################################################################################
/*
@todo
- find a solution for double posts
- make the configuration options dynamic using parameters
*/
################################################################################
# configuration
################################################################################
$form_id = '3';
$field_name = 'Plaats';
################################################################################
# program
################################################################################
if ( isset($params['form_id']) && $params['form_id'] = $form_id ) {
global $gCms;
$db =& $gCms->GetDb();
$query = "SELECT t3.id AS id
FROM ".cms_db_prefix()."module_products t1,
".cms_db_prefix()."module_products_fielddefs t2,
".cms_db_prefix()."module_products_fieldvals t3
WHERE t1.id = t3.product_id
AND t1.id = ?
AND t2.name = ?
AND t3.fielddef_id = '4'";
$option_id = $db->GetOne($query, array($params['orm_id'], $field_name));
$query = "UPDATE ".cms_db_prefix()."module_products_fieldvals
SET value = value-1
WHERE fielddef_id = 4";
$db->Execute($query, array($option_id));
}
################################################################################
# documentation
################################################################################
/*
@todo
- find a solution for double posts
- make the configuration options dynamic using parameters
*/
################################################################################
# configuration
################################################################################
$form_id = '3';
$field_name = 'Plaats';
################################################################################
# program
################################################################################
if ( isset($params['form_id']) && $params['form_id'] = $form_id ) {
global $gCms;
$db =& $gCms->GetDb();
$query = "SELECT t3.id AS id
FROM ".cms_db_prefix()."module_products t1,
".cms_db_prefix()."module_products_fielddefs t2,
".cms_db_prefix()."module_products_fieldvals t3
WHERE t1.id = t3.product_id
AND t1.id = ?
AND t2.name = ?
AND t3.fielddef_id = '4'";
$option_id = $db->GetOne($query, array($params['orm_id'], $field_name));
$query = "UPDATE ".cms_db_prefix()."module_products_fieldvals
SET value = value-1
WHERE fielddef_id = 4";
$db->Execute($query, array($option_id));
}
Re: Combinatie Products en Formbuilder ->HELP!
Wellicht kun je iets met deze topic:
http://forum.cmsmadesimple.org/index.ph ... #msg209562
Grt. Rolf
http://forum.cmsmadesimple.org/index.ph ... #msg209562
Grt. Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
-
- Forum Members
- Posts: 61
- Joined: Mon Mar 15, 2010 10:40 am
Re: Combinatie Products en Formbuilder ->HELP!
Ik heb even hulp gevraagd bij een programmeur, maar die snapte ook niet waarom http://forum.cmsmadesimple.org/index.php/topic,45155.msg214701.html#msg214701 niet werkte..Wellicht kun je iets met deze topic:
http://forum.cmsmadesimple.org/index.ph ... #msg209562
Grt. Rolf
Welke aanpassingen zou ik moeten doen in dit script zodat het wel gaat werken?
Alvast bedankt!
Groeten Laurens