player.c64 Posted July 18, 2013 Share Posted July 18, 2013 Hi everyone. This is my problem. I need add custom field during order same as message field and save it in created column in table ps_message. So far I've added to the order-carriers.tpl <p>Please insert your purchase order number in the space provided.</p> <p><textarea cols="120" rows="3" name="pon" id="pon">{if isset($oldMessage)}{$oldMessage}{/if}</textarea></p> OrderController.php if (Tools::isSubmit('pon')) $this->_updateMessage(Tools::getValue('pon')); ParentOrderController.php protected function _checkFreeOrder() { if ($this->context->cart->getOrderTotal() <= 0) { $order = new FreeOrder(); $order->free_order_class = true; $order->validateOrder($this->context->cart->id, Configuration::get('PS_OS_PAYMENT'), 0, Tools::displayError('Free order', false), null, array(), null, false, $this->context->cart->secure_key); return (int)Order::getOrderByCartId($this->context->cart->id); } return false; } protected function _updateMessage($messageContent) { if ($messageContent) { 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->pon = $_POST['pon']; $message->update(); } else { $message = new Message(); $message->message = $messageContent; $message->pon = $messageContent; $message->id_cart = (int)($this->context->cart->id); $message->id_customer = (int)($this->context->cart->id_customer); $message->add(); } } else { if ($oldMessage = Message::getMessageByCartId($this->context->cart->id)) { $message = new Message($oldMessage['id_message']); $message->delete(); } } return true; } My question is how to save field 'pon' to created column "pon" in the table 'ps_message'. I've also tried custom function but nothing works. protected function PurchaseOrderNumber($txtPon) { Db::getInstance()->execute("INSERT INTO `"._DB_PREFIX_."message` (`id_cart`, `id_employee`, `id_order`, `message`, `private`, `date_add`, `pon`) VALUES (".intval($cart->id).", 0, 0, '".$messageContent."', 0, NOW(),".$_POST['pon'].")"); } Thanks for any advance. Link to comment Share on other sites More sharing options...
El Patron Posted July 18, 2013 Share Posted July 18, 2013 topic moved to development 1 Link to comment Share on other sites More sharing options...
dformica Posted December 5, 2013 Share Posted December 5, 2013 Any news on this? I need a Purchase Order (PO) field to allow some of my clients to entered their PO number during checkout. Thanks! Link to comment Share on other sites More sharing options...
MohanaKrishnan Posted November 14, 2014 Share Posted November 14, 2014 topic moved to development Hi, If moved means where is the link ?. Link to comment Share on other sites More sharing options...
khushal Posted November 13, 2015 Share Posted November 13, 2015 Hi, I am also facing this issue.please let me know if anybody knows this solution which is describe above... 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