witajcie,
czy jest mozliwosc, aby otrzymywac maila po tym jak klient zostawi opinie o produkcie? (oczywiscie opinia musi byc zaakceprowana, tak jak to jest do tej pory)
public function getLastReview(){
$query = $this->db->query("SELECT review_id FROM ".DB_PREFIX."review WHERE customer_id = '".$this->customer->getId()."' ORDER BY `review_id` DESC LIMIT 1");
return $query->row['review_id'];
}
$this->language->load('mail/new_review');
$customer_name = html_entity_decode($this->request->post['name'], ENT_QUOTES, 'UTF-8');
$subject = "[".$this->config->get('config_name')."] ".sprintf($this->language->get('text_subject'), $customer_name);
$review = html_entity_decode($this->request->post['text'], ENT_QUOTES, 'UTF-8');
$review_id = $this->model_catalog_review->getLastReview();
$template = new Template();
$template->data['title'] = $subject;
$template->data['text_new_review'] = $this->language->get('text_new_review');
$template->data['text_from'] = sprintf($this->language->get('text_from'), html_entity_decode($customer_name, ENT_QUOTES, 'UTF-8'));
$template->data['text_review'] = $this->language->get('text_review');
$template->data['review'] = $review;
$template->data['text_approve'] = $this->language->get('text_approve');
$template->data['text_approve_link'] = $this->language->get('text_approve_link');
$template->data['store_url'] = $this->config->get('config_url');
$template->data['store_name'] = $this->config->get('config_name');
$template->data['approve_url'] = HTTP_SERVER. 'admin/index.php?route=catalog/review/update&review_id='.$review_id;
$template->data['image'] = HTTP_SERVER."image/".$this->config->get('config_logo');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/new_review.tpl')) {
$html = $template->fetch($this->config->get('config_template') . '/template/mail/new_review.tpl');
} else {
$html = $template->fetch('default/template/mail/new_review.tpl');
}
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
$mail->setHtml($html);
$mail->addAttachment(DIR_IMAGE . $this->config->get('config_logo'));
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($this->config->get('config_name'));
$mail->send();
Powrót do Pomoc techniczna przy Opencart
Użytkownicy przeglądający ten dział: Brak zidentyfikowanych użytkowników i 2 gości