doubleD Posted July 25, 2011 Share Posted July 25, 2011 Hello everyone! I'd like to create another one contact form within prestashop (in addition to existing one). I tried to copy contact-form.php and changed code to request copied Controller (controllers/ContactController) and a class (classes/Contact.php) with tpl file but all i see is an "error 500" result. (Maybe some database fields required?) I hope someone tried and managed to find a solution. Thanks in advance. ------- Prestashop 1.4.3 Motul-oil.com.ua Link to comment Share on other sites More sharing options...
shokinro Posted July 25, 2011 Share Posted July 25, 2011 1 .It is better that you copy a set of all three files. contact-form.php controllers/ContactController.php themes/YourSiteTheme/contact-form.tpl 2. Rename all of the files to new ones contact-formXXX.php controllers/ContactXXXController.php themes/YourSiteTheme/contact-formXXX.tpl 3. Change related places in controllers/ContactXXXController.php class ContactXXXControllerCore extends FrontController { public function __construct() { $this->php_self = 'contact-formXXX.php'; $this->ssl = true; parent::__construct(); } .... public function displayContent() { $_POST = array_merge($_POST, $_GET); parent::displayContent(); self::$smarty->display(_PS_THEME_DIR_.'contact-formXXX.tpl'); } } please note above XXX needs to be changed to your own names 1 Link to comment Share on other sites More sharing options...
doubleD Posted July 26, 2011 Author Share Posted July 26, 2011 Thank you. I did exactly the same except for changing class ContactXXXControllerCore extends FrontController Thanks a lot, it works great! ________________ Prestashop 1.4.3 Motul-oil.com.ua Prestashop 1.3.1 Vezdexod.com.ua/store Link to comment Share on other sites More sharing options...
shokinro Posted July 26, 2011 Share Posted July 26, 2011 good to know is worked, if you think it solved your problem, please make this thread as SOLVED. thanks Link to comment Share on other sites More sharing options...
eiron Posted October 27, 2011 Share Posted October 27, 2011 how about on prestashop 1.3 version how to add new contact form and how add some new field of it Link to comment Share on other sites More sharing options...
sudhakarm1 Posted November 1, 2011 Share Posted November 1, 2011 Hi, How do you add a new contact form when one select a sub-category. regards, Sudhakar Link to comment Share on other sites More sharing options...
thx2012 Posted February 28, 2012 Share Posted February 28, 2012 1 .It is better that you copy a set of all three files. contact-form.php controllers/ContactController.php themes/YourSiteTheme/contact-form.tpl 2. Rename all of the files to new ones contact-formXXX.php controllers/ContactXXXController.php themes/YourSiteTheme/contact-formXXX.tpl 3. Change related places in controllers/ContactXXXController.php class ContactXXXControllerCore extends FrontController { public function __construct() { $this->php_self = 'contact-formXXX.php'; $this->ssl = true; parent::__construct(); } .... public function displayContent() { $_POST = array_merge($_POST, $_GET); parent::displayContent(); self::$smarty->display(_PS_THEME_DIR_.'contact-formXXX.tpl'); } } please note above XXX needs to be changed to your own names I'm using v1.4.4.1 and I followed the instructions, and I get Warning & Fatal Errors (I used XXXXX in-lieu-of names): Warning: require(/home/XXXXX/public_html/XXXXX../config/config.inc.php) [function.require]: failed to open stream: No such file or directory in /home/XXXXX/public_html/XXXXX/contact-map.php on line 28 Fatal error: require() [function.require]: Failed opening required '/home/XXXXX/public_html/XXXXX../config/config.inc.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/XXXXX/public_html/XXXXX/contact-map.php on line 28 What other files require replacing/adjusting? Do I create another config.inc.php and label it config.XXX.php ? Link to comment Share on other sites More sharing options...
palombokevin Posted March 26, 2012 Share Posted March 26, 2012 Hi Everyone! I made everything explained above but nothing happened... On BO Preference/SEO&URL I've add the page contact-formXXX.php with personalize link. When I try to go on browser www.xxx.com/contact-formXXX.php I land on initial contact page. Don't know what to do. Please help Link to comment Share on other sites More sharing options...
plus91anand Posted September 17, 2012 Share Posted September 17, 2012 Thanks for the code above. I am trying it and it seems to be going fine till now. What i couldn't get is that how to set the email template for this new contact form. what i got to learn from some other posts is that following files are used in default contact form email template /mails/en(or and other languages using)/contact.html /mails/en(or and other languages using)/contact.txt /mails/en(or and other languages using)/contact_form.html /mails/en(or and other languages using)/contact_form.txt So my point is if i create a new file here for my custom contact form , where should i specify in my controller (or wherever it is needed to be mentioned) to use that particular file. 1 Link to comment Share on other sites More sharing options...
Whirly Posted September 24, 2012 Share Posted September 24, 2012 (edited) The only lines mentionning these emails name in XXXControllerCore are : L156+157 if (Mail::Send((int)(self::$cookie->id_lang), 'contact', Mail::l('Message from contact form'), array('{email}' => $from, '{message}' => stripslashes($message)), $contact->email, $contact->name, $from, ((int)(self::$cookie->id_customer) ? $customer->firstname.' '.$customer->lastname : ''), $fileAttachment) AND Mail::Send((int)(self::$cookie->id_lang), 'contact_form', Mail::l('Your message has been correctly sent'), array('{message}' => stripslashes($message)), $from)) AND L206 Mail::Send((int)(self::$cookie->id_lang), 'contact_form', Mail::l('Your message has been correctly sent'), array('{message}' => stripslashes($message)), $from); So I guess you can duplicate and rename contact.html and contact_form.html and then change the code accordingly. But I'm still stuck in the previous step. Can you tell me how you changed the code in XXXControllerCore. I am able to display my new form but it is not working AND it makes the original form non functionnal. Can the problem come from public $php_self = 'XXXX.php'; ? class XXXXControllerCore extends FrontController { public $php_self = 'XXXX.php'; public $ssl = true; public function preProcess() { parent::preProcess(); Edited September 24, 2012 by Whirly (see edit history) Link to comment Share on other sites More sharing options...
Whirly Posted October 5, 2012 Share Posted October 5, 2012 Anyone to help me. It has worked once but now its not working anymore! Superstrange! There some kinds of conflict. Variables? Where do you think the error comes from? Link to comment Share on other sites More sharing options...
vickyjoshi Posted February 27, 2013 Share Posted February 27, 2013 1 .It is better that you copy a set of all three files. contact-form.php controllers/ContactController.php themes/YourSiteTheme/contact-form.tpl 2. Rename all of the files to new ones contact-formXXX.php controllers/ContactXXXController.php themes/YourSiteTheme/contact-formXXX.tpl 3. Change related places in controllers/ContactXXXController.php class ContactXXXControllerCore extends FrontController { public function __construct() { $this->php_self = 'contact-formXXX.php'; $this->ssl = true; parent::__construct(); } .... public function displayContent() { $_POST = array_merge($_POST, $_GET); parent::displayContent(); self::$smarty->display(_PS_THEME_DIR_.'contact-formXXX.tpl'); } } please note above XXX needs to be changed to your own names Hi i just follow all the steps and i named employee instead of contact and now its showing me one another page named employee but i want to add contact-form.css on my page its not displaying that css for my employee page can you plz help me Link to comment Share on other sites More sharing options...
Recommended Posts