本文整理汇总了PHP中Mage_Core_Model_Message_Abstract::getCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Message_Abstract::getCode方法的具体用法?PHP Mage_Core_Model_Message_Abstract::getCode怎么用?PHP Mage_Core_Model_Message_Abstract::getCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Message_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Message_Abstract::getCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addMessage
public function addMessage(Mage_Core_Model_Message_Abstract $message)
{
// ensure duplicate messages are not added
$identifier = md5($message->getType() . '-' . $message->getText() . '-' . $message->getCode() . '-' . $message->getIdentifier() . '-' . (int) $message->getIsSticky());
$messages = $this->getMessages()->getItems();
foreach ($messages as $m) {
$identifier2 = md5($m->getType() . '-' . $m->getText() . '-' . $m->getCode() . '-' . $m->getIdentifier() . '-' . (int) $m->getIsSticky());
if ($identifier == $identifier2) {
return $this;
}
}
return parent::addMessage($message);
}
示例2: addMessage
/**
* Adding new message to collection
*
* @param Mage_Core_Model_Message_Abstract $message
* @return Mage_Core_Model_Message_Collection
*/
public function addMessage(Mage_Core_Model_Message_Abstract $message)
{
// Only do this for MB, not Magento standalone
if (Mage::getSingleton('magebridge/core')->getMetaData('enable_messages') == 1) {
$text = base64_encode($message->getCode());
switch ($message->getType()) {
case 'error':
header('X-MageBridge-Error: ' . $text);
break;
case 'warning':
header('X-MageBridge-Warning: ' . $text);
break;
case 'success':
case 'notice':
default:
header('X-MageBridge-Notice: ' . $text);
break;
}
}
// Perform the parent action
return parent::addMessage($message);
}