From 56e75d0e9a6451a7f3ddc3d8794fce8dabcd6844 Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Wed, 26 Jun 2013 18:01:26 +0200 Subject: [PATCH] [-] CORE : fixed bug #PSCFV-8745 Contact form e-mail template with incomplete information --- controllers/front/ContactController.php | 10 ++++++++++ mails/en/contact_form.html | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index 8098ad0ee..f32311554 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -170,6 +170,7 @@ class ContactControllerCore extends FrontController '{attached_file}' => '-', '{message}' => Tools::nl2br(stripslashes($message)), '{email}' => $from, + '{product_name}' => '', ); if (isset($filename)) @@ -177,6 +178,8 @@ class ContactControllerCore extends FrontController $id_order = (int)Tools::getValue('id_order'); + $id_product = (int)Tools::getValue('id_product'); + if (isset($ct) && Validate::isLoadedObject($ct)) { if ($ct->id_order) @@ -193,6 +196,13 @@ class ContactControllerCore extends FrontController $var_list['{id_order}'] = $id_order; } + if ($id_product) + { + $product = new Product((int)$id_product); + if (Validate::isLoadedObject($product) && isset($product->name[Context::getContext()->language->id])) + $var_list['{product_name}'] = $product->name[Context::getContext()->language->id]; + } + if (empty($contact->email)) Mail::Send($this->context->language->id, 'contact_form', $subject, $var_list, $from, null, null, null, $fileAttachment); else diff --git a/mails/en/contact_form.html b/mails/en/contact_form.html index 67ee471ca..e7c9018b2 100644 --- a/mails/en/contact_form.html +++ b/mails/en/contact_form.html @@ -20,7 +20,7 @@   -Your message has been sent successfully.

Message: {message}

Order ID : {order_name}

Attached file : {attached_file} +Your message has been sent successfully.

Message: {message}

Order ID : {order_name}

Product : {product_name}

Attached file : {attached_file}