cahaya_01 Posted December 7, 2012 Share Posted December 7, 2012 Hi, I want to add the store contacts into contact form. Can anyone help me doing that.. Link to comment Share on other sites More sharing options...
sebkos Posted December 7, 2012 Share Posted December 7, 2012 Easiest way is to open and edit contact-form.tpl file. Pack existing form into div then create another one with your store infos inside. Edit contact-form.css and decide if you want place divs side by side or one below another Link to comment Share on other sites More sharing options...
Site Posted December 7, 2012 Share Posted December 7, 2012 I usually do as "sebkos" says - edit the theme file "contact-form.tpl" with the information needed using HTML Link to comment Share on other sites More sharing options...
ricky11 Posted January 29, 2013 Share Posted January 29, 2013 How to add fields to the contact form? Link to comment Share on other sites More sharing options...
marcis Posted March 20, 2013 Share Posted March 20, 2013 And then... how do you save the new field in the database? Regards Link to comment Share on other sites More sharing options...
RaPhiuS Posted March 21, 2013 Share Posted March 21, 2013 Hello, This has already been covered into other posts in this forum, I suggest you have a search. In essence, if you would like to save the new field you are adding in your contact-form.tpl is to update, if I am not mistaken so please check, the Contact.php class (in classes directory). This class inherits from ObjectModel and defines the structure of the <PRESTADBPREFIX>_contact table. Obviously, you would have to add the new field in the database table structure and then update Contact.php to add this extra field (in the same fashion at the other fields already there in the table with correct type and sizing). Alternatively, I do not recommend to change core PrestaShop core files as the changes you make now will be erased as soon you upgrade version. I suggest you create a module which would actually replace the core contact block. Additional information and documentation can be found here: http://doc.prestashop.com/display/PS15/Fundamentals BR, RaPhiuS 1 Link to comment Share on other sites More sharing options...
marcis Posted March 21, 2013 Share Posted March 21, 2013 Nice, RaPhiuS. Thanks for your advice! I'm building a new module to add fields to the contact form but I can't find the way to "override" the contact-form.tpl (I mean, add the input fields without modifying the core template file) Regards Link to comment Share on other sites More sharing options...
marcis Posted March 21, 2013 Share Posted March 21, 2013 Well, I guess the best way to achieve it is overriding the Contact controller in the module, then write a customized "initContent" method and use the "setTemplate" method to point a new template. Something like this: public function initContent() { parent::initContent(); $this->setTemplate('my-contact-form.tpl'); } Could any experienced prestashop developer confirm it, please? Regards Link to comment Share on other sites More sharing options...
RaPhiuS Posted March 23, 2013 Share Posted March 23, 2013 By essence, if you override the Contact controller, and by that I mean using inheritance, then obviously the method initContent() from your "class inheriting from Contact controller" will be called at the very last in the stack tree, therefore setTemplate() will override, hence this confirm your question. 1 Link to comment Share on other sites More sharing options...
RaPhiuS Posted March 25, 2013 Share Posted March 25, 2013 Can you take 3 minutes to mark this post as solved if that has resolved your problem? Thanks! BR, RaPhiuS Link to comment Share on other sites More sharing options...
marcis Posted March 25, 2013 Share Posted March 25, 2013 It's not mine... Link to comment Share on other sites More sharing options...
Recommended Posts