Index: commerce_registration.module
===================================================================
--- commerce_registration.module	(revision 8)
+++ commerce_registration.module	(working copy)
341a342,369
> 		// Add Waitlist functionality to select list products
> 		foreach ($form['product_id']['#options'] as $product_id => $title) {
>           $product = commerce_product_load($product_id);
> 		  $reg_setting = registration_entity_settings('commerce_product', $product_id);
> 		  $capacity = (int) $reg_setting['capacity'];
>           $avail = $capacity - registration_event_count('commerce_product', $product_id);
> 		  $wait_enabled = $reg_setting["settings"]["registration_waitlist_enable"];
> 		  // Modify sidebar if waitlist is enabled and our reg count is hit exceeded capacity
> 		  	if ($avail <= 0 && $wait_enabled == "1") {
> 				// Since editing the $form array didn't work when you have more than one product, 
> 				// I created some fields on the product entity to hold data. So if waitlist is activated, we display a 
> 				// message and update a select field with the new wait option. This can be improved
> 				// set the value of the warning text box
> 			  	$product->field_wait_list_warning["und"]["0"]["value"] = $product->field_wait_list_warning["und"]["0"]["value"] = t('<em>This section is currently only accepting <strong>Wait List</strong> registrants. After you complete your registration and order, you will be placed on a <strong>Wait List</strong> and you will be contacted when your registration is accepted. If you are not accepted, your payment will be refunded to you.</em>');
> 				// set the format since we are using html
> 				$product->field_wait_list_warning["und"]["0"]["format"] = $product->field_wait_list_warning["und"]["0"]["format"] = 'full_html';
> 				// I have a dropdown for registration state as well on the product entity, useful for creating specialized waitlist emails
> 				$product->field_registration_state["und"]["0"]["value"] = $product->field_registration_state["und"]["0"]["value"] = 'wait';
> 				// People shouldn't have to pay for being on a wait list, so here we modify the price of the product as well before saving the product
> 				$price = '0';
> 				$product->commerce_price["und"][0]["amount"] = $price;
> 				$product->commerce_price["und"][0]["data"]["components"][0]["price"]['amount'] = $price;
> 				// save the product so our changes above are reflected immediately
>            		commerce_product_save($product);
> 				// Would like to make the following work to modify the add to cart button, but ends up replacing all products add to cart button, not just selected
> 				// $form['submit']['#attributes']['title'] = $form['submit']['#attributes']['value'] = t('Add to Wait List');
> 			}
> 		}
376a405,431
> 		  $errors = array();
> 	      if (registration_status('commerce_product', $product->product_id, FALSE, 1, NULL, $errors)) {
> 		    if (in_array(t('insufficient spaces remaining'), $errors) && count($errors) == 1) {
> 				// Since editing the $form array didn't work when you have more than one product, 
> 				// I created some fields on the product entity to hold data. So if waitlist is activated, we display a 
> 				// message and update a select field with the new wait option. This can be improved
> 				// set the value of the warning text box
> 			  	$product->field_wait_list_warning["und"]["0"]["value"] = $product->field_wait_list_warning["und"]["0"]["value"] = t('<em>This section is currently only accepting <strong>Wait List</strong> registrants. After you complete your registration and order, you will be placed on a <strong>Wait List</strong> and you will be contacted when your registration is accepted. If you are not accepted, your payment will be refunded to you.</em>');
> 				// set the format since we are using html
> 				$product->field_wait_list_warning["und"]["0"]["format"] = $product->field_wait_list_warning["und"]["0"]["format"] = 'full_html';
> 				// I have a dropdown for registration state as well on the product entity, useful for creating specialized waitlist emails
> 				$product->field_registration_state["und"]["0"]["value"] = $product->field_registration_state["und"]["0"]["value"] = 'wait';
> 				// People shouldn't have to pay for being on a wait list, so here we modify the price of the product as well before saving the product
> 				$price = '0';
> 				$product->commerce_price["und"][0]["amount"] = $price;
> 				$product->commerce_price["und"][0]["data"]["components"][0]["price"]['amount'] = $price;
> 				// save the product so our changes above are reflected immediately
>            		commerce_product_save($product);
> 				// Would like to make the following work to modify the add to cart button, but ends up replacing all products add to cart button, not just selected
> 				// $form['submit']['#attributes']['title'] = $form['submit']['#attributes']['value'] = t('Add to Wait List');
> 				$form['capacity'] = array(
> 					'#type' => 'markup',
> 					'#markup' => '',
> 				);
> 			}
> 			$form['submit'] = $submit;
> 		  }
380,386c435,441
<           else {
<             $form['not_available'] = array(
<               '#type' => 'markup',
<               '#markup' => '<p><strong>' . t('This item is currently unavailable.')
<               . '</strong></p>',
<             );
<           }
---
>           //else {
>           //  $form['not_available'] = array(
>           //    '#type' => 'markup',
>           //    '#markup' => '<p><strong>' . t('This item is currently unavailable.')
>           //   . '</strong></p>',
>           //  );
>           //}
