diff --git a/admin/themes/default/sass/controllers/_customer-thread.sass b/admin/themes/default/sass/controllers/_customer-thread.sass index a0b8e1d65..bb2b15df4 100644 --- a/admin/themes/default/sass/controllers/_customer-thread.sass +++ b/admin/themes/default/sass/controllers/_customer-thread.sass @@ -48,17 +48,6 @@ @include left(1px) @include box-shadow(white 0 0 0 3px inset) -.submitReply - i[class^="icon-"] - display: block - width: 30px - height: 30px - margin: 0 auto - font-size: 28px - background: transparent - background-size: 26px - background-position: center - .table.customer_thread, #MeaningStatus .text-success color: #56CE56 diff --git a/admin/themes/default/sass/partials/_icons.sass b/admin/themes/default/sass/partials/_icons.sass index 2f3aa08e3..4c6454e8c 100644 --- a/admin/themes/default/sass/partials/_icons.sass +++ b/admin/themes/default/sass/partials/_icons.sass @@ -443,3 +443,9 @@ @extend .icon-toggle-on .process-icon-toggle-off @extend .icon-toggle-off + .process-icon-reply-all + @extend .icon-reply-all + .process-icon-mail-reply + @extend .icon-mail-reply + .process-icon-lock + @extend .icon-lock diff --git a/admin/themes/default/template/controllers/customer_threads/helpers/list/list_header.tpl b/admin/themes/default/template/controllers/customer_threads/helpers/list/list_header.tpl index 4b0ded7a7..de58eaab0 100644 --- a/admin/themes/default/template/controllers/customer_threads/helpers/list/list_header.tpl +++ b/admin/themes/default/template/controllers/customer_threads/helpers/list/list_header.tpl @@ -39,7 +39,7 @@ {assign var=id_customer_thread value=$tmp2.id_customer_thread} {/if} {/foreach} -
+
{$val.name} @@ -58,7 +58,7 @@
{/foreach} -
+
{l s='Meaning of status'} @@ -71,19 +71,5 @@
-
-
-
- {l s='Statistics'} -
-
    - {assign var=count value=0} - {foreach $stats as $key => $stat} - {assign var=count value=$count+1} -
  • {$stat.title} {$stat.val}
  • - {/foreach} -
-
-
{/block} diff --git a/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl b/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl index 6cb1f5885..b42bea915 100644 --- a/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl @@ -30,6 +30,11 @@
{l s="Thread"}: #{$id_customer_thread|intval} + {if isset($thread->id_customer) && $thread->id_customer} + + {$customer->firstname} {$customer->lastname}({$customer->email|escape:'html':'UTF-8'}) + + {/if}
@@ -45,24 +50,25 @@
- +
- {if isset($customer->firstname)} + {if isset($thread->user_name) && trim($thread->user_name)}

- - {$customer->firstname|escape:'html':'UTF-8'} {$customer->lastname|escape:'html':'UTF-8'} ({$customer->email|escape:'html':'UTF-8'}) - + {$thread->user_name|escape:'html':'UTF-8'} ({$thread->email|escape:'html':'UTF-8'})

{else}

{$thread->email|escape:'html':'UTF-8'}

{/if} + {if isset($thread->phone) && trim($thread->phone) != ''} +

{l s='Phone:'} {$thread->phone|escape:'html':'UTF-8'}

+ {/if} {if isset($contact) && trim($contact) != ''} - {l s="To:"} {$contact|escape:'html':'UTF-8'} + {l s='To:'} {$contact|escape:'html':'UTF-8'} {/if}
- {if isset($customer->firstname)} + {if isset($customer->email) && $customer->email == $thread->email}

{if $count_ok} @@ -111,9 +117,9 @@ {l s="Choose a template"} --> - - - + + +

