I have created an observer (a model) which changes the prices during checkout in some special cases. Therefore I also have to tell this the customer somehow.
I think a javascript alert should be the easiest solution for this. But I could not find out how to create a js alert out of a model.
The main purpose of model classes in an MVC architecture is to handle logic and not worry about user interaction/interface. Given that, your scenario would be best handled by setting some messages in your Observer model and displaying these messages on your UI at the top.
$session = Mage::getSingleton('checkout/session'); // You can create any type of message, like notice $session->addNotice(Mage::helper('youcustommodule')->__('Some Text')); // Warning $session->addWarning(Mage::helper('youcustommodule')->__('Some Text')); // Error $session->addError(Mage::helper('youcustommodule')->__('Some Text'));
It should works on shopping cart and multi-shipping checkout pages (message will be display at the top), but it’s easy to customize for displaying on one-page checkout too.