Closed (won't fix)
Project:
Commerce Core
Version:
7.x-1.11
Component:
Payment
Priority:
Normal
Category:
Support request
Assigned:
Issue tags:
Reporter:
Created:
16 Jul 2015 at 13:25 UTC
Updated:
21 Apr 2016 at 14:51 UTC
Jump to comment: Most recent
Comments
Comment #1
dishabhadra commentedInstead of adding checkbox using hook_form_alter() you can use hook_commerce_checkout_pane_info() add new pane.
Then you can write submit handler and attach the value of checkbox in to order data so you can use it while redirecting.
Find code below : I hope this will help you out.
/**
* Implements hook_commerce_checkout_pane_info()
*/
function hook_commerce_checkout_pane_info() {
$panes['name_of_pane'] = array(
'title' => t('title'),
'page' => 'checkout',
'weight' => 10,
'base' => 'custom_pane',
);
return $panes;
}
/**
* Implements base_checkout_form()
*/
function custom_pane_checkout_form($form, $form_state, $checkout_pane, $order) {
$checkout_form ['checkbox'] = array (
'#type' => 'checkbox',
'#title' => t ( 'title ')
);
return $checkout_form;
}
/**
* Implements base_checkout_form_submit
*
* @param unknown $form
* @param unknown $form_state
* @param unknown $checkout_pane
* @param unknown $order
*/
function custom_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) {
// save checkbox value into order
$pane_id = $checkout_pane ['pane_id'];
$checkbox_value = $form_state ['values'] ['name_of_pane'] ['checkbox'];
$order->data [$checkout_pane ['pane_id']] = $checkbox_value;
}
Comment #2
rszrama commentedPer the issue submission guidelines, This question is better suited to Drupal Answers: https://drupal.stackexchange.com using the drupal-commerce tag. @ dishabhadra is correct, though, in that you need to be storing that value somehow on the order object.