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.
| Comment | File | Size | Author |
|---|---|---|---|
| uc_cart_checkout_pane.inc_.patch | 573 bytes | oleg_iskusnyh |
Comments
Comment #1
longwavePatch should perhaps use !empty() rather than isset() so #title can either be unset or blank to avoid displaying the ':' character.
Comment #3
longwaveAlso note that this code will likely change when #1071332: State/Province select boxes need converting to Ajax lands.
Comment #4
longwaveYou should use $form[...]['#access'] = FALSE to hide fields rather than unsetting them.