http://azharkamar.com/5378/magento-modifying-default-message-alert-box-popup-dialog/
Demo of Magento’s Default Messages Box
For those who wanna see how the default notification box looks like in Magento, follow these instructions:- Go to https://demo.magentocommerce.com/customer/account/login.
- Fill up some bogus text into the Email Address and Password field under the Registered Customers box (e.g. aaa@aaa.com, 123456)
- Click the Login button at the bottom right.
- When the page has reloaded, you will notice a red box at the top with the error message Invalid login or password.
Edit Your Theme’s Stylesheet
- Navigate to your theme’s main stylesheet –
/www/skin/frontend/default/your-theme/css/styles.css
- Add these codes at the bottom of the stylesheet:
#messages {
margin
:
100px
0
0
280px
;
position
:
absolute
;
text-align
:
center
;
width
:
360px
;
z-index
:
99
;
}
.msgclose {
color
:
#DF280A
;
float
:
right
;
font-family
: Comic Sans MS;
font-size
:
14px
;
font-weight
:
bold
;
margin
:
0
8px
;
text-decoration
:
none
;
}
Now look for the
.error-msg, .success-msg, .note-msg, .notice-msg
CSS selector and add this property to it:
padding
:
40px
;
Edit Messages.php
- Locate the Messages.php file here
/www/cuppakiddo/app/code/core/Mage/Core/Block/Messages.php
- Look for this line (use Ctrl+f in Dreamweaver):
$html
.=
'<'
.
$this
->_messagesSecondLevelTagName .
' class="'
.
$type
.
'-msg">'
;
And add this code above it:
$html
.=
'<a class="msgclose" href="#" onclick="document.getElementById('
messages
')
What this piece of code does is simply display a close button (an ‘x’) and assign an
onclick
action to it that will close the notification box.
Now look for:
$html
.=
'<'
.
$this
->_messagesFirstLevelTagName .
' class="messages">'
;
And replace it with:
$html
.=
'<'
.
$this
->_messagesFirstLevelTagName .
' id="messages">'
;
No comments:
Post a Comment