On 3/28/2014 at 8:40 AM, pietro said:Last, I added this to my CmsController.php file. It goes inside the funtion function init(), I put it at the end, right after "header('Status: 404 Not Found'); }"
if (isset($_POST['quickcontact'])){ if ( $_POST['subject'] != '' ) { die("ERROR"); } else { $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $formcontent="From: $name \n Email: $email \n Message: $message"; $recipient = "[email protected]"; $subject = "Quick Contact Form"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error"); header( 'Location: http://yourdomain.com/store/en/content/16-thank-you' ) ; } }
Please do not encourage editing of core files.
Create Override - in folder override/controllers/front/ create a file CmsController.
In it insert this:
class CmsController extends CmsControllerCore { public function initContent(){ parent::initContent(); // include everything what is already in core file (initContent function/method). if(Tools::getValue('quickcontact')){ if ( $_POST['subject'] != '' ) { die("ERROR"); } else { $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $formcontent="From: $name \n Email: $email \n Message: $message"; $recipient = "[email protected]"; $subject = "Quick Contact Form"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error"); header( 'Location: http://yourdomain.com/store/en/content/16-thank-you' ) ; } } } }
In this case no updates of Prestashop core files are scared to You anymore