Magento 訊息提示

2022-06-23 22:15:16 字數 1362 閱讀 6504

magento 訊息提示

//成功

mage::getsingleton('customer/session')->addsuccess('恭喜您關聯會員卡成功!');

//失敗

mage::getsingleton('customer/session')->adderror($e->getmessage());

錯誤處理

if($this->getrequest()->ispost())catch (exception $e){

mage::getsingleton('customer/session')->adderror($e->getmessage());//2新增錯誤

$this->loadlayout();

$this->_initlayoutmessages('customer/session'); //3.回顯錯誤

$this->renderlayout();

phtml中新增

<?php echo $this->getmessagesblock()->getgroupedhtml(); ?>

原文:--------------------

----------

----------

----------

magento 成功 錯誤 警告 提示的使用方法

控制器裡面新增下面** 加頁面提示

mage::getsingleton('customer/session')->addsuccess($this->__('this email does not require confirmation.'));

這個是綠色的提示

mage::getsingleton('customer/session')->adderror($this->__('login and password are required.'));

這個是紅色的提示

mage::getsingleton('customer/session')->addnotice($this->__('please specify product option(s).'));

這個是黃色的提示

phtml裡面必須新增下面** 才可以show頁面提示

<?php echo $this->getmessagesblock()->getgroupedhtml() ?>

<?php echo $this->getmessagesblock()->tohtml() ?>

控制器裡面必須新增下面**

$this->_initlayoutmessages('customer/session');

使用其他session ,如 check/session 等,請參考上面方式 舉一反三

原文:

magento 訊息機制

1 寫訊息 mage getsingleton checkout session addsuccess mage getsingleton customer session addsuccess mage getsingleton checkout session adderror this cou...

AJAX訊息提示 Alert

在ajax中使用以前的指令碼註冊無支使用alert response.write,page.registerstartupscript都可以執行,但在ajax中無法使用.綜合考慮可能的因素由於使用的是ajax,非同步機制,使用以前的指令碼可能會擾亂asp.net ajax框架 scriptmanag...

jquery poshytip訊息提示外掛程式使用

poshy tip是一款非常友好的資訊提示工具了,如我們通常在做表單驗證時會用到這個功能,這樣可以告訴使用者我們是要如何填寫或者什麼東西填寫錯誤了,下面來看看這個poshytip使用。使用步驟 注意 資料夾中包含所有樣式,只需引自己需要的樣式,此處引用的是tip yellow.css。poshyti...