I am trying to access Magento's current session's messages (ones written by addError).
I am doing this from inside of the Cart model.
$smessages = Mage::getSingleton('checkout/session')->getMessages(true);
Returns an array of all messages correctly.
However, when I try to "foreach" through $smessages, I get nothing. The idea is to then use getText() within the loop to get each individual message.
foreach ($smessages as $smessage) {
Mage::log($sme开发者_运维知识库ssage);
}
What am I doing wrong?
I figured it out!
$smessages = Mage::getSingleton('checkout/session')->getMessages()->getItems();
$output = NULL;
foreach ($smessages as $smessage) {
$output .= $smessage->getText();
}
精彩评论