Masteries Posted August 6, 2016 Share Posted August 6, 2016 (edited) If you're a visitor on a Prestashop site, the contact form shows three textfields: Order reference, e-mail and message. However, not everyone has made an order & has an order reference so therefore I'd like to allow them to write a custom title instead. Currently, they can type in whatever numbers they want but if they type in a string/character in the Order reference field, the title of the e-mail I receive turns out like this: [shop] Regarding: {id_order}. As long as they type whatever number they want, the title of the e-mail I receive is fine even if the order reference is nonexistent in the database. I know that Order reference field allows only integer/numerical values, so I tried changing the following line (53) CustomerThread.php: 'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId') to: 'id_order' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName') and I also changed the ps_customer_thread table structure so that id_order is set to VARCHAR instead of INT, this solution did not seem to work. I know that I have to edit some more stuff in ContactController.php and contact-form.tpl but there were too many lines that contained "id_order" so I did not know what exactly to edit as my knowledge in PHP is limited (most of them also gets the value of id_order as int/intval). For example, this line is recurring throughout ContactController.php: (int)Tools::getValue('id_order') Would removing the (int) part on all those lines solve this (along with all the other steps I have done)? If so, how do I do it correctly? Any pointers on this would be really appreciated as I have been having this problem for a while now. Prestashop should definitely work on adding some customizability to the in-built contact form in the BO.. Edited September 6, 2016 by Masteries (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 8, 2016 Share Posted August 8, 2016 can you describe what is the effect of the modification you made?- you've got some errors while you try to send form ?- there is no error and "title" is not send ? Link to comment Share on other sites More sharing options...
Masteries Posted August 8, 2016 Author Share Posted August 8, 2016 (edited) can you describe what is the effect of the modification you made? - you've got some errors while you try to send form ? - there is no error and "title" is not send ? -there is no error and "title" is not send ? The modifications I made simply did not work. There were no errors and the title was still the following: [shop] Regarding {id_order}. Do you think I should just make a new field instead? Edited August 8, 2016 by Masteries (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 8, 2016 Share Posted August 8, 2016 it is not enough to change id_order data type there are a lot of dependencies both in front and back office where id_order variable is used because of this - it will be much better to extend the form with additional fielnd instead of modify id_ordersimply saying, this kind of change will generate a lot of problems Link to comment Share on other sites More sharing options...
Masteries Posted August 8, 2016 Author Share Posted August 8, 2016 it is not enough to change id_order data type there are a lot of dependencies both in front and back office where id_order variable is used because of this - it will be much better to extend the form with additional fielnd instead of modify id_order simply saying, this kind of change will generate a lot of problems Ah I see, I will just create a new field instead in that case. Thanks for your help! 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