Juan Pablo Malkrovi Posted June 1, 2015 Share Posted June 1, 2015 (edited) Hi! Im developing in Prestashop and I have a problem. In this part:"If you would like to add a comment about your order, please write it in the field below." I want to put a custom checkbox field in order to appear like a message in the backoffice if is submitted. I have already put the field and edit the php code in the orderopccontroller.php switch (Tools::getValue('method')) { case 'update ': if (Tools::isSubmit('message')) { $txtMessage = urldecode(Tools::getValue('message')); $this->_updateMessage($txtMessage); if (count($this->errors)) die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}'); die(true); } if (Tools::isSubmit('anonimo')) { $this->_updateMessage(Tools::getValue('anonimo')); break;} I have also put in the parentordercontroller.php if (!Validate::isMessage($messageContent)) $this->errors[] = Tools::displayError('Invalid message'); else if ($oldMessage = Message::getMessageByCartId((int)($this->context->cart->id))) { $message = new Message((int)($oldMessage['id_message'])); $message->message = $messageContent; $message->anonimo = $_POST['anonimo']; $message->update(); } else { $message = new Message(); $message->message = $messageContent; $message->anonimo = $_POST['anonimo']; $message->id_cart = (int)($this->context->cart->id); $message->id_customer = (int)($this->context->cart->id_customer); $message->add(); } } But is not working. Please somebody help me Please! Edited June 1, 2015 by Juan Pablo Malkrovi (see edit history) 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