The problem I have is that it seems that I can use global variable created inside another module, only if I use it inside callback function. I successfully tested it by inserting code inside existing modules.
The global variable is $subtotal.
function uc_checkout_pane_simple_quote($op, &$arg1, $arg2) { global $subtotal; drupal_set_message($subtotal); function uc_webform_pane_checkout_pane_callback($nid, $op, &$arg1, $arg2) { global $subtotal; drupal_set_message($subtotal); }
In both cases the message shows the correct value.
However, inside other functions it is does not work.
function uc_webform_pane_checkout_pane_alter(&$panes) { global $subtotal; drupal_set_message($subtotal); } function uc_cartdetails_checkout_pane_alter(&$panes) { global $user; global $subtotal; drupal_set_message($subtotal); }
What am I missing here?
What I am trrying to do: to show or hide checkout pane based on $subtotal value.
function uc_cartdetails_checkout_pane_alter(&$panes) { global $subtotal; foreach ($panes as &$pane) { if (($pane['id'] == 'webform_nid780') && ((40 - $subtotal) > 0) ) { $pane['enabled'] = FALSE; } } }