diff --git a/admin/themes/default/template/controllers/customer_threads/page_header_toolbar.tpl b/admin/themes/default/template/controllers/customer_threads/page_header_toolbar.tpl new file mode 100644 index 000000000..9378f1eaf --- /dev/null +++ b/admin/themes/default/template/controllers/customer_threads/page_header_toolbar.tpl @@ -0,0 +1,39 @@ +{** + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License version 3.0 + * that is bundled with this package in the file LICENSE.md + * It is also available through the world-wide-web at this URL: + * https://opensource.org/license/osl-3-0-php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to support@qloapps.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this module to a newer + * versions in the future. If you wish to customize this module for your needs + * please refer to https://store.webkul.com/customisation-guidelines for more information. + * + * @author Webkul IN + * @copyright Since 2010 Webkul + * @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*} + +{extends file="page_header_toolbar.tpl"} + +{block name=pageTitle} + {if isset($display) && $display == 'view'} +

+ {if is_array($title)} + {$title|end|strip_tags} + {else} + + {$title|strip_tags|truncate:40} + + {/if} +

+ {else} + {$smarty.block.parent} + {/if} +{/block} \ No newline at end of file diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index 4c5692832..9a0b9f397 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -199,15 +199,16 @@ class AdminCustomerThreadsControllerCore extends AdminController $this->fields_options = array( 'contact' => array( - 'title' => $this->l('Contact options'), - 'fields' => array( - 'PS_CUSTOMER_SERVICE_FILE_UPLOAD' => array( - 'title' => $this->l('Allow file uploading'), - 'hint' => $this->l('Allow customers to upload files using the contact page.'), - 'type' => 'bool' + 'title' => $this->l('Contact options'), + 'fields' => array( + 'PS_CUSTOMER_SERVICE_SIGNATURE' => array( + 'title' => $this->l('Default message'), + 'hint' => $this->l('Please fill out the message fields that appear by default when you answer a thread on the customer service page.'), + 'type' => 'textareaLang', + 'lang' => true ), - 'PS_MAIL_EMAIL_MESSAGE' => array( - 'title' => $this->l('Send email to'), + 'PS_MAIL_EMAIL_MESSAGE' => array( + 'title' => $this->l('Send messages from order page to'), 'desc' => $this->l('Where customers send messages from the order page.'), 'validation' => 'isUnsignedId', 'type' => 'select', @@ -215,13 +216,13 @@ class AdminCustomerThreadsControllerCore extends AdminController 'identifier' => 'email_message', 'list' => $arr ), - 'PS_CUSTOMER_SERVICE_CONTACT_ALLOW' => array( - 'title' => $this->l('Allow guest to select contact'), - 'hint' => $this->l('Allow guest to select the contact while submitting message from the contact page.'), + 'PS_CUSTOMER_SERVICE_DISPLAY_CONTACT' => array( + 'title' => $this->l('Select contact on contact page'), + 'hint' => $this->l('Allow guest to select the contact while sending message from the contact page.'), 'type' => 'bool' ), - 'PS_CUSTOMER_SERVICE_EMAIL_MESSAGE' => array( - 'title' => $this->l('Send email to'), + 'PS_CUSTOMER_SERVICE_CONTACT' => array( + 'title' => $this->l('Send messages from contact page to'), 'desc' => $this->l('Where customers send messages from the Contact page.'), 'validation' => 'isUnsignedId', 'type' => 'select', @@ -229,32 +230,31 @@ class AdminCustomerThreadsControllerCore extends AdminController 'identifier' => 'email_message', 'list' => $arr ), - 'PS_CUSTOMER_SERVICE_NAME_REQUIRED' => array( - 'title' => $this->l('Set Name as required'), - 'hint' => $this->l('Set Name as required while submitting message from the contact page.'), - 'type' => 'bool' - ), - 'PS_CUSTOMER_SERVICE_NAME_DISPLAY' => array( - 'title' => $this->l('Display Name field'), + 'PS_CUSTOMER_SERVICE_DISPLAY_NAME' => array( + 'title' => $this->l('Display name on contact page'), 'hint' => $this->l('Display name field on contact page.'), 'type' => 'bool', ), - 'PS_CUSTOMER_SERVICE_PHONE_REQUIRED' => array( - 'title' => $this->l('Set Phone as required'), - 'hint' => $this->l('Set Phone as required while submitting message from the contact page.'), + 'PS_CUSTOMER_SERVICE_REQUIRED_NAME' => array( + 'title' => $this->l('Set name as required'), + 'hint' => $this->l('Set name as required while submitting message from the contact page.'), 'type' => 'bool' ), - 'PS_CUSTOMER_SERVICE_PHONE_DISPLAY' => array( - 'title' => $this->l('Display Phone field'), + 'PS_CUSTOMER_SERVICE_DISPLAY_PHONE' => array( + 'title' => $this->l('Display phone on contact page'), 'hint' => $this->l('Display phone field on contact page.'), 'type' => 'bool', ), - 'PS_CUSTOMER_SERVICE_SIGNATURE' => array( - 'title' => $this->l('Default message'), - 'hint' => $this->l('Please fill out the message fields that appear by default when you answer a thread on the customer service page.'), - 'type' => 'textareaLang', - 'lang' => true - ) + 'PS_CUSTOMER_SERVICE_REQUIRED_PHONE' => array( + 'title' => $this->l('Set phone as required'), + 'hint' => $this->l('Set phone as required while submitting message from the contact page.'), + 'type' => 'bool' + ), + 'PS_CUSTOMER_SERVICE_FILE_UPLOAD' => array( + 'title' => $this->l('Allow file uploading'), + 'hint' => $this->l('Allow customers to upload files using the contact page.'), + 'type' => 'bool' + ), ), 'submit' => array( 'title' => $this->l('Save'), @@ -394,45 +394,10 @@ class AdminCustomerThreadsControllerCore extends AdminController $this->_orderWay = 'DESC'; $contacts = CustomerThread::getContacts(); - $categories = Contact::getCategoriesContacts(); - - $stats = array( - array( - 'title' => $this->l('Total threads'), - 'val' => $all = CustomerThread::getTotalCustomerThreads(), - ), - array( - 'title' => $this->l('Threads pending'), - 'val' => $pending = CustomerThread::getTotalCustomerThreads( - 'status='.CustomerThread::QLO_CUSTOMER_THREAD_STATUS_PENDING1.' - OR status='.CustomerThread::QLO_CUSTOMER_THREAD_STATUS_PENDING2 - ), - ), - array( - 'title' => $this->l('Total number of customer messages'), - 'val' => CustomerMessage::getTotalCustomerMessages('cm.`id_employee` = 0'), - ), - array( - 'title' => $this->l('Total number of employee messages'), - 'val' => CustomerMessage::getTotalCustomerMessages('cm.`id_employee` != 0'), - ), - array( - 'title' => $this->l('Unread threads'), - 'val' => $unread = CustomerThread::getTotalCustomerThreads( - 'status='.CustomerThread::QLO_CUSTOMER_THREAD_STATUS_OPEN - ), - ), - array( - 'title' => $this->l('Closed threads'), - 'val' => $all - ($unread + $pending), - ), - ); - $this->tpl_list_vars = array( 'contacts' => $contacts, 'categories' => $categories, - 'stats' => $stats ); return parent::renderList(); @@ -457,12 +422,12 @@ class AdminCustomerThreadsControllerCore extends AdminController if (Tools::isSubmit('submitOptionsCustomerService')) { unset($this->fields_options['general']); $this->processUpdateOptions(); - if (Tools::getValue('PS_CUSTOMER_SERVICE_NAME_REQUIRED')) { - Configuration::updateValue('PS_CUSTOMER_SERVICE_NAME_DISPLAY', 1); + if (!Tools::getValue('PS_CUSTOMER_SERVICE_DISPLAY_NAME')) { + Configuration::updateValue('PS_CUSTOMER_SERVICE_REQUIRED_NAME', 0); } - if (Tools::getValue('PS_CUSTOMER_SERVICE_PHONE_REQUIRED')) { - Configuration::updateValue('PS_CUSTOMER_SERVICE_PHONE_DISPLAY', 1); + if (!Tools::getValue('PS_CUSTOMER_SERVICE_DISPLAY_PHONE')) { + Configuration::updateValue('PS_CUSTOMER_SERVICE_REQUIRED_PHONE', 0); } } else if (Tools::isSubmit('submitOptionsIMAPConfig')) { unset($this->fields_options['contact']); @@ -633,12 +598,13 @@ class AdminCustomerThreadsControllerCore extends AdminController $this->context->link->getPageLink('contact', true, (int)$ct->id_lang, null, false, $ct->id_shop), 'token='.$ct->token ); - $headingText = $this->l('Hi') .' '.$ct->user_name; + $headingText = $this->l('Hi').' '.$ct->user_name.','; $idShop = $ct->id_shop; $params = array( '{reply}' => Tools::nl2br(Tools::getValue('reply_message')), '{link}' => $link, '{headingtext}' => $headingText, + '{contact_name}' => $contact->name, ); if (!empty(trim($ct->subject))) { $params['{subject}'] = $ct->subject; @@ -652,6 +618,7 @@ class AdminCustomerThreadsControllerCore extends AdminController if ($customer->id) { $headingText .= ' '.$customer->firstname.' '.$customer->lastname; } + $headingText .= ','; } if (Mail::Send( @@ -759,18 +726,29 @@ class AdminCustomerThreadsControllerCore extends AdminController $time = time(); $kpis = array(); + $all = CustomerThread::getTotalCustomerThreads(); + $pending = (int)AdminStatsController::getPendingMessages(); + $open = CustomerThread::getTotalCustomerThreads('status='.CustomerThread::QLO_CUSTOMER_THREAD_STATUS_OPEN); + $helper = new HelperKpi(); + $helper->id = 'box-messages'; + $helper->icon = 'icon-envelope'; + $helper->color = 'color1'; + $helper->title = $this->l('Total threads'); + $helper->value = $all; + $this->kpis[] = $helper; + $helper = new HelperKpi(); $helper->id = 'box-pending-messages'; $helper->icon = 'icon-envelope'; - $helper->color = 'color1'; - $helper->title = $this->l('Pending Discussion Threads', null, null, false); - $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=pending_messages'; + $helper->color = 'color2'; + $helper->title = $this->l('Threads pending', null, null, false); + $helper->value = $pending + $open; $this->kpis[] = $helper; $helper = new HelperKpi(); $helper->id = 'box-age'; $helper->icon = 'icon-time'; - $helper->color = 'color2'; + $helper->color = 'color3'; $helper->title = $this->l('Average Response Time', null, null, false); $helper->subtitle = $this->l('30 days', null, null, false); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=avg_msg_response_time'; @@ -779,12 +757,45 @@ class AdminCustomerThreadsControllerCore extends AdminController $helper = new HelperKpi(); $helper->id = 'box-messages-per-thread'; $helper->icon = 'icon-copy'; - $helper->color = 'color3'; + $helper->color = 'color4'; $helper->title = $this->l('Messages per Thread', null, null, false); $helper->subtitle = $this->l('30 day', null, null, false); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=messages_per_thread'; $this->kpis[] = $helper; + $helper = new HelperKpi(); + $helper->id = 'box-pending-messages'; + $helper->icon = 'icon-envelope'; + $helper->color = 'color1'; + $helper->title = $this->l('Customer messages', null, null, false); + $helper->value = (int) CustomerMessage::getTotalCustomerMessages('cm.`id_employee` = 0'); + $this->kpis[] = $helper; + + $helper = new HelperKpi(); + $helper->id = 'box-pending-messages'; + $helper->icon = 'icon-envelope'; + $helper->color = 'color4'; + $helper->title = $this->l('Employee messages', null, null, false); + $helper->value = (int) CustomerMessage::getTotalCustomerMessages('cm.`id_employee` != 0'); + $this->kpis[] = $helper; + + + $helper = new HelperKpi(); + $helper->id = 'box-pending-messages'; + $helper->icon = 'icon-envelope'; + $helper->color = 'color2'; + $helper->title = $this->l('Unread threads', null, null, false); + $helper->value = (int) $open; + $this->kpis[] = $helper; + + $helper = new HelperKpi(); + $helper->id = 'box-pending-messages'; + $helper->icon = 'icon-envelope'; + $helper->color = 'color1'; + $helper->title = $this->l('Closed threads', null, null, false); + $helper->value = (int) ($all - ($open + $pending)); + $this->kpis[] = $helper; + return parent::renderKpis(); } @@ -911,6 +922,7 @@ class AdminCustomerThreadsControllerCore extends AdminController } } + $this->context->smarty->assign('display', 'view'); $this->tpl_view_vars = array( 'id_customer_thread' => $id_customer_thread, 'thread' => $thread, @@ -995,6 +1007,22 @@ class AdminCustomerThreadsControllerCore extends AdminController return $timeline; } + public function initToolbarTitle() + { + parent::initToolbarTitle(); + switch ($this->display) { + case 'view': + if (!($thread = $this->loadObject())) { + return; + } + + if ($thread->id) { + $this->toolbar_title[] = sprintf($this->l('Title: %1$s'), $thread->subject); + } + break; + } + } + protected function displayMessage($message, $email = false, $id_employee = null) { $tpl = $this->createTemplate('message.tpl'); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 57c7d0867..c5f55b4e7 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -1568,7 +1568,7 @@ class AdminOrdersControllerCore extends AdminController $id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($customer->email, $order->id); if (!$id_customer_thread) { $customer_thread = new CustomerThread(); - $customer_thread->id_contact = 0; + $customer_thread->id_contact = (int)Configuration::get('PS_MAIL_EMAIL_MESSAGE'); $customer_thread->id_customer = (int)$order->id_customer; $customer_thread->user_name = $customer->firstname.' '.$customer->lastname; $customer_thread->phone = $customer->phone; diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 47f48394b..5864228a7 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -425,7 +425,6 @@ class AdminStatsControllerCore extends AdminStatsTabController public static function getPendingMessages() { $pendingStatuses = array( - CustomerThread::QLO_CUSTOMER_THREAD_STATUS_OPEN, CustomerThread::QLO_CUSTOMER_THREAD_STATUS_PENDING2, CustomerThread::QLO_CUSTOMER_THREAD_STATUS_PENDING1 ); diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index 3332b2f4e..691959cec 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -47,10 +47,10 @@ class ContactControllerCore extends FrontController $id_contact = (int)Tools::getValue('id_contact'); $objCustomerThread = new CustomerThread(); $id_customer_thread = (int)$objCustomerThread->getIdCustomerThreadByToken(Tools::getValue('token')); - $nameRequired = Configuration::get('PS_CUSTOMER_SERVICE_NAME_REQUIRED'); - $phoneRequired = Configuration::get('PS_CUSTOMER_SERVICE_PHONE_REQUIRED'); - if (!Configuration::get('PS_CUSTOMER_SERVICE_CONTACT_ALLOW')) { - $id_contact = (int) Configuration::get('PS_CUSTOMER_SERVICE_EMAIL_MESSAGE'); + $nameRequired = Configuration::get('PS_CUSTOMER_SERVICE_REQUIRED_NAME'); + $phoneRequired = Configuration::get('PS_CUSTOMER_SERVICE_REQUIRED_PHONE'); + if (!Configuration::get('PS_CUSTOMER_SERVICE_DISPLAY_CONTACT')) { + $id_contact = (int) Configuration::get('PS_CUSTOMER_SERVICE_CONTACT'); } if (!($from = trim(Tools::getValue('from'))) || !Validate::isEmail($from)) { @@ -158,34 +158,22 @@ class ContactControllerCore extends FrontController } if (!count($this->errors)) { - $var_list = array( - '{order_name}' => '-', - '{attached_file}' => '-', - '{message}' => Tools::nl2br(stripslashes($message)), - '{email}' => $from, - '{product_name}' => '', - '{subject}' => $ct->subject, - ); + $smartyMailVars['message'] = Tools::nl2br(stripslashes($message)); + $smartyMailVars['email'] = $ct->email; + $smartyMailVars['subject'] = $ct->subject; + $smartyMailVars['phone'] = $ct->phone; + $smartyMailVars['user_name'] = $ct->user_name; if (isset($file_attachment['name'])) { - $var_list['{attached_file}'] = $file_attachment['name']; - } - - $id_product = (int)Tools::getValue('id_product'); - - if (isset($ct) && Validate::isLoadedObject($ct) && $ct->id_order) { - $order = new Order((int)$ct->id_order); - $var_list['{order_name}'] = $order->getUniqReference(); - $var_list['{id_order}'] = (int)$order->id; - } - - 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]; - } + $smartyMailVars['attached_file'] = $file_attachment['name']; } + $contact_content_txt = $this->getEmailTemplateContent('contact_content_txt.tpl', Mail::TYPE_TEXT, $smartyMailVars); + $contact_content_html = $this->getEmailTemplateContent('contact_content_html.tpl', Mail::TYPE_TEXT, $smartyMailVars); + $var_list = array( + '{contact_content_txt}' => $contact_content_txt, + '{contact_content_html}' => $contact_content_html, + ); if (!empty($contact->email)) { Mail::Send( $this->context->language->id, @@ -217,6 +205,30 @@ class ContactControllerCore extends FrontController } } + protected function getEmailTemplateContent($template_name, $mail_type, $var) + { + $email_configuration = Configuration::get('PS_MAIL_TYPE'); + if ($email_configuration != $mail_type && $email_configuration != Mail::TYPE_BOTH) { + return ''; + } + + $pathToFindEmail = array( + _PS_THEME_DIR_.'mails'.DIRECTORY_SEPARATOR.$this->context->language->iso_code.DIRECTORY_SEPARATOR.$template_name, + _PS_THEME_DIR_.'mails'.DIRECTORY_SEPARATOR.'en'.DIRECTORY_SEPARATOR.$template_name, + _PS_MAIL_DIR_.$this->context->language->iso_code.DIRECTORY_SEPARATOR.$template_name, + _PS_MAIL_DIR_.'en'.DIRECTORY_SEPARATOR.$template_name, + ); + + foreach ($pathToFindEmail as $path) { + if (Tools::file_exists_cache($path)) { + $this->context->smarty->assign($var); + return $this->context->smarty->fetch($path); + } + } + + return ''; + } + public function setMedia() { parent::setMedia(); @@ -324,11 +336,11 @@ class ContactControllerCore extends FrontController 'contacts' => Contact::getContacts($this->context->language->id), 'message' => html_entity_decode(Tools::getValue('message')), 'contactKey' => $contactKey, - 'contactNameRequired' => Configuration::get('PS_CUSTOMER_SERVICE_NAME_REQUIRED'), - 'displayContactName' => Configuration::get('PS_CUSTOMER_SERVICE_NAME_DISPLAY'), - 'contactPhoneRequired' => Configuration::get('PS_CUSTOMER_SERVICE_PHONE_REQUIRED'), - 'displayContactPhone' => Configuration::get('PS_CUSTOMER_SERVICE_PHONE_DISPLAY'), - 'allowContactSelection' => Configuration::get('PS_CUSTOMER_SERVICE_CONTACT_ALLOW') + 'contactNameRequired' => Configuration::get('PS_CUSTOMER_SERVICE_REQUIRED_NAME'), + 'displayContactName' => Configuration::get('PS_CUSTOMER_SERVICE_DISPLAY_NAME'), + 'contactPhoneRequired' => Configuration::get('PS_CUSTOMER_SERVICE_REQUIRED_PHONE'), + 'displayContactPhone' => Configuration::get('PS_CUSTOMER_SERVICE_DISPLAY_PHONE'), + 'allowContactSelection' => Configuration::get('PS_CUSTOMER_SERVICE_DISPLAY_CONTACT') ) ); diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php index 80e9a335d..3c94c1464 100644 --- a/controllers/front/OrderDetailController.php +++ b/controllers/front/OrderDetailController.php @@ -693,7 +693,7 @@ class OrderDetailControllerCore extends FrontController $objCustomer = new Customer($order->id_customer); if (!$id_customer_thread) { $ct = new CustomerThread(); - $ct->id_contact = 0; + $ct->id_contact = (int)Configuration::get('PS_MAIL_EMAIL_MESSAGE'); $ct->id_customer = (int)$order->id_customer; $ct->user_name = $objCustomer->firstname.' '.$objCustomer->lastname; $ct->subject = $order->reference; diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml index 691c7c2ce..089c2c68c 100644 --- a/install/data/xml/configuration.xml +++ b/install/data/xml/configuration.xml @@ -956,19 +956,19 @@ 0 - + 1 - + 1 - + 1 - + 1 - + 1 diff --git a/js/admin/customer_thread.js b/js/admin/customer_thread.js index 94aeea291..fd4b1be80 100644 --- a/js/admin/customer_thread.js +++ b/js/admin/customer_thread.js @@ -18,41 +18,39 @@ */ $(document).ready(function() { - if ($('#PS_CUSTOMER_SERVICE_CONTACT_ALLOW_on').prop('checked')) { - $('[name="PS_CUSTOMER_SERVICE_EMAIL_MESSAGE"]').closest('.form-group').hide(); + if ($('#PS_CUSTOMER_SERVICE_DISPLAY_CONTACT_on').prop('checked')) { + $('[name="PS_CUSTOMER_SERVICE_CONTACT"]').closest('.form-group').hide(); } - if ($('#PS_CUSTOMER_SERVICE_NAME_REQUIRED_on').prop('checked')) { - $('[name="PS_CUSTOMER_SERVICE_NAME_DISPLAY"]').closest('.form-group').hide(); + if (!$('#PS_CUSTOMER_SERVICE_DISPLAY_NAME_on').prop('checked')) { + $('[name="PS_CUSTOMER_SERVICE_REQUIRED_NAME"]').closest('.form-group').hide(); } - if ($('#PS_CUSTOMER_SERVICE_PHONE_REQUIRED_on').prop('checked')) { - $('[name="PS_CUSTOMER_SERVICE_PHONE_DISPLAY"]').closest('.form-group').hide(); + if (!$('#PS_CUSTOMER_SERVICE_DISPLAY_PHONE_on').prop('checked')) { + $('[name="PS_CUSTOMER_SERVICE_REQUIRED_PHONE"]').closest('.form-group').hide(); } - $(document).on('change', '[name="PS_CUSTOMER_SERVICE_CONTACT_ALLOW"]', function() { - if ($('#PS_CUSTOMER_SERVICE_CONTACT_ALLOW_on').prop('checked')) { - $('[name="PS_CUSTOMER_SERVICE_EMAIL_MESSAGE"]').closest('.form-group').hide(); + $(document).on('change', '[name="PS_CUSTOMER_SERVICE_DISPLAY_CONTACT"]', function() { + if ($('#PS_CUSTOMER_SERVICE_DISPLAY_CONTACT_on').prop('checked')) { + $('[name="PS_CUSTOMER_SERVICE_CONTACT"]').closest('.form-group').hide(); } else { - $('[name="PS_CUSTOMER_SERVICE_EMAIL_MESSAGE"]').closest('.form-group').show(); + $('[name="PS_CUSTOMER_SERVICE_CONTACT"]').closest('.form-group').show(); } }); - $(document).on('change', '[name="PS_CUSTOMER_SERVICE_NAME_REQUIRED"]', function() { - if ($('#PS_CUSTOMER_SERVICE_NAME_REQUIRED_on').prop('checked')) { - $('[name="PS_CUSTOMER_SERVICE_NAME_DISPLAY"]').closest('.form-group').hide(); - $('#PS_CUSTOMER_SERVICE_NAME_DISPLAY_on').prop('checked', true); + $(document).on('change', '[name="PS_CUSTOMER_SERVICE_DISPLAY_NAME"]', function() { + if ($('#PS_CUSTOMER_SERVICE_DISPLAY_NAME_on').prop('checked')) { + $('[name="PS_CUSTOMER_SERVICE_REQUIRED_NAME"]').closest('.form-group').show(); } else { - $('[name="PS_CUSTOMER_SERVICE_NAME_DISPLAY"]').closest('.form-group').show(); + $('[name="PS_CUSTOMER_SERVICE_REQUIRED_NAME"]').closest('.form-group').hide(); } }); - $(document).on('change', '[name="PS_CUSTOMER_SERVICE_PHONE_REQUIRED"]', function() { - if ($('#PS_CUSTOMER_SERVICE_PHONE_REQUIRED_on').prop('checked')) { - $('[name="PS_CUSTOMER_SERVICE_PHONE_DISPLAY"]').closest('.form-group').hide(); - $('#PS_CUSTOMER_SERVICE_PHONE_DISPLAY_on').prop('checked', true); + $(document).on('change', '[name="PS_CUSTOMER_SERVICE_DISPLAY_PHONE"]', function() { + if ($('#PS_CUSTOMER_SERVICE_DISPLAY_PHONE_on').prop('checked')) { + $('[name="PS_CUSTOMER_SERVICE_REQUIRED_PHONE"]').closest('.form-group').show(); } else { - $('[name="PS_CUSTOMER_SERVICE_PHONE_DISPLAY"]').closest('.form-group').show(); + $('[name="PS_CUSTOMER_SERVICE_REQUIRED_PHONE"]').closest('.form-group').hide(); } }); diff --git a/mails/en/contact.html b/mails/en/contact.html index c9c93ad62..5c5aa9d53 100644 --- a/mails/en/contact.html +++ b/mails/en/contact.html @@ -66,38 +66,33 @@ - - - - - Message from a {shop_name} customer - - - - -   - - - - - - - - - -
  - - - Customer e-mail address: {email}

- Title: {subject}

- Customer message: {message}

- Attached file: {attached_file} -
-
-
 
- - - + + + + Message from a {shop_name} customer + + + + +   + + + + + + + + + +
  + + + {contact_content_html} + + +  
+ +   diff --git a/mails/en/contact.txt b/mails/en/contact.txt index ccd9a4132..6744c4958 100644 --- a/mails/en/contact.txt +++ b/mails/en/contact.txt @@ -3,13 +3,7 @@ Message from a {shop_name} customer -CUSTOMER E-MAIL ADDRESS: {email} - -TITLE : {subject} - -CUSTOMER MESSAGE: {message} - -ATTACHED FILE: {attached_file} +{contact_content_txt} {shop_name} [/{shop_url}] powered by Webkul(tm) [https://webkul.com] diff --git a/mails/en/contact_content_html.tpl b/mails/en/contact_content_html.tpl new file mode 100644 index 000000000..ad318937f --- /dev/null +++ b/mails/en/contact_content_html.tpl @@ -0,0 +1,15 @@ +{if isset($user_name) && $user_name} +Name: {$user_name}

+{/if} +{if isset($email) && $email} +E-mail: {$email}

+{/if} +{if isset($subject) && $subject} +Title: {$subject}

+{/if} +{if isset($message) && $message} +Customer message:
{$message}

+{/if} +{if isset($attached_file) && $attached_file} +Attached file: {$attached_file} +{/if} diff --git a/mails/en/contact_content_txt.tpl b/mails/en/contact_content_txt.tpl new file mode 100644 index 000000000..ea7b435cf --- /dev/null +++ b/mails/en/contact_content_txt.tpl @@ -0,0 +1,18 @@ + +{if isset($user_name) && $user_name} + Name: {$user_name} +{/if} +{if isset($email) && $email} + E-mail: {$email} +{/if} +{if isset($subject) && $subject} + Title: {$subject} +{/if} + +{if isset($message) && $message} + Customer message:
{$message}

+{/if} +{if isset($attached_file) && $attached_file} + Attached file: {$attached_file} +{/if} + diff --git a/mails/en/order_customer_comment.html b/mails/en/order_customer_comment.html index 42df13834..6dd6fedcf 100644 --- a/mails/en/order_customer_comment.html +++ b/mails/en/order_customer_comment.html @@ -66,39 +66,36 @@ - - - - - Hi {firstname} {lastname}, - - - - -   - - - - - - - - - -
  - -

- Message from a customer

- - You have received a new message regarding booking with the reference {order_name}.

- Customer: {firstname} {lastname} ({email})

- {message} -
-
-
 
- - - + + + + Message from a customer + + + + +   + + + + + + + + + +
  + + + You have received a new message regarding booking with the reference {order_name}.

+ Name: {firstname} {lastname}

+ E-mail: {email}

+ Customer message:
{message}

+
+
+
 
+ +   diff --git a/mails/en/order_customer_comment.txt b/mails/en/order_customer_comment.txt index 2c2e715b1..e119eb1c9 100644 --- a/mails/en/order_customer_comment.txt +++ b/mails/en/order_customer_comment.txt @@ -6,8 +6,11 @@ Hi {firstname} {lastname}, You have received a new message regarding booking with the reference {order_name}. -CUSTOMER: {firstname} {lastname} ({email}) +NAME: {firstname} {lastname} +E-mail: {email} + +Customer message: {message} {shop_name} [/{shop_url}] powered by Webkul(tm) diff --git a/mails/en/order_merchant_comment.html b/mails/en/order_merchant_comment.html index 941533196..4cbc9d7b8 100644 --- a/mails/en/order_merchant_comment.html +++ b/mails/en/order_merchant_comment.html @@ -4,51 +4,51 @@ Message from {shop_name} - - - @@ -66,38 +66,37 @@ - - - - - Hi {firstname} {lastname}, - - - - -   - - - - - - - - - -
  - -

- Message from {shop_name}

- - You have received a new message from {shop_name} regarding order with the reference {order_name}.

- Message: {message} -
-
-
 
- - - + + + + Hi {firstname} {lastname}, + + + + +   + + + + + + + + + +
  + +

+ Message from {shop_name} +

+ + You have received a new message from {shop_name} regarding booking with the reference {order_name}.

+ Message:
{message} +
+
+
 
+ +   diff --git a/mails/en/order_merchant_comment.txt b/mails/en/order_merchant_comment.txt index e1c404f3e..ee62c23f0 100644 --- a/mails/en/order_merchant_comment.txt +++ b/mails/en/order_merchant_comment.txt @@ -1,13 +1,14 @@ -[/{shop_url}] +[/{shop_url}] -Hi {firstname} {lastname}, +Hi {firstname} {lastname}, -You have received a new message from {shop_name} regarding order with +You have received a new message from {shop_name} regarding booking with the reference {order_name}. -MESSAGE: {message} +MESSAGE: +{message} {shop_name} [/{shop_url}] powered by Webkul(tm) -[https://webkul.com] +[https://webkul.com] diff --git a/mails/en/reply_msg.html b/mails/en/reply_msg.html index 98616b76a..7eafe00e4 100644 --- a/mails/en/reply_msg.html +++ b/mails/en/reply_msg.html @@ -71,29 +71,29 @@ {headingtext} - - - Title: {subject} - -   - - {reply} + + + + + + +
  + +

+ Message from {contact_name}


Title: {subject}

+ Message:
{reply}
+

+ + Please do not reply directly to this email, we will not receive it.
+ In order to reply, you can click here +
+
- - -   - - - - - Please do not reply directly to this email, we will not receive it.
- In order to reply, you can click here
- -   diff --git a/mails/en/reply_msg.txt b/mails/en/reply_msg.txt index 0953fc4e9..475f41d4d 100644 --- a/mails/en/reply_msg.txt +++ b/mails/en/reply_msg.txt @@ -3,8 +3,9 @@ {headingtext}, -{subject} +Title: {subject} +Message: {reply} Please do not reply directly to this email, we will not receive it.