function commerce_coupon_ajax_render_alter in Commerce Coupon 7
Implements hook_ajax_render_alter().
This is to get the summary of the cart to rerender on the add coupon button.
File
- includes/
commerce_coupon.checkout_pane.inc, line 161 - Coupon checkout panes.
Code
function commerce_coupon_ajax_render_alter(&$commands) {
$alter_coupon_commands =& drupal_static('alter_coupon_commands');
$coupon_current_order =& drupal_static('coupon_current_order');
if ($alter_coupon_commands) {
list($view_id, $display_id) = explode('|', variable_get('commerce_cart_contents_pane_view', 'commerce_cart_summary|default'));
$contents = array();
$contents['cart_contents_view'] = array(
'#markup' => commerce_embed_view($view_id, $display_id, array(
$coupon_current_order,
)),
);
$contents = drupal_render($contents);
$commands[] = ajax_command_replace('.view-id-' . $view_id, $contents);
}
}