php - Getting error after adding additional data to display in order list(opencart 2.3)
one text
having a problem(error after adding additional data(need to display comment(using for track number) and commission(to see affiliate orders)) to be displayed in order list(Opencart 2.3) Was trying google, doing same-getting error, trying free modification(adding phone number to list) - getting error in log, getting nothing in order list.
Common task is to display in order list two more data from oc_order db - comment and commission
in admin\controller\sale\order.php was added code for comment and commission
foreach ($results as $result) {
$data['orders'][] = array(
'order_id' => $result['order_id'],
'customer' => $result['customer'],
'order_status' => $result['order_status'] ? $result['order_status'] : $this->language->get('text_missing'),
'total' => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
'comment' => $result['comment'],
'commission' => $result['commission'],
'shipping_code' => $result['shipping_code'],
'view' => $this->url->link('sale/order/info', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'] . $url, true),
'edit' => $this->url->link('sale/order/edit', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'] . $url, true)
);
}
in admin\model\sale\order.php was added code o.comment, o.commission in db request
public function getOrders($data = array()) {
$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified, o.comment, o.commission FROM `" . DB_PREFIX . "order` o";
in admin\view\template\sale\order_list.tpl added code
<tbody>
<?php if ($orders) { ?>
<?php foreach ($orders as $order) { ?>
<tr>
<td class="text-center"><?php if (in_array($order['order_id'], $selected)) { ?>
<input type="checkbox" name="selected[]" value="<?php echo $order['order_id']; ?>" checked="checked" />
<?php } else { ?>
<input type="checkbox" name="selected[]" value="<?php echo $order['order_id']; ?>" />
<?php } ?>
<input type="hidden" name="shipping_code[]" value="<?php echo $order['shipping_code']; ?>" /></td>
<td class="text-right"><?php echo $order['order_id']; ?></td>
<td class="text-left"><?php echo $order['customer']; ?></td>
<td class="text-left"><?php echo $order['order_status']; ?></td>
<td class="text-right"><?php echo $order['total']; ?></td>
<td class="text-left"><?php echo $order['date_added']; ?></td>
<td class="text-left"><?php echo $order['date_modified']; ?></td>
<td class="text-left"><?php echo $order['comment']; ?></td>
<td class="text-left"><?php echo $order['commission']; ?></td>
<td class="text-right"><a href="<?php echo $order['view']; ?>" data-toggle="tooltip" title="<?php echo $button_view; ?>" class="btn btn-info"><i class="fa fa-eye"></i></a> <a href="<?php echo $order['edit']; ?>" data-toggle="tooltip" title="<?php echo $button_edit; ?>" class="btn btn-primary"><i class="fa fa-pencil"></i></a></td>
</tr>
<?php } ?>
<?php } else { ?>
<tr>
<td class="text-center" colspan="8"><?php echo $text_no_results; ?></td>
</tr>
<?php } ?>
</tbody>
after refreshing mod cash even with deleting cash getting same error
Notice: Undefined property: Proxy::getTotalOrdersBySearchExtended in public_html/vqmod/vqcache/vq2-system_storage_modification_admin_controller_sale_order.php on line 28
Have no more ideas what the hell wrong and where, maybe someone have solved similar problem, really need help.
Source