Hi
I am making a site where users can book places on training courses.
The sign up module allows users to sign up for the course.
Ubercart allows the user to purchase the course.
On this page, there is a work flow script, which in effect combines Ubercart and Sign Up modules. The script causes the user to be automatically signed up for a course when they purchase it.
I have pasted the script below.
The script works perfectly when the user purchases one course.
However, if the user has two products in their cart, then the user is only signed up for the first course.
Is there any way I can edit the script so it will sign up the user for all the courses in their cart (I'm guessing it must only take a change to a line of code)?
If not, then does anybody have any ideas as to how I can have users be signed up for al the courses in their carts?
array (
'cfg_2' =>
array (
'#active' => 1,
'#module' => 'workflow-ng',
'#weight' => '0',
'#type' => 'configuration',
'#altered' => false,
'#id' => 1,
'#event' => 'checkout_complete',
'#label' => 'Product purchase signup',
0 =>
array (
'#name' => 'workflow_ng_condition_custom_php',
'#id' => 2,
'#type' => 'condition',
'#label' => 'Node has signups enabled',
'#settings' =>
array (
'php' => '$ordernid = $order->products;
$ordernid = $ordernid[0];
$ordernid = $ordernid->nid;
$node = node_load($ordernid);
if ($node->signup == 1) {
return TRUE;
}
else{
return FALSE;
}',
'used_arguments' =>
array (
),
'used_php_arguments' =>
array (
0 => 'order',
),
),
),
1 =>
array (
'#type' => 'action',
'#label' => 'Sign user up!',
'#name' => 'workflow_ng_action_custom_php',
'#id' => 5,
'#settings' =>
array (
'php' => '$ordernid = $order->products;
$ordernid = $ordernid[0];
$ordernid = $ordernid->nid;
$edit[\'nid\'] = $ordernid;
$edit[\'uid\'] = $order->uid;
$edit[\'signup_form_data\'][\'TransactionID\'] = $order->order_id;
signup_sign_up_user($edit);',
'used_arguments' =>
array (
),
'used_php_arguments' =>
array (
0 => 'order',
),
),
),
2 =>
array (
'#id' => 4,
'#type' => 'condition',
'#name' => 'workflow_ng_condition_custom_php',
'#label' => 'User is signed up',
'#negate' => 1,
'#settings' =>
array (
'php' => '$ordernid = $order->products;
$ordernid = $ordernid[0];
$ordernid = $ordernid->nid;
$query = db_query("SELECT sl.uid, u.name FROM {signup_log} sl INNER JOIN {users} u ON sl.uid = u.uid WHERE sl.uid = %d AND sl.nid = %d", $order->uid, $ordernid);
if (db_num_rows($query)>0) {
return TRUE;
}
else {
return FALSE;
}',
'used_arguments' =>
array (
),
'used_php_arguments' =>
array (
0 => 'order',
),
),
),
'#name' => 'cfg_2',
),
) 


Joined: 01/20/2008