Sorry this is not in the form of a patch, the base code has changed too much since this was done,

This allows a new submit button which adds the first node to the cart, and redirects to a new node/add form.

in the admin.inc

$form['behavior']['uc_node_checkout_add_another_item'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow a user to add multiple items during checkout.'),
    '#default_value' => variable_get('uc_node_checkout_add_another_item', TRUE),
  );
    $form['behavior']['uc_node_checkout_add_another_item_term'] = array(
    '#type' => 'textfield',
    '#title' => t('Term or String for Add Another Item'),
    '#description' => t('"Add Another Item, Sign up another User, Save and Add Another"'),
    '#default_value' => variable_get('uc_node_checkout_add_another_item_term', 'Add Another Item'),
  );

in the .module file

        // Add the product to the cart!
        uc_cart_add_item($product->nid, $product->default_qty, $data, NULL, FALSE, FALSE);

        if ($node->op == variable_get('uc_node_checkout_add_another_item_term',t("Add Another Item"))) {
          $get = array('product_nid='. $product->nid);
          if ($_GET['attr']) {
            $get[] = 'attr='. $_GET['attr'];
          }
          // Redirect to the node add form.
          drupal_set_message(t('%name has been added', array('%name' =>$node->title)));
          drupal_goto('node/add/'. str_replace('_', '-', $node->type), implode('&', $get));
        }
      }
      break;


        if (variable_get('uc_node_checkout_add_another_item', TRUE) && $form_id == 'webinar_registration_node_form') {
          $form['buttons']['add_another_user'] = array (
            '#type' => 'submit',
            '#access' => true,
            '#value' => variable_get('uc_node_checkout_add_another_item_term',t("Add Another Item")),
            '#weight' => -5,
            '#submit' => 
            array (
              0 => 'node_form_submit',
            ),
          );
        }

Comments

aidanlis’s picture

Status: Active » Postponed

Would be cool.