<?php
$url
= Mage::getBaseUrl().
'requestfrm'
;
if
(isset(
$_POST
) && !
empty
(
$_POST
[
'request_flag'
])):
$params
=
$this
->getRequest()->getParams();
$message
=
''
;
if
(!
empty
(
$params
)):
$message
= "
<html>
<head>
<title>Customer details</title>
</head>
<body>
<table border=
'0'
cellpadding=
'4'
cellspacing=
'0'
width=
'90%'
>
<tbody>
<tr>
<td align=
'center'
colspan=
'2'
height=
'30'
>Customer Details</td>
</tr>
<tr>
<td align=
'right'
width=
'40%'
><b>Name:</b></td>
<td width=
'55%'
>
".$params['name']."
</td>
</tr>
<tr>
<td align=
'right'
width=
'40%'
><b>Email Address:</b></td>
<td width=
'55%'
>
".$params['email']."
</td>
</tr>
<tr>
<td align=
'right'
width=
'40%'
><b>Phone Number:</b></td>
<td width=
'55%'
>
".$params['phone']."
</td>
</tr>
<tr>
<td align=
'right'
width=
'40%'
><b>Comments:</b></td>
<td width=
'55%'
>
".$params['comment']."
</td>
</tr>
</tbody>
</body>
</html>";
endif
;
$to
= Mage::getStoreConfig(
'contacts/email/recipient_email'
);
$dt
=
date
(
'd-m-Y'
);
$subject
=
"Customer details submitted on date $dt"
;
$mail
=
new
Zend_Mail();
$mail
->setBodyHtml(
$message
);
$mail
->setFrom(
$params
[
'email'
],
$params
[
'name'
]);
$mail
->addTo(
$to
,
'Site Admin'
);
$mail
->setSubject(
$subject
);
try
{
if
(
$mail
->send())
{
Mage::getSingleton(
'core/session'
)->addSuccess(
'Mail sent successfully. We will contact you shortly'
);
}
}
catch
(Exception
$ex
) {
Mage::getSingleton(
'core/session'
)->addError(
'Unable to send email.'
);
}
endif
;
?>
<div align=
"left"
>
<div>
<form action=
"<?php echo $url ?>"
id=
"requestForm"
method=
"post"
>
<div>
<div>
<div>
<h3
class
=
"txt-blue"
><?php
echo
Mage::helper(
'contacts'
)->__(
'Information'
) ?></h3>
</div>
<ul
class
=
"form-list"
>
<li>
<label
class
=
"required"
><?php
echo
$this
->__(
'Name'
) ?> <font color=
"red"
>*</font></label>
<div
class
=
"input-box"
>
<input name=
"name"
id=
"name"
title=
"name"
value=
""
class
=
"small required-entry"
type=
"text"
/>
</div>
</li>
<li>
<label
class
=
"required"
><?php
echo
$this
->__(
'Email Address'
) ?> <font color=
"red"
>*</font></label>
<div
class
=
"input-box"
>
<input name=
"email"
id=
"email"
title=
"email"
value=
""
class
=
"small required-entry validate-email"
type=
"text"
/>
</div>
</li>
<li>
<label><?php
echo
$this
->__(
'Phone Number'
) ?></label>
<div
class
=
"input-box"
>
<input name=
"phone"
id=
"phone"
title=
"phone"
value=
""
type=
"text"
/>
</div>
</li>
<li>
<label
for
=
"comment"
><?php
echo
$this
->__(
'Comment'
) ?></label>
<div
class
=
"input-box"
>
<textarea name=
"comment"
id=
"comment"
title=
""
cols=
"5"
rows=
"3"
></textarea>
</div>
</li>
</ul>
</div>
</div>
<div style=
"margin:0"
>
<p style=
"padding-right:10px;"
><?php
echo
$this
->__(
"<font color='red'>*</font> Required Fields"
) ?></p>
<div style=
"padding-right:10px;"
><button type=
"submit"
title=
"<?php echo $this->__('Submit') ?>"
><span><?php
echo
$this
->__(
'Submit'
) ?></span></button></div>
</div>
<input type=
"hidden"
name=
"request_flag"
value=
"1"
/>
</form>
<script type=
"text/javascript"
>
var
contactForm =
new
VarienForm(
'requestForm'
, true);
</script>
</div>
</div>