I have used the following module to add a custom checkout pane to get some additional information from the user regarding the order.
https://drupal.org/project/commerce_fieldgroup_panes
I now need to apply a condition that if the order contain a product of specific product type then display this pane else hide it.
Can some one please guide me how can I do this.
I have found the following code from https://drupal.org/node/1807092 but I don't know how to modify it according my need. Looking for some help on how to modify & use this code.
<?php function commerce_conditional_panes_commerce_checkout_pane_info_alter(&$checkout_panes, $form, &$form_state) {
global $user;
foreach($checkout_panes as $pane_name => &$pane_data) {
// load current order
$order = commerce_cart_order_load($user->uid);
// retrieve the value of controlling field
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$control = $order->field_make['und']['0']['value'];
// Perform switch to see what to do with each aircraft make
switch ($control)
{
case "value1":
break;
case "value2":
break;
case "value3":
break;
case "value4":
break;
case "value5":
break;
case "value6":
// ...we only need to override one of them
if($pane_name == 'commerce_fieldgroup_pane__conditional_pane' && $pane_data['enabled']) {
// the pane is enabled by default, so we need to disable it
$pane_data['enabled'] = 0;
}
break;
case "value6":
break;
case "value7":
break;
case "value8":
break;
default:
break;
}
}
}
?>