Post by CEMinistries » Wed Sep 23, 2015 12:20 am

OC 2.0.3.1

Trying to insert two custom fields into the order history. I have done the following code edits and manually entered two columns into the database(tracking_number and check_number) and it is not working. I am not getting any errors, so I'm not sure what I'm doing wrong. Any help would be appreciated.

In my order_history.tpl file I added:

Code: Select all

      <td class="text-left"><?php echo $history['tracking_number']; ?></td>
      <td class="text-left"><?php echo $history['check_number']; ?></td>

Code: Select all

      <td class="text-left"><?php echo $column_tracking_number; ?></td>
      <td class="text-left"><?php echo $column_check_number; ?></td>
In my order_info.tpl file I added:

Code: Select all

<div class="form-group">
                  <label class="col-sm-2 control-label" for="input-tracking-number"><?php echo $entry_tracking_number; ?></label>
                  <div class="col-sm-10">
                    <input type="text" name="tracking_number" id="input-tracking-number" size="50" />
                  </div>
                </div>
<div class="form-group">
                  <label class="col-sm-2 control-label" for="input-check-number"><?php echo $entry_check_number; ?></label>
                  <div class="col-sm-10">
                    <input type="text" name="check_number" id="input-check-number" size="50" />
                  </div>
                </div>
In my controller order.php file I added the proper language files and this into the history array:

Code: Select all

'tracking_number'     => $result['tracking_number'], 
				'check_number'     => $result['check_number'], 
In my model order.php file I changed the following:

Code: Select all

$query = $this->db->query("SELECT oh.date_added, os.name AS status, oh.comment, oh.tracking_number,  oh.check_number, oh.notify FROM " . DB_PREFIX . "order_history oh LEFT JOIN " . DB_PREFIX . "order_status os ON oh.order_status_id = os.order_status_id WHERE oh.order_id = '" . (int)$order_id . "' AND os.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY oh.date_added ASC LIMIT " . (int)$start . "," . (int)$limit);

New member

Posts

Joined
Wed Apr 16, 2014 11:17 pm

Post by CEMinistries » Wed Sep 23, 2015 10:45 pm

As an update, I editted the following code in checkout/order.php

Code: Select all

$this->db->query("INSERT INTO " . DB_PREFIX . "order_history SET order_id = '" . (int)$order_id . "', order_status_id = '" . (int)$order_status_id . "', notify = '" . (int)$notify . "', comment = '" . $this->db->escape($comment) . "', tracking_number = '" . (int)$tracking_number . "', date_added = NOW()");
and

Code: Select all

public function addOrderHistory($order_id, $order_status_id, $comment = '', $tracking_number = '', $notify = false) {
		$this->event->trigger('pre.order.history.add', $order_id);

Now a "0" appears in the tracking_number field no matter what.

New member

Posts

Joined
Wed Apr 16, 2014 11:17 pm
Who is online

Users browsing this forum: No registered users and 5 guests