По сути вторая форма обратной связи с отсылкой на почту админа.
Сейчас выкину листинг
product.php
$this->data['tab_question'] = $this->language->get('tab_question');
$this->data['text_ask'] = $this->language->get('text_ask');
$this->data['entry_name_ask'] = $this->language->get('entry_name_ask');
$this->data['entry_email_ask'] = $this->language->get('entry_email_ask');
$this->data['entry_phone_ask'] = $this->language->get('entry_phone_ask');
$this->data['error_phone_ask'] = $this->language->get('error_phone_ask');
$this->data['entry_question_ask'] = $this->language->get('entry_question_ask');
public function write1() {
$this->language->load('product/product');
$this->load->model('catalog/askquestion');
$json = array();
if ((utf8_strlen($this->request->post['name1']) < 3) || (utf8_strlen($this->request->post['name1']) > 25)) {
$json['error'] = $this->language->get('error_name_ask');
}
if ((utf8_strlen($this->request->post['phone']) < 6)) {
$json['error'] = $this->language->get('error_phone_ask');
}
if ((utf8_strlen($this->request->post['email']) < 6) || (utf8_strlen($this->request->post['email']) > 35)) {
$json['error'] = $this->language->get('error_email_ask');
}
if ((utf8_strlen($this->request->post['text1']) < 15) || (utf8_strlen($this->request->post['text1']) > 1000)) {
$json['error'] = $this->language->get('error_text_ask');
}
if (!isset($this->session->data['captcha1']) || ($this->session->data['captcha1'] != $this->request->post['captcha1'])) {
$json['error'] = $this->language->get('error_captcha_ask');
}
if (($this->request->server['REQUEST_METHOD'] == 'POST') && !isset($json['error'])) {
$this->model_catalog_askquestion->addAskquestion($this->request->get['product_id'], $this->request->post);
$json['success'] = $this->language->get('text_success_ask');
}
$this->response->setOutput(json_encode($json));
}
public function captcha1() {
$this->load->library('captcha1');
$captcha1 = new Captcha1();
$this->session->data['captcha1'] = $captcha1->getCode();
$captcha1->showImage();
}
public function captcha() {
$this->load->library('captcha');
$captcha = new Captcha();
$this->session->data['captcha'] = $captcha->getCode();
$captcha->showImage();
}
public function upload() {
$this->language->load('product/product');
$json = array();
if (!empty($this->request->files['file']['name'])) {
$filename = basename(preg_replace('/[^a-zA-Z0-9\.\-\s+]/', '', html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8')));
if ((strlen($filename) < 3) || (strlen($filename) > 64)) {
$json['error'] = $this->language->get('error_filename');
}
$allowed = array();
$filetypes = explode(',', $this->config->get('config_upload_allowed'));
foreach ($filetypes as $filetype) {
$allowed[] = trim($filetype);
}
if (!in_array(substr(strrchr($filename, '.'), 1), $allowed)) {
$json['error'] = $this->language->get('error_filetype');
}
if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
$json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']);
}
} else {
$json['error'] = $this->language->get('error_upload');
product.tpl
<div id="tab-askquestion" class="tab-content" style="border: 1px solid #000;">
<div id="askquestion"></div>
<h2 id="askquestion-title" style="text-transform:none;"><?php echo $text_ask; ?> <?php echo $model; ?> </h2>
<br />
<img src="./image/name.png" align="absmiddle" /> <b><?php echo $entry_name_ask; ?></b><br />
<input type="text" name="name1" value="" />
<br />
<br />
<img src="./image/phone.png" align="absmiddle" /> <b><?php echo $entry_phone_ask; ?></b><br />
<input type="text" name="phone" value="" />
<br />
<br />
<img src="./image/email.png" align="absmiddle" /> <b><?php echo $entry_email_ask; ?></b><br />
<input type="text" name="email" value="" />
<br />
<br />
<img src="./image/question.png" align="absmiddle" /> <b><?php echo $entry_question_ask; ?></b>
<textarea name="text1" cols="40" rows="8" style="width: 98%;"></textarea>
<br />
<br />
<b><?php echo $entry_captcha; ?></b><br />
<input type="text" name="captcha1" value="" />
<br />
<img src="index.php?route=product/product/captcha1" alt="" id="captcha1" /><br />
<br />
<div class="buttons">
<div class="right"><a id="button-askquestion" class="button"><span><?php echo $button_continue; ?></span></a></div>
</div>
</div>
<script type="text/javascript">
$('#button-askquestion').bind('click', function() {
$.ajax({
type: 'POST',
url: 'index.php?route=product/product/write1&product_id=<?php echo $product_id; ?>',
dataType: 'json',
data: 'name1=' + encodeURIComponent($('input[name=\'name1\']').val()) + '&email=' + encodeURIComponent($('input[name=\'email\']').val()) + '&phone=' + encodeURIComponent($('input[name=\'phone\']').val()) + '&text1=' + encodeURIComponent($('textarea[name=\'text1\']').val()) + '&captcha1=' + encodeURIComponent($('input[name=\'captcha1\']').val()),
beforeSend: function() {
$('.success, .warning').remove();
$('#button-askquestion').attr('disabled', true);
$('#askquestion-title').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
},
complete: function() {
$('#button-askquestion').attr('disabled', false);
$('.attention').remove();
},
success: function(data) {
if (data.error) {
$('#askquestion-title').after('<div class="warning">' + data.error + '</div>');
}
if (data.success) {
$('#askquestion-title').after('<div class="success">' + data.success + '</div>');
$('input[name=\'name1\']').val('');
$('input[name=\'email\']').val('');
$('input[name=\'phone\']').val('');
$('textarea[name=\'text1\']').val('');
$('input[name=\'captcha1\']').val('');
}
}
});
});
</script>
В файле на который ссылается контроллер, сейчас следующее
ask_question.php
<?php
class ModelCatalogAskquestion extends Model {
public function addAskquestion($product_id, $data) {
$this->load->model('catalog/product');
$product_info = $this->model_catalog_product->getProduct($product_id);
$message ='<b>Product:</b> <a href="'.($this->url->link('product/product', '&product_id=' . $this->request->get['product_id'])).'">'.(strip_tags($product_info['name'])).'</a><br />';
$message.='<b>Name:</b> '.(strip_tags($data['name1'])).'<br />';
$message.='<b>Email:</b> '.(strip_tags($data['email'])).'<br /><br />';
$message.='<b>Question:</b> <br />';
$message.=(strip_tags($data['text1']))."<br /><br />";
$mail = new Mail($this->config->get('config_mail_protocol'),
$this->config->get('config_smtp_host'),
$this->config->get('config_smtp_username'),
html_entity_decode($this->config->get('config_smtp_password')),
$this->config->get('config_smtp_port'),
$this->config->get('config_smtp_timeout'));
$mail->setTo(array($this->config->get('config_email')));
$mail->setFrom(strip_tags($data['email']));
$mail->setSender(strip_tags($data['name1']));
$mail->setSender(strip_tags($data['phone']));
$mail->setSubject((strip_tags($data['name1'])). ' wants to ask you something about ' .(strip_tags($product_info['name'])));
$mail->setHtml($message);
$mail->send();
}
}
?>
Где еще можно порыть поискать причину.