The commerce_add_to_cart_confirmation.module uses the drupal_set_message() mechanism to display the add to cart layer after a product has been added to the cart.
This is being triggered via a rules.module rule, provided by the module.
The problem is, that this may create a conflict with other modules, like for example the absolut_messages.module. Furthermore it is a handy **hack** for the commerce_add_to_cart_confirmation.module but you may see it as a flaw.
As a concrete problem I had to solve the conflict with absolut_messages.module as described above and I'd like to share my solution with you, if you should run into similar problems.
What I've done is created a theme hook function in HOOK_preprocess_page($vars) and added a little snippet to the page.tpl.php where to render the add to cart confirmation message into.
Have fun using the following snippets on your own risk:
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.
Please leave a comment, if this was useful for you or if you have any suggestions for a better solutions.