'.$this->l('There was a problem getting the mail files.').' '
- .sprintf($this->l('English language files must exist in %s folder'), ''.$mails['directory'].'en')
- .'
';
- }
+ $str_return .= '
+ '.$this->l('There was a problem getting the mail files.').'
+ '.sprintf($this->l('English language files must exist in %s folder'), ''.preg_replace('@/[a-z]{2}(/?)$@', '/en$1', $mails['directory']).'').'
+
';
+
$str_return .= '
@@ -2412,21 +2413,27 @@ class AdminTranslationsControllerCore extends AdminController
$content = file_get_contents($dir.'/'.$file);
$content = str_replace("\n", ' ', $content);
+ // Subject must match with a template, therefor we first grep the Mail::Send() function then the Mail::l() inside.
if (preg_match_all('/Mail::Send([^;]*);/si', $content, $tab))
for ($i = 0; isset($tab[1][$i]); $i++)
{
$tab2 = explode(',', $tab[1][$i]);
- if (is_array($tab2))
- if ($tab2 && isset($tab2[1]))
- {
- $tab2[1] = trim(str_replace('\'', '', $tab2[1]));
- if (preg_match('/Mail::l\(\''._PS_TRANS_PATTERN_.'\'/s', $tab2[2], $matches))
- $subject_mail[$tab2[1]] = $matches[1];
- }
+ if (is_array($tab2) && isset($tab2[1]))
+ {
+ $template = trim(str_replace('\'', '', $tab2[1]));
+ foreach ($tab2 as $tab3)
+ if (preg_match('/Mail::l\(\''._PS_TRANS_PATTERN_.'\'\)/Us', $tab3.')', $matches))
+ {
+ if (!isset($subject_mail[$template]))
+ $subject_mail[$template] = array();
+ if (!in_array($matches[1], $subject_mail[$template]))
+ $subject_mail[$template][] = $matches[1];
+ }
+ }
}
if (!in_array($file, self::$ignore_folder) && is_dir($dir.'/'.$file))
- $subject_mail = $this->getSubjectMail($dir, $file, $subject_mail);
+ $subject_mail = $this->getSubjectMail($dir, $file, $subject_mail);
return $subject_mail;
}
diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php
index f32311554..d5a136ae3 100644
--- a/controllers/front/ContactController.php
+++ b/controllers/front/ContactController.php
@@ -180,14 +180,8 @@ class ContactControllerCore extends FrontController
$id_product = (int)Tools::getValue('id_product');
- if (isset($ct) && Validate::isLoadedObject($ct))
- {
- if ($ct->id_order)
- $id_order = $ct->id_order;
- $subject = sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token);
- }
- else
- $subject = Mail::l('Your message has been correctly sent');
+ if (isset($ct) && Validate::isLoadedObject($ct) && $ct->id_order)
+ $id_order = $ct->id_order;
if ($id_order)
{
@@ -203,14 +197,18 @@ class ContactControllerCore extends FrontController
$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);
+ Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, null, null, $fileAttachment);
else
{
if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]',
$var_list, $contact->email, $contact->name, $from, ($customer->id ? $customer->firstname.' '.$customer->lastname : ''),
$fileAttachment) ||
- !Mail::Send($this->context->language->id, 'contact_form', $subject, $var_list, $from, null, $contact->email, $contact->name, $fileAttachment))
+ !Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, $contact->email, $contact->name, $fileAttachment))
$this->errors[] = Tools::displayError('An error occurred while sending the message.');
}
}