Re: Extracting fields from user registration form and adding to

Posts: 67
Joined: 05/05/2008
Bug Finder

(Ubercart RC4)

OK I must be missing something obvious here...

I've got the form fields I want on the checkout page, but when the form is submitted error messages come up saying that the required fields (within the new set of fields I created) are not filled out, even though they are.

I print out $arg1 and $arg2 from within the PROCESS case of uc_checkout_pane_profile() (callback for uc_profile_checkout_pane()), and get this: $arg1 contains all of ubercart's fields (properly filled out), while $arg2 contains all of my fields, and they're all empty...

Here is the module code:

<?php
/*******************************************************************************
* Hook Functions (Ubercart)
******************************************************************************/

/**
* Implementation of hook_checkout_pane().
*/
function uc_profile_checkout_pane()
{
   
$panes[] = array(
       
'id' => 'profile',
       
'callback' => 'uc_checkout_pane_profile',
       
'title' => t('Profile Information'),
       
'desc' => t("Display additional profile fields."),
       
'weight' => 20,
       
'process' => TRUE,
       
'collapsible' => TRUE,
    );

    return
$panes;
}

/*******************************************************************************
* Callback Functions, Forms, and Tables
******************************************************************************/

/**
* Callback for uc_profile_checkout_pane()
*/   
function uc_checkout_pane_profile($op, &$arg1, $arg2)
{
    switch (
$op)
    {
        case
'view':
           
$description = t('Please fill out your profile information!');
           
           
$contents = uc_profile_checkout_form();
                       
            return array(
'contents' => $contents, 'description' => $description);

        case
'process':
       
            echo
'uc_checkout_pane_profile() -> PROCESS case';
           
print_rr($arg1);
           
print_rr($arg2);       
                   
            return
TRUE;

        case
'review':           
           
$review = 'test123';
            return
$review;
    }
}

/**
* Generates the form displayed on the checkout page
*/   
function uc_profile_checkout_form()
{
   
// tons of junk which generates the form here    
   
return $form;
}
?>

Can anyone shed some light?

//edit
According to http://www.ubercart.org/docs/developer/245/checkout, I "must implement hook_order() to save/load information collected in a pane." So, I guess I have to save the information within hook_order(), and then display it (load case) for the review page?

//edit2
Does't look like any of my custom fields are available to hook_order in the SAVE case :/...

Extracting fields from user registration form and adding to checkout form? By: kerunt (6 replies) Tue, 07/15/2008 - 16:35