TFPtMaster Posted February 8, 2016 Share Posted February 8, 2016 Hello I've searched for a while before posting in the forum, perhaps I didn't searched well enough, but since I'm here I want to ask to all of you, prestashop experts. In the Contact Form we have 7 subjects, this helps to filter the clients demands. However we have 2 or 3 subjects that asks to the same person/email account, and I wanted to know how to add the subject when the customer selects in the contact form page, into the email subject/heading replacing the "Customer message from contact form". For example when receiving in Thunderbird/Outlook the customer demand, if the Subject/Heading is something like this "Customer Message - Customer Support" It could go directly to a folder using a rule for the Customer Support, this way he could prioritise answering in the first place to the most urgent subjects, without the need to open all the emails and filtering them manually. I'm using prestashop 1.5.6.1 I really hope someone can help me and others in needing of something like this. Link to comment Share on other sites More sharing options...
TFPtMaster Posted February 10, 2016 Author Share Posted February 10, 2016 Hi again. Anyone ? Link to comment Share on other sites More sharing options...
yaniv14 Posted February 10, 2016 Share Posted February 10, 2016 You will need to override ContactController.php -> Mail::Send function to modify the subject based on the user selection. Link to comment Share on other sites More sharing options...
TFPtMaster Posted February 12, 2016 Author Share Posted February 12, 2016 You will need to override ContactController.php -> Mail::Send function to modify the subject based on the user selection. Thank you for your reply. I've tried to look to the controller and I didn't found how to change it. I'm not an expert in PHP. Can you give me some tips of what to change? Thank you in advance Link to comment Share on other sites More sharing options...
yaniv14 Posted February 12, 2016 Share Posted February 12, 2016 First of all ContactController.php located in controllers/front folder. Second I don't recommend modifying core files but I can't explain right now how to make overrides so just change it right now and remember that if in the future you will upgrade your Prestashop it will be overwritten. Before the mail submit you have a variable called $contact which include the selected subject/department, so $contact->name is basically the name of the subject/department. Around lines 189-193 is the mail submission function, it start with: if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]', So you can try to change it to: if (!Mail::Send($this->context->language->id, 'contact', sprintf(Mail::l('Message from contact form to %s', $this->context->language->id), $contact->name), I haven't tested it but I think it should work. p.s.: try reading about making overrides in PS, it's quite easy and recommended. Link to comment Share on other sites More sharing options...
TFPtMaster Posted February 15, 2016 Author Share Posted February 15, 2016 Thank you. It works perfectly. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now