I am using OpenCart 1.5.6.1 and I am trying to add a new field to the payment method section of the checkout, namely "Purchase Order". The field is in the database, and the input box appears in the checkout as it should, but it just does not save to the database like the other fields.
I'm pretty new to this so I'm not sure if I've done it correctly, but in my checkout/confirm.php controller:
Code: Select all
$data['products'] = $product_data;
$data['vouchers'] = $voucher_data;
$data['totals'] = $total_data;
$data['comment'] = $this->session->data['comment'];
$data['purchase_order'] = $this->session->data['purchase_order'];
$data['total'] = $total;
In my checkout/payment_method.php controller:
Code: Select all
$this->data['text_purchase_order'] = $this->language->get('text_purchase_order');
....
if (isset($this->session->data['purchase_order'])) {
$this->data['purchase_order'] = $this->session->data['purchase_order'];
} else {
$this->data['purchase_order'] = '';
}
Code: Select all
if (!$json) {
$this->session->data['payment_method'] = $this->session->data['payment_methods'][$this->request->post['payment_method']];
$this->session->data['comment'] = strip_tags($this->request->post['comment']);
$this->session->data['purchase_order'] = trim($this->request->post['purchase_order']);
}
But, like I say, the field DOES appear on the checkout, the language file is fine as is the template but it's just the processing of the field which does not work.
If anyone can help me with this I would appreciate it as I'm not 100% sure what I'm doing!
Thank you
Michael