When you try to hide certain form fields "uc_cart_checkout_form" error occurs:
Notice: Undefined index: #title in theme_uc_address_pane() (line 466 of .../ubercart/uc_cart/uc_cart_checkout_pane.inc).
And also on the form itself formed artifacts labels (visible only character ":").

The source code of the module:
function fastbuy_form_alter(&$form, &$form_state, $form_id) {
if ( $form_id == 'uc_cart_checkout_form' ) {

// Hide fields
unset($form['panes']['billing']['billing_country']);
$form['panes']['billing']['billing_country'] = array(
'#default_value' => '752', // Sweden
'#type' => 'hidden',
'#prefix' => '',
'#suffix' => ''
);

unset($form['panes']['billing']['billing_zone']);
$form['panes']['billing']['billing_zone'] = array(
'#default_value' => '22',
'#type' => 'hidden'
);

// Restore save fields
$form['panes']['billing']['billing_city']['#default_value'] = $_SESSION['FASTBUY_CITY'];
$form['panes']['billing']['billing_postal_code']['#default_value'] = $_SESSION['FASTBUY_ZIPCODE'];
$form['panes']['billing']['billing_street1']['#default_value'] = $_SESSION['FASTBUY_ADDRESS'];

return;
}
}

This patch can fix the problem.

CommentFileSizeAuthor
uc_cart_checkout_pane.inc_.patch573 bytesoleg_iskusnyh

Comments

longwave’s picture

Status: Patch (to be ported) » Needs review
Issue tags: -drupal 7, -ubercart 3

Patch should perhaps use !empty() rather than isset() so #title can either be unset or blank to avoid displaying the ':' character.

Status: Needs review » Needs work

The last submitted patch, uc_cart_checkout_pane.inc_.patch, failed testing.

longwave’s picture

Also note that this code will likely change when #1071332: State/Province select boxes need converting to Ajax lands.

longwave’s picture

Category: bug » support
Status: Needs work » Fixed

You should use $form[...]['#access'] = FALSE to hide fields rather than unsetting them.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.