By DLZJ on
Hi,
I am using Ubercart 2.x.
I have the following problems while checking out:
1) It required a email address, but how can I make it a non-compulsory. Meaning, the customer can buy without providing an email address?
2) On the other hand, there is a phone number column. How can I make it compulsory field?
3) Can I add in another extra field (eg: cell phone number or office number) in the checkout? I have searched over the forum, but I can't find the solution, because UC profile is not working in checkout and Extra Fields Checkout Pane module can only create an additional billing and delivery address.
Thanks for your advice.
Comments
The email is the tricky one,
The email is the tricky one, since Drupal requires an email address when registering. There is a module that removes this requirement (and does it in an original quite tricky, that works quite well), but I don't remember exactly what module it is. Search around through the modules page to find it.
For the other ones, you can either implement hook_user(), or else use the profile module that ships with core.
Contact me to contract me for D7 -> D10/11 migrations.
2) You can set the phone
2) You can set the phone number field to required at admin/store/settings/checkout/edit/fields
3) Where do you want the extra field to appear?
If you want it to appear in the delivery and/or the billing pane, you might want to try the 2.x-dev version of Extra Fields Pane. You can choose if you want it in the delivery pane only, the billing pane only or both. (Note that UC Addresses integration is not yet completed: if you use UC Addresses there is a workaround available, if not, there is not much to worry about).
If you want it to appear in a separate pane, you have more options:
UC Profile
All the fields should be created on admin/user/profile and get the catogory 'Ubercart'. The values filled in at checkout are binded to the user, not to the order. The values are editable by the user in it's user profile
Ubercart Webform Checkout Panes
With this module you can add multiple custom panes for checkout. Fields are defined with the Webforms module. Recommended if you need multiple panes or need special field types.
Extra Fields Checkout Pane
With the 2.x-dev version there is also one extra information pane available. Supported field types are textfields, selectfields and 'constants'. Recommended if you want one custom checkout pane only and if you also need extra address fields.
Thanks, MegaChriz! With your
Thanks, MegaChriz!
With your advice, I have now solved the 2nd and 3rd problems.
However, my 1st problem remains. I have searched through the forum and the nearest solution is http://drupal.org/project/localemail. But, I have tried and it only works in Drupal, not Ubercart. It seems there is no link between this module and Ubercart.
I am still searching for other solution to make the email address as optional rather than a compulsory. Similar question arised but without an answer. I shall continue to look for it and update the solution here if I found one.
Thanks.
Customize Ubercart Checkout
Check this out, I think this might help you - http://drupal.org/node/99403
Adding extra pane in ubercart Checkout
Hello ,
You can add extra information by creating a new pane @ ubercart checkout / process / review checkout .
function taxpane_uc_checkout_pane() {
$panes['taxpane'] = array(
'callback' => 'uc_checkout_pane_taxpane',
'title' => t('Tax Exempt'),
'desc' => t('Get the information about the tax for exemption.'),
'weight' => 2,
);
return $panes;
}
/**
*
* Implementation of hook_checkout_pane()
*
*/
function uc_checkout_pane_taxpane($op, $order, $form = NULL, &$form_state = NULL) {
global $user;
switch ($op) {
case 'view':
global $user;
if ($user->uid) {
$is_tax_exempted = db_query("SELECT field_taxexempt_value FROM {field_data_field_taxexempt}
where entity_id= :uid", array(':uid' =>$user->uid))->fetchField();
$tax_id = '';
if( isset($is_tax_exempted) ) {
$tax_id = db_query("SELECT field_taxid_value FROM {field_data_field_taxid}
where entity_id= :uid", array(':uid' =>$user->uid))->fetchField();
$description = t('Your tax id below.');// . '
'
//$contents['primary_email'] = array('#type' => 'hidden', '#value' => check_plain($email));
$contents['email_text'] = array(
'#markup' => '
',
);
return array('description' => $description, 'contents' => $contents);
}
else {
return array('description' => '', 'contents' => '');
}
}
return array('description' => '', 'contents' => '');
case 'process':
$pane = $form_state['values']['panes']['taxpane'];
if (!empty($pane['email_text']) ) {
$order->taxid = $pane['email_text']; }
return TRUE;
case 'review':
global $user;
if ($user->uid) {
$is_tax_exempted = db_query("SELECT field_taxexempt_value FROM {field_data_field_taxexempt}
where entity_id= :uid", array(':uid' =>$user->uid))->fetchField();
$tax_id = '';
if( isset($is_tax_exempted) ) {
$tax_id = db_query("SELECT field_taxid_value FROM {field_data_field_taxid}
where entity_id= :uid", array(':uid' =>$user->uid))->fetchField();
}
}
$review[] = array('title' => t('Tax ID'), 'data' => $tax_id ); //check_plain($order->email_text));
return $review;
//return TRUE;
}
}
Vikas kumar