Hi,
thank you for this very elegant module :-)
Better Messages is working fine with all normal messages. But I tested it with a Commerce Kickstart install inluding the "Commerce add to cart confirmation" module.
When I add a product to cart, the two modules cause a display problem with two nested popups.
Is there a way to disable Better Messages only for this type of message?

Thanks for your answers!

William Aubert

Comments

ruhaim’s picture

Issue summary: View changes

This is a fix that should come from "Commerce add to cart confirmation" module, reported at https://www.drupal.org/node/2210401
Until it's dependency is removed with the drupal_set_message() function here is a blog post i found which has a temporary hack
-
http://julian.pustkuchen.com/en/drupal-7-commerce-howto-get-commerceaddt...

---

Add the following preprocess function to your theme and rename it accordingly:

function MYTHEMENAME_preprocess_page(&$vars) {
  if (isset($_SESSION['messages']['commerce-add-to-cart-confirmation'])) {
    $add_to_cart_messages = $_SESSION['messages']['commerce-add-to-cart-confirmation'];
    $markup = '';
    if (!empty($add_to_cart_messages)) {
      foreach ($add_to_cart_messages as $add_to_cart_message) {
        $markup .= $add_to_cart_message;
      }
    }
    $vars['commerce_add_to_cart_confirmation_messages'] = array(
      '#type' => 'container',
      '#attributes' => array('class' => array('messages my-commerce-add-to-cart-confirmation-messages commerce-add-to-cart-confirmation')),
      'content' => array(
        '#type' => 'markup',
        '#markup' => $markup)
    );
    unset($_SESSION['messages']['commerce-add-to-cart-confirmation']);
  }
  else {
    $vars['commerce_add_to_cart_confirmation_messages'] = NULL;
  }
}

Then add the following snippet to where the add to cart confirmation should be output in the template code (page.tpl.php)

if (!empty($commerce_add_to_cart_confirmation_messages)) {
  print render($commerce_add_to_cart_confirmation_messages);
}

Eventually you will have to modify one or two lines of your css selectors, if it doesn't work ad hoc.