Is there a sort order for success messages?
-
16-10-2019 - |
문제
I use checkout_cart_product_add_after
event to check whether the particular product is available for the zipcode (which is already stored in customer session).
I show a notice message if it's not available using
$checkoutSession->addNotice("Sorry this product cannot be shipped to the specified PINCODE: ".$customerPincode);
I show success message when it is available
$checkoutSession->addSuccess("This product is available for the specified PINCODE: ".$customerPincode);
but my problem is this:
my custom message should come next to default success message. How can I do this?
해결책
Looking at the class Mage_Core_Model_Session_Abstract
that is the actual class providing this functionality to all of the other 'sessions' you can see in the addMessage
method for example it only accepts a single argument called $message
.
This argument is pushed into a Varien Object which acts as a simple array (with some added functions). This means that whoever pushes their message first will be displayed first.