Paid for multiple regs in one transaction:
Paid manually (by check, separate Paypal, etc):
Walk ups during Ramble:
Registered:
$lastnames_results = $wpdb->get_results(“select rlc_wpsc_submited_form_data.log_id, rlc_wpsc_submited_form_data.value from rlc_wpsc_submited_form_data, rlc_wpsc_cart_contents where rlc_wpsc_submited_form_data.form_id = 3 and rlc_wpsc_submited_form_data.log_id = rlc_wpsc_cart_contents.purchaseid and rlc_wpsc_cart_contents.name like ‘%”.$year.” Driver Registration%’;”);
$vehicles_results = $wpdb->get_results(“select rlc_wpsc_submited_form_data.log_id, rlc_wpsc_submited_form_data.value from rlc_wpsc_submited_form_data, rlc_wpsc_cart_contents where rlc_wpsc_submited_form_data.form_id = 22 and rlc_wpsc_submited_form_data.log_id = rlc_wpsc_cart_contents.purchaseid and rlc_wpsc_cart_contents.name like ‘%”.$year.” Driver Registration%’;”);
$firstnames = array();
foreach($firstnames_results as $row)
{
$firstnames[$row->log_id] = $row->value;
}
$lastnames = array();
foreach($lastnames_results as $row)
{
$lastnames[$row->log_id] = $row->value;
}
$vehicles = array();
foreach($vehicles_results as $row)
{
$vehicles[$row->log_id] = $row->value;
}
# Use the first names as the master key. Everyone has to have a first name.
foreach($firstnames as $id => $value)
{
echo “#”.$id.” — “.$firstnames[$id].” “.$lastnames[$id].” — “.$vehicles[$id].”
“;
}
?>
* Note: check for duplicates. Delete them on the store sales page of the dashboard.
T-Shirts:
$total_shirts = 0;
foreach ($shirt_results as $row)
{
$tmp = explode(“(“, $row->name);
$shirtsize = rtrim($tmp[1], “)”);
$shirts[$shirtsize] += $row->counts * $row->quantity;
}
foreach($shirts as $id => $value)
{
echo $id.” = “.$shirts[$id].”
“;
$total_shirts += $shirts[$id];
}
echo “Total Shirts = “.$total_shirts.”
“;
?>
Meals:
$extrameal_results = $wpdb->get_results(“select name, quantity, count(*) as counts from rlc_wpsc_cart_contents where name like ‘%”.$year.” Extra Meal Tickets%’ group by name, quantity;”);
$regmeal = 0;
foreach ($regmeal_results as $row)
{
$regmeal += $row->counts * $row->quantity;
}
$extrameal = 0;
foreach ($extrameal_results as $row)
{
$extrameal += $row->counts * $row->quantity;
}
$totalmeal = $regmeal + $extrameal;
echo “Registered meals = “.$regmeal.”
“;
echo “Extra meals = “.$extrameal.”
“;
echo “Total meals = “.$totalmeal.”
“;
?>
Vehicle Breakdown
{
echo $row->value.”
“;
}
?>
Check-in sheet:
$registered = $wpdb->get_results(“SELECT * FROM rlc_wpsc_cart_contents WHERE name like ‘%”.$year.” Driver Registration%’;”);
foreach ($registered as $regrow)
{
echo ”
“;
echo ”
“;
$regid = $regrow->purchaseid;
$tmp1 = explode(“(“, $regrow->name);
$tmp2 = rtrim($tmp1[1], “)”);
$includedshirt = str_replace(“Adult “,””, $tmp2);
$info = array();
foreach ($formfields as $fieldrow)
{
$forminfo = $wpdb->get_var(“SELECT value from rlc_wpsc_submited_form_data WHERE form_id = “.$fieldrow->id.” AND log_id = “.$regid.”;”);
$info[$fieldrow->name] = $forminfo;
}
$paymentinfo = $wpdb->get_results(“SELECT totalprice, processed from rlc_wpsc_purchase_logs WHERE id = “.$regid.”;”);
foreach ($paymentinfo as $paymentrow)
{
$info[‘Amount’] = $paymentrow->totalprice;
if ($paymentrow->processed == 3)
{
$info[‘Status’] = ‘PAID’;
}
else
{
$info[‘Status’] = ‘PAYMENT REQUIRED‘;
}
}
echo ”
“;
echo ”
“.$info[‘Last Name’].”, “.$info[‘First Name’].”
Amount: $”.$info[‘Amount’].” – Status: “.$info[‘Status’].”
“;
echo ”
“.$info[‘Address’].”, “.$info[‘City’].”, “.$info[‘State’].” “.$info[‘Zip Code’].”
“.$info[‘Phone’].”
“.$info[‘Email’].”
“;
echo ”
Reg ID: “.$regid.”
“.$info[‘Year/Make/Model’].”
TLCA# “.$info[‘TLCA # (optional)’].”
“;
echo ”
“;
echo ”
“;
echo ”
Included T-Shirt: “.$includedshirt.”
“;
echo ”
“;
$extrashirts_results = $wpdb->get_results(“SELECT name,quantity from rlc_wpsc_cart_contents WHERE purchaseid = “.$regid.” AND name like ‘%”.$year.” Extra Ramble T-Shirts%’;”);
$extrashirts = “”;
foreach ($extrashirts_results as $row)
{
$tmp = explode(“(“, $row->name);
$shirtsize = rtrim($tmp[1], “)”);
$extrashirts = $extrashirts.str_replace(“Adult “,””, $shirtsize).”(“.$row->quantity.”) “;
}
$extrashirts = rtrim($extrashirts, “”);
echo ”
“;
echo ”
Extra T-Shirts: “.$extrashirts.”
“;
echo ”
“;
$extrameals_results = $wpdb->get_results(“SELECT name,quantity from rlc_wpsc_cart_contents WHERE purchaseid = “.$regid.” AND name like ‘%”.$year.” Extra Meal Tickets%’;”);
$extrameals = 0;
foreach ($extrameals_results as $row)
{
$extrameals += $row->quantity;
}
echo ”
“;
echo ”
Extra Meal Tickets: “.$extrameals.”
“;
echo ”
“;
echo ”
“;
echo ”
“;
}
?>
{
echo ”
“;
$shirt_only_order = 0;
$purchaseid = $row->id;
$cartcontents = $wpdb->get_results(“SELECT name,quantity FROM rlc_wpsc_cart_contents WHERE purchaseid = “.$purchaseid.” and name like ‘”.$year.”%’ order by name desc;”); // Hopefully extra shirts will always be last. Hack, but works.
$extrashirts = “”;
foreach ($cartcontents as $item)
{
if (preg_match(‘/^2024 Extra Ramble T-Shirts/’, $item->name)) // CHANGE THIS YEAR!
{
$tmp = explode(“(“, $item->name);
$shirtsize = rtrim($tmp[1], “)”);
$extrashirts = $extrashirts.str_replace(“Adult “,””, $shirtsize).”(“.$item->quantity.”) “;
$shirt_only_order = 1;
}
if (preg_match(‘/2025 Driver Registration/’, $item->name)) // CHANGE THIS YEAR!
{
$shirt_only_order = 0;
}
if (preg_match(‘/Membership/’, $item->name))
{
$shirt_only_order = 0;
}
}
if ($shirt_only_order)
{
$formfields = $wpdb->get_results(“SELECT * FROM rlc_wpsc_checkout_forms WHERE active = ‘1’ AND type != ‘heading’ ORDER BY checkout_order;”);
$info = array();
foreach ($formfields as $fieldrow)
{
$forminfo = $wpdb->get_var(“SELECT value from rlc_wpsc_submited_form_data WHERE form_id = “.$fieldrow->id.” AND log_id = “.$purchaseid.”;”);
$info[$fieldrow->name] = $forminfo;
}
echo ”
“;echo ”
“;echo ”
“.$info[‘Last Name’].”, “.$info[‘First Name’].”
NO DRIVER BAG
SHIRT ONLY
“;
echo ”
“.$info[‘Address’].”, “.$info[‘City’].”, “.$info[‘State’].” “.$info[‘Zip Code’].”
“.$info[‘Phone’].”
“.$info[‘Email’].”
“;
echo ”
Purchase ID: “.$purchaseid.”
“.$info[‘Year/Make/Model’].”
TLCA# “.$info[‘TLCA # (optional)’].”
“;
echo ”
“;
echo ”
“;
echo ”
T-Shirts Only: “.$extrashirts.”
“;
echo ”
“;
echo ”
“;
echo ”
“;
}
}
?>