В файле ...\components\com_jshopping\templates\default\product_default.php добавляем ссылку
<script>
var messageDelay = 2000;
jQuery( init );
function init() {
jQuery('#contactForm').hide().submit( submitForm ).addClass( 'positioned' );
jQuery('a[href="#contactForm"]').click( function() {
jQuery('#window').fadeTo( 'slow', .8 );
jQuery('#contactForm').fadeIn( 'slow', function() {
jQuery('#senderName').focus();
} )
return false;
} );
jQuery('#cancel').click( function() {
jQuery('#contactForm').fadeOut();
jQuery('#window').fadeOut();
} );
jQuery('#contactForm').keydown( function( event ) {
if ( event.which == 27 ) {
jQuery('#contactForm').fadeOut();
jQuery('#window').fadeOut();
}
} );
}
function submitForm() {
var contactForm = jQuery(this);
if ( !jQuery('#senderName').val() || !jQuery('#senderEmail').val() || !jQuery('#message').val() ) {
jQuery('#incompleteMessage').fadeIn().delay(messageDelay).fadeOut();
contactForm.fadeOut().delay(messageDelay).fadeIn();
} else {
jQuery('#sendingMessage').fadeIn();
contactForm.fadeOut();
jQuery.ajax( {
url: contactForm.attr( 'action' ) + "?ajax=true",
type: contactForm.attr( 'method' ),
data: contactForm.serialize(),
success: submitFinished
} );
}
return false;
}
function submitFinished( response ) {
response = jQuery.trim( response );
jQuery('#sendingMessage').fadeOut();
if ( response == "success" ) {
jQuery('#successMessage').fadeIn().delay(messageDelay).fadeOut();
jQuery('#senderName').val( "" );
jQuery('#senderEmail').val( "" );
jQuery('#message').val( "" );
jQuery('#window').delay(messageDelay+510).fadeOut();
} else {
jQuery('#failureMessage').fadeIn().delay(messageDelay).fadeOut();
jQuery('#contactForm').delay(messageDelay+500).fadeIn();
jQuery('#window').delay(messageDelay+510).fadeOut();
}
}
</script>
<form id="contactForm" action="/processForm.php" method="post">
<h2>Задать вопрос</h2>
<ul>
<li>
<label for="senderName">Имя</label>
<input type="text" name="senderName" id="senderName" placeholder="Введите ваше имя" required="required" maxlength="40" />
</li>
<li>
<label for="senderEmail">E-mail</label>
<input type="email" name="senderEmail" id="senderEmail" placeholder="Введите ваш e-mail адрес" required="required" maxlength="50" />
</li>
<li>
<label for="message" style="padding-top: .5em;">Ваш вопрос</label>
<textarea name="message" id="message" placeholder="Ваш вопрос" required="required" cols="80" rows="10" maxlength="10000"></textarea>
</li>
</ul>
<input name="url" style="display:none" required="required" value="<?php echo "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];?>"/>
<input name="urlName" style="display:none" required="required" value="<?php print $this->product->name?>"/>
<div id="formButtons">
<input type="submit" id="sendMessage" name="sendMessage" value="Отправить" />
<input type="button" id="cancel" name="cancel" value="Отмена" />
</div>
</form>
<div id="sendingMessage" class="statusMessage"><p>Отправка сообщения. Пожалуйста подождите...</p></div>
<div id="successMessage" class="statusMessage"><p>Спасибо за ваш вопрос! Мы свяжемся с Вами в ближайшее время.</p></div>
<div id="failureMessage" class="statusMessage"><p>Возникли неполадки. Попробуйте снова.</p></div>
<div id="incompleteMessage" class="statusMessage"><p>Пожалуйста, заполните все поля формы перед отправкой.</p></div>
<div id="sendingMessage" class="statusMessage"><p>Отправка сообщений. Пожалуйста, подождите ...</p></div>
<div id="successMessage" class="statusMessage"><p>Спасибо за отправку ваших сообщений! Мы свяжемся с Вами в ближайшее время</p></div>
<div id="failureMessage" class="statusMessage"><p>Возникла проблема с отправкой сообщения. Пожалуйста, попробуйте еще раз.</p></div>
<div id="incompleteMessage" class="statusMessage"><p>Пожалуйста, заполните все поля формы перед отправкой.</p></div>
<div id="window"></div>
#window {
width:100%;
height:100%;
position:fixed;
top:0;
left:0;
background-color:#000;
display:none;
z-index:9000;
}
/* Add curved borders to various elements */
#contactForm, .statusMessage, input[type="submit"], input[type="button"] {
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
/* Style for the contact form and status messages */
#contactForm, .statusMessage {
color: #666;
background-color: #ebedf2;
background: -webkit-gradient( linear, left bottom, left top, color-stop(0,#dfe1e5), color-stop(1, #ebedf2) );
background: -moz-linear-gradient( center bottom, #dfe1e5 0%, #ebedf2 100% );
border: 1px solid #aaa;
-moz-box-shadow: 0 0 1em rgba(0, 0, 0, .5);
-webkit-box-shadow: 0 0 1em rgba(0, 0, 0, .5);
box-shadow: 0 0 1em rgba(0, 0, 0, .5);
}
/* The form dimensions */
#contactForm {
width: 40em;
height: 33em;
padding: 0 1.5em 1.5em 1.5em;
margin: 0 auto;
width:331px;
height:350px;
padding: 0 1.5em 1.5em 1.5em;
margin: 0 auto;
z-index:9999;
}
/* Position the form in the middle of the window (if JavaScript is enabled) */
#contactForm.positioned {
position: fixed;
top:0;
bottom:0;
left:0;
right:0;
margin-top:auto;
margin-bottom:auto;
background-color:#fff;
}
/* Dimensions and position of the status messages */
.statusMessage {
display: none;
margin: auto;
width: 30em;
height: 2em;
padding: 1.5em;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.statusMessage p {
text-align: center;
margin: 0;
padding: 0;
}
/* The header at the top of the form */
#contactForm h2 {
font-size: 2em;
font-style: italic;
letter-spacing: .05em;
margin: 0 0 1em -.75em;
padding: 1em;
width: 19.5em;
color: #aeb6aa;
background: #dfe0e5 url('images/stamp.jpg') no-repeat 15em -3em; /* http://morguefile.com/archive/display/606433 */
border-bottom: 1px solid #aaa;
-moz-border-radius: 10px 10px 0 0;
-webkit-border-radius: 10px 10px 0 0;
border-radius: 10px 10px 0 0;
}
/* Give form elements consistent margin, padding and line height */
#contactForm ul {
list-style: none;
margin: 0;
padding: 0;
}
#contactForm ul li {
margin: .9em 0 0 0;
padding: 0;
}
#contactForm input, #contactForm label {
line-height: 1em;
}
/* The field labels */
label {
display: block;
float: left;
clear: left;
text-align: right;
width: 28%;
padding: .4em 0 0 0;
margin: .15em .5em 0 0;
font-weight: bold;
}
/* The fields */
input, textarea {
display: block;
margin: 0;
padding: .4em;
width: 67%;
font-family: "Georgia", serif;
font-size: 1em;
border: 1px solid #aaa;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: rgba(0,0,0,.2) 0 1px 4px inset;
-webkit-box-shadow: rgba(0,0,0,.2) 0 1px 4px inset;
box-shadow: rgba(0,0,0,.2) 0 1px 4px inset;
background: #fff;
}
textarea {
height: 13em;
line-height: 1.5em;
resize: none;
}
/* Place a border around focused fields, and hide the inner shadow */
#contactForm *:focus {
border: 1px solid #66f;
outline: none;
box-shadow: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
}
/* Display correctly filled-in fields with a green background */
input:valid, textarea:valid {
background: #dfd;
}
/* The Send and Cancel buttons */
input[type="submit"], input[type="button"] {
float: right;
margin: 2em 1em 0 1em;
width: 10em;
padding: .5em;
border: 1px solid #666;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
-moz-box-shadow: 0 0 .5em rgba(0, 0, 0, .8);
-webkit-box-shadow: 0 0 .5em rgba(0, 0, 0, .8);
box-shadow: 0 0 .5em rgba(0, 0, 0, .8);
color: #fff;
background: #0a0;
font-size: 1em;
line-height: 1em;
font-weight: bold;
opacity: .7;
-webkit-appearance: none;
-moz-transition: opacity .5s;
-webkit-transition: opacity .5s;
-o-transition: opacity .5s;
transition: opacity .5s;
}
input[type="submit"]:hover,
input[type="submit"]:active,
input[type="button"]:hover,
input[type="button"]:active {
cursor: pointer;
opacity: 1;
}
input[type="submit"]:active, input[type="button"]:active {
color: #333;
background: #eee;
-moz-box-shadow: 0 0 .5em rgba(0, 0, 0, .8) inset;
-webkit-box-shadow: 0 0 .5em rgba(0, 0, 0, .8) inset;
box-shadow: 0 0 .5em rgba(0, 0, 0, .8) inset;
}
input[type="button"] {
background: #f33;
}
/* Header/footer boxes */
.wideBox {
clear: both;
text-align: center;
margin: 70px;
padding: 10px;
background: #ebedf2;
border: 1px solid #333;
}
.wideBox h1 {
font-weight: bold;
margin: 20px;
color: #666;
font-size: 1.5em;
}
<?php
// Определение констант
define( "RECIPIENT_NAME", "John Smith" ); //Кому адресовано письмо
define( "RECIPIENT_EMAIL", "john@example.com" ); //Куда отправить письмо
define( "EMAIL_SUBJECT", "Visitor Message" ); //Тема письма
// Считывание данных из формы
$success = false;
$senderName = $_POST['senderName'];
$senderEmail = isset( $_POST['senderEmail'] )? preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['senderEmail'] ) : "";
$message = isset( $_POST['message'] )? preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message'] ) : "";
$url = $_POST['url'];
$urlName = $_POST['urlName'];
// Проверка заполнения полей
if ( $senderName && $senderEmail && $message ) {
$recipient = '=?utf-8?B?'.base64_encode(RECIPIENT_NAME).'?=' . " <" . RECIPIENT_EMAIL . ">";
$headers = "From: " . '=?utf-8?B?'.base64_encode($senderName).'?=' . " <" . $senderEmail . ">";
$subject = '=?utf-8?B?'.base64_encode(EMAIL_SUBJECT).'?=';
$message = "
На странице: $url
Задали вопрос по $urlName
Спрашивает: $senderName
E mail: $senderEmail
Вопрос: $message";
$success = mail( $recipient, $subject, $message, $headers );
}
// Возвращение ответа в браузер
if ( isset($_GET["ajax"]) ) {
echo $success ? "success" : "error";
} else {
?>
<html>
<head>
<title>Thanks!</title>
</head>
<body>
<?php if ( $success ) echo "<p>Thanks for sending your message! We'll get back to you shortly.</p>" ?>
<?php if ( !$success ) echo "<p>There was a problem sending your message. Please try again.</p>" ?>
<p>Click your browser's Back button to return to the page.</p>
</body>
</html>
<?php
}
?>
Все! ЦСС оформляем сами. Кому как нравится.