Post by edseljay » Mon Aug 22, 2016 4:08 pm

Good day everyone
im using open cart 2.2 in my backend page "admin/index.php?route=common/dashboard" theres a table of recent_orders i also want to display the shipping_method(see attached pic).

i think this 2 file below that i needed to edit to get what im trying to do..

heres the recent.php] : came from admin/controler/dashboard

<?php
class ControllerDashboardRecent extends Controller {
public function index() {
$this->load->language('dashboard/recent');

$data['heading_title'] = $this->language->get('heading_title');

$data['text_no_results'] = $this->language->get('text_no_results');

$data['column_order_id'] = $this->language->get('column_order_id');
$data['column_customer'] = $this->language->get('column_customer');
$data['column_status'] = $this->language->get('column_status');
$data['column_date_added'] = $this->language->get('column_date_added');
$data['column_total'] = $this->language->get('column_total');
$data['column_action'] = $this->language->get('column_action');

$data['button_view'] = $this->language->get('button_view');

$data['token'] = $this->session->data['token'];

// Last 5 Orders
$data['orders'] = array();

$filter_data = array(
'sort' => 'o.date_added',
'order' => 'DESC',
'start' => 0,
'limit' => 5
);

$results = $this->model_sale_order->getOrders($filter_data);

foreach ($results as $result) {
$data['orders'][] = array(
'order_id' => $result['order_id'],
'customer' => $result['customer'],
'status' => $result['order_status'],
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'total' => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
'view' => $this->url->link('sale/order/info', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'], true),
);
}

return $this->load->view('dashboard/recent', $data);
}
}


///////////////////////////////////////////////////////////////////////////////////////

Attachments

1.jpg

here its - 1.jpg (26.08 KiB) Viewed 2568 times

Last edited by edseljay on Mon Aug 22, 2016 4:22 pm, edited 1 time in total.

New member

Posts

Joined
Tue Jul 12, 2016 11:25 am

Post by edseljay » Mon Aug 22, 2016 4:08 pm

heres the order.php : came from admin/model/sale

<?php
class ModelSaleOrder extends Model {
public function getOrder($order_id) {
$order_query = $this->db->query("SELECT *, (SELECT CONCAT(c.firstname, ' ', c.lastname) FROM " . DB_PREFIX . "customer c WHERE c.customer_id = o.customer_id) 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 FROM `" . DB_PREFIX . "order` o WHERE o.order_id = '" . (int)$order_id . "'");

if ($order_query->num_rows) {
$country_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "country` WHERE country_id = '" . (int)$order_query->row['payment_country_id'] . "'");

if ($country_query->num_rows) {
$payment_iso_code_2 = $country_query->row['iso_code_2'];
$payment_iso_code_3 = $country_query->row['iso_code_3'];
} else {
$payment_iso_code_2 = '';
$payment_iso_code_3 = '';
}

$zone_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "zone` WHERE zone_id = '" . (int)$order_query->row['payment_zone_id'] . "'");

if ($zone_query->num_rows) {
$payment_zone_code = $zone_query->row['code'];
} else {
$payment_zone_code = '';
}

$country_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "country` WHERE country_id = '" . (int)$order_query->row['shipping_country_id'] . "'");

if ($country_query->num_rows) {
$shipping_iso_code_2 = $country_query->row['iso_code_2'];
$shipping_iso_code_3 = $country_query->row['iso_code_3'];
} else {
$shipping_iso_code_2 = '';
$shipping_iso_code_3 = '';
}

$zone_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "zone` WHERE zone_id = '" . (int)$order_query->row['shipping_zone_id'] . "'");

if ($zone_query->num_rows) {
$shipping_zone_code = $zone_query->row['code'];
} else {
$shipping_zone_code = '';
}

$reward = 0;

$order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");

foreach ($order_product_query->rows as $product) {
$reward += $product['reward'];
}

if ($order_query->row['affiliate_id']) {
$affiliate_id = $order_query->row['affiliate_id'];
} else {
$affiliate_id = 0;
}

$this->load->model('marketing/affiliate');

$affiliate_info = $this->model_marketing_affiliate->getAffiliate($affiliate_id);

if ($affiliate_info) {
$affiliate_firstname = $affiliate_info['firstname'];
$affiliate_lastname = $affiliate_info['lastname'];
} else {
$affiliate_firstname = '';
$affiliate_lastname = '';
}

$this->load->model('localisation/language');

$language_info = $this->model_localisation_language->getLanguage($order_query->row['language_id']);

if ($language_info) {
$language_code = $language_info['code'];
} else {
$language_code = $this->config->get('config_language');
}

return array(
'order_id' => $order_query->row['order_id'],
'invoice_no' => $order_query->row['invoice_no'],
'invoice_prefix' => $order_query->row['invoice_prefix'],
'store_id' => $order_query->row['store_id'],
'store_name' => $order_query->row['store_name'],
'store_url' => $order_query->row['store_url'],
'customer_id' => $order_query->row['customer_id'],
'customer' => $order_query->row['customer'],
'customer_group_id' => $order_query->row['customer_group_id'],
'firstname' => $order_query->row['firstname'],
'lastname' => $order_query->row['lastname'],
'email' => $order_query->row['email'],
'telephone' => $order_query->row['telephone'],
'fax' => $order_query->row['fax'],
'custom_field' => json_decode($order_query->row['custom_field'], true),
'payment_firstname' => $order_query->row['payment_firstname'],
'payment_lastname' => $order_query->row['payment_lastname'],
'payment_company' => $order_query->row['payment_company'],
'payment_address_1' => $order_query->row['payment_address_1'],
'payment_address_2' => $order_query->row['payment_address_2'],
'payment_postcode' => $order_query->row['payment_postcode'],
'payment_city' => $order_query->row['payment_city'],
'payment_zone_id' => $order_query->row['payment_zone_id'],
'payment_zone' => $order_query->row['payment_zone'],
'payment_zone_code' => $payment_zone_code,
'payment_country_id' => $order_query->row['payment_country_id'],
'payment_country' => $order_query->row['payment_country'],
'payment_iso_code_2' => $payment_iso_code_2,
'payment_iso_code_3' => $payment_iso_code_3,
'payment_address_format' => $order_query->row['payment_address_format'],
'payment_custom_field' => json_decode($order_query->row['payment_custom_field'], true),
'payment_method' => $order_query->row['payment_method'],
'payment_code' => $order_query->row['payment_code'],
'shipping_firstname' => $order_query->row['shipping_firstname'],
'shipping_lastname' => $order_query->row['shipping_lastname'],
'shipping_company' => $order_query->row['shipping_company'],
'shipping_address_1' => $order_query->row['shipping_address_1'],
'shipping_address_2' => $order_query->row['shipping_address_2'],
'shipping_postcode' => $order_query->row['shipping_postcode'],
'shipping_city' => $order_query->row['shipping_city'],
'shipping_zone_id' => $order_query->row['shipping_zone_id'],
'shipping_zone' => $order_query->row['shipping_zone'],
'shipping_zone_code' => $shipping_zone_code,
'shipping_country_id' => $order_query->row['shipping_country_id'],
'shipping_country' => $order_query->row['shipping_country'],
'shipping_iso_code_2' => $shipping_iso_code_2,
'shipping_iso_code_3' => $shipping_iso_code_3,
'shipping_address_format' => $order_query->row['shipping_address_format'],
'shipping_custom_field' => json_decode($order_query->row['shipping_custom_field'], true),
'shipping_method' => $order_query->row['shipping_method'],
'shipping_code' => $order_query->row['shipping_code'],
'comment' => $order_query->row['comment'],
'total' => $order_query->row['total'],
'reward' => $reward,
'order_status_id' => $order_query->row['order_status_id'],
'order_status' => $order_query->row['order_status'],
'affiliate_id' => $order_query->row['affiliate_id'],
'affiliate_firstname' => $affiliate_firstname,
'affiliate_lastname' => $affiliate_lastname,
'commission' => $order_query->row['commission'],
'language_id' => $order_query->row['language_id'],
'language_code' => $language_code,
'currency_id' => $order_query->row['currency_id'],
'currency_code' => $order_query->row['currency_code'],
'currency_value' => $order_query->row['currency_value'],
'ip' => $order_query->row['ip'],
'forwarded_ip' => $order_query->row['forwarded_ip'],
'user_agent' => $order_query->row['user_agent'],
'accept_language' => $order_query->row['accept_language'],
'date_added' => $order_query->row['date_added'],
'date_modified' => $order_query->row['date_modified']
);
} else {
return;
}
}

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 FROM `" . DB_PREFIX . "order` o";

if (isset($data['filter_order_status'])) {
$implode = array();

$order_statuses = explode(',', $data['filter_order_status']);

foreach ($order_statuses as $order_status_id) {
$implode[] = "o.order_status_id = '" . (int)$order_status_id . "'";
}

if ($implode) {
$sql .= " WHERE (" . implode(" OR ", $implode) . ")";
}
} else {
$sql .= " WHERE o.order_status_id > '0'";
}

if (!empty($data['filter_order_id'])) {
$sql .= " AND o.order_id = '" . (int)$data['filter_order_id'] . "'";
}

if (!empty($data['filter_customer'])) {
$sql .= " AND CONCAT(o.firstname, ' ', o.lastname) LIKE '%" . $this->db->escape($data['filter_customer']) . "%'";
}

if (!empty($data['filter_date_added'])) {
$sql .= " AND DATE(o.date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
}

if (!empty($data['filter_date_modified'])) {
$sql .= " AND DATE(o.date_modified) = DATE('" . $this->db->escape($data['filter_date_modified']) . "')";
}

if (!empty($data['filter_total'])) {
$sql .= " AND o.total = '" . (float)$data['filter_total'] . "'";
}

$sort_data = array(
'o.order_id',
'customer',
'status',
'o.date_added',
'o.date_modified',
'o.total'
);

if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
$sql .= " ORDER BY " . $data['sort'];
} else {
$sql .= " ORDER BY o.order_id";
}

if (isset($data['order']) && ($data['order'] == 'DESC')) {
$sql .= " DESC";
} else {
$sql .= " ASC";
}

if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
}

if ($data['limit'] < 1) {
$data['limit'] = 20;
}

$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
}

$query = $this->db->query($sql);

return $query->rows;
}

public function getOrderProducts($order_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");

return $query->rows;
}

public function getOrderOptions($order_id, $order_product_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$order_product_id . "'");

return $query->rows;
}

public function getOrderVouchers($order_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_voucher WHERE order_id = '" . (int)$order_id . "'");

return $query->rows;
}

public function getOrderVoucherByVoucherId($voucher_id) {
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_voucher` WHERE voucher_id = '" . (int)$voucher_id . "'");

return $query->row;
}

public function getOrderTotals($order_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_total WHERE order_id = '" . (int)$order_id . "' ORDER BY sort_order");

return $query->rows;
}

public function getTotalOrders($data = array()) {
$sql = "SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order`";

if (isset($data['filter_order_status'])) {
$implode = array();

$order_statuses = explode(',', $data['filter_order_status']);

foreach ($order_statuses as $order_status_id) {
$implode[] = "order_status_id = '" . (int)$order_status_id . "'";
}

if ($implode) {
$sql .= " WHERE (" . implode(" OR ", $implode) . ")";
}
} else {
$sql .= " WHERE order_status_id > '0'";
}

if (!empty($data['filter_order_id'])) {
$sql .= " AND order_id = '" . (int)$data['filter_order_id'] . "'";
}

if (!empty($data['filter_customer'])) {
$sql .= " AND CONCAT(firstname, ' ', lastname) LIKE '%" . $this->db->escape($data['filter_customer']) . "%'";
}

if (!empty($data['filter_date_added'])) {
$sql .= " AND DATE(date_added) = DATE('" . $this->db->escape($data['filter_date_added']) . "')";
}

if (!empty($data['filter_date_modified'])) {
$sql .= " AND DATE(date_modified) = DATE('" . $this->db->escape($data['filter_date_modified']) . "')";
}

if (!empty($data['filter_total'])) {
$sql .= " AND total = '" . (float)$data['filter_total'] . "'";
}

$query = $this->db->query($sql);

return $query->row['total'];
}

public function getTotalOrdersByStoreId($store_id) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE store_id = '" . (int)$store_id . "'");

return $query->row['total'];
}

public function getTotalOrdersByOrderStatusId($order_status_id) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE order_status_id = '" . (int)$order_status_id . "' AND order_status_id > '0'");

return $query->row['total'];
}

public function getTotalOrdersByProcessingStatus() {
$implode = array();

$order_statuses = $this->config->get('config_processing_status');

foreach ($order_statuses as $order_status_id) {
$implode[] = "order_status_id = '" . (int)$order_status_id . "'";
}

if ($implode) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE " . implode(" OR ", $implode));

return $query->row['total'];
} else {
return 0;
}
}

public function getTotalOrdersByCompleteStatus() {
$implode = array();

$order_statuses = $this->config->get('config_complete_status');

foreach ($order_statuses as $order_status_id) {
$implode[] = "order_status_id = '" . (int)$order_status_id . "'";
}

if ($implode) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE " . implode(" OR ", $implode) . "");

return $query->row['total'];
} else {
return 0;
}
}

public function getTotalOrdersByLanguageId($language_id) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE language_id = '" . (int)$language_id . "' AND order_status_id > '0'");

return $query->row['total'];
}

public function getTotalOrdersByCurrencyId($currency_id) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order` WHERE currency_id = '" . (int)$currency_id . "' AND order_status_id > '0'");

return $query->row['total'];
}

public function createInvoiceNo($order_id) {
$order_info = $this->getOrder($order_id);

if ($order_info && !$order_info['invoice_no']) {
$query = $this->db->query("SELECT MAX(invoice_no) AS invoice_no FROM `" . DB_PREFIX . "order` WHERE invoice_prefix = '" . $this->db->escape($order_info['invoice_prefix']) . "'");

if ($query->row['invoice_no']) {
$invoice_no = $query->row['invoice_no'] + 1;
} else {
$invoice_no = 1;
}

$this->db->query("UPDATE `" . DB_PREFIX . "order` SET invoice_no = '" . (int)$invoice_no . "', invoice_prefix = '" . $this->db->escape($order_info['invoice_prefix']) . "' WHERE order_id = '" . (int)$order_id . "'");

return $order_info['invoice_prefix'] . $invoice_no;
}
}

public function getOrderHistories($order_id, $start = 0, $limit = 10) {
if ($start < 0) {
$start = 0;
}

if ($limit < 1) {
$limit = 10;
}

$query = $this->db->query("SELECT oh.date_added, os.name AS status, oh.comment, 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 DESC LIMIT " . (int)$start . "," . (int)$limit);

return $query->rows;
}

public function getTotalOrderHistories($order_id) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "order_history WHERE order_id = '" . (int)$order_id . "'");

return $query->row['total'];
}

public function getTotalOrderHistoriesByOrderStatusId($order_status_id) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "order_history WHERE order_status_id = '" . (int)$order_status_id . "'");

return $query->row['total'];
}

public function getEmailsByProductsOrdered($products, $start, $end) {
$implode = array();

foreach ($products as $product_id) {
$implode[] = "op.product_id = '" . (int)$product_id . "'";
}

$query = $this->db->query("SELECT DISTINCT email FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_product op ON (o.order_id = op.order_id) WHERE (" . implode(" OR ", $implode) . ") AND o.order_status_id <> '0' LIMIT " . (int)$start . "," . (int)$end);

return $query->rows;
}

public function getTotalEmailsByProductsOrdered($products) {
$implode = array();

foreach ($products as $product_id) {
$implode[] = "op.product_id = '" . (int)$product_id . "'";
}

$query = $this->db->query("SELECT DISTINCT email FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_product op ON (o.order_id = op.order_id) WHERE (" . implode(" OR ", $implode) . ") AND o.order_status_id <> '0'");

return $query->row['total'];
}
}

/////////////////////////////////////////////////////////////////////////////////////
i hope someone could help me...

New member

Posts

Joined
Tue Jul 12, 2016 11:25 am

Post by edseljay » Mon Aug 22, 2016 4:16 pm

in my recent.php
im trying to add " 'shipping_method' => $result['shipping_method'], " inside the foreach but after i refresh the page it says undefined so review the code again then i'vee seen that the variable $results has get the data from the function getOrders so i search my files then find the order.php in model where i found the getOrders function but the problem is on this point im dont have any idea what to do next.... i hope someone could help me...

New member

Posts

Joined
Tue Jul 12, 2016 11:25 am

Post by fido-x » Mon Aug 22, 2016 10:57 pm

Actually, there are 3 files you should edit - the controller, template and language files.

In the language file (admin/language/en-gb/dashboard/recent.php), insert:

Code: Select all

$_['column_shipping_method'] = 'Shipping Method';
In the controller (admin/controller/dashboard/recent.php, insert:

Code: Select all

$data['column_shipping_method'] = $this->language->get('column_shipping_method');
In the same file, find:

Code: Select all

$data['orders'][] = array(
	'order_id'   => $result['order_id'],
	'customer'   => $result['customer'],
	'status'     => $result['order_status'],
	'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
	'total'      => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
	'view'       => $this->url->link('sale/order/info', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'], true),
);
and add in the shipping method, as follows:

Code: Select all

$data['orders'][] = array(
	'order_id'   => $result['order_id'],
	'customer'   => $result['customer'],
	'status'     => $result['order_status'],
	'shipping_method' => $result['shipping_method'],
	'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
	'total'      => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
	'view'       => $this->url->link('sale/order/info', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'], true),
);
Finally, in the template file (admin/view/template/dashboard/recent.tpl), add the column heading:

Code: Select all

<td><?php echo $column_shipping_method; ?></td>
after:

Code: Select all

<td><?php echo $column_status; ?></td>
Then, add:

Code: Select all

<td><?php echo $order['shipping_method']; ?></td>
after:

Code: Select all

<td><?php echo $order['status']; ?></td>
Then, since you are adding an extra column, change:

Code: Select all

<td class="text-center" colspan="6"><?php echo $text_no_results; ?></td>
to:

Code: Select all

<td class="text-center" colspan="7"><?php echo $text_no_results; ?></td>

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by edseljay » Tue Aug 23, 2016 7:26 am

Notice: Undefined index: shipping_method in C:\wamp64\www\sample\admin\controller\dashboard\recent.php on line 39Notice: Undefined index: shipping_method in C:\wamp64\www\sample\admin\controller\dashboard\recent.php on line 39

fido-x still says undefined? did i do something wrong? i follow everything you said... thanks..

New member

Posts

Joined
Tue Jul 12, 2016 11:25 am

Post by fido-x » Tue Aug 23, 2016 10:57 am

It appears that the getOrders() function in the model doesn't retrieve the shipping method, which is causing the error. I've fixed this up and put all the above into the attached vQmod .xml file.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by edseljay » Tue Aug 23, 2016 1:16 pm

do i need to upload that xml throught vqmod manager? thanks alot in your help fido-x

New member

Posts

Joined
Tue Jul 12, 2016 11:25 am

Post by fido-x » Tue Aug 23, 2016 1:32 pm

edseljay wrote:do i need to upload that xml throught vqmod manager?
If the vQmod manager has an upload function, then I suppose you could. It's not a question I can answer, as I've never used the vQmod manager, so I don't know if it has an upload function.

Personally, I'd upload via FTP and place it in the vqmod/xml folder.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by edseljay » Tue Aug 23, 2016 3:24 pm

hi fido-x thanks for the xml file you gave you dont know how much im thankful for that, i did everything you told me and everything works now thanks to you.. but i have another problem because there are 2 more .tpl that i need to display that shipping_method.. so i try to add code to the language and controller equivalent to the instruction you told me then i copy and make a new one the .xml file you gave me and rename it then edit everything inside of it base on the language,controller, & template of those 2 .tpl i need but still no luck.. (please see the two image where i want to display the shipping_method one is on the admin side again and one is customer view) thank you

Attachments

2.jpg

2.jpg (78.92 KiB) Viewed 2513 times

1.jpg

1.jpg (58.87 KiB) Viewed 2513 times


New member

Posts

Joined
Tue Jul 12, 2016 11:25 am

Post by edseljay » Tue Aug 23, 2016 4:06 pm

Hi fido-x the view in the admin side is working now i only 1 have left it is in the customer side when they click the order history..

New member

Posts

Joined
Tue Jul 12, 2016 11:25 am

Post by fido-x » Tue Aug 23, 2016 6:23 pm

I've updated the vQmod .xml (see attached) to include the order list in the admin and in the customer's account.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by edseljay » Tue Aug 30, 2016 10:31 am

hi fido thank you everything works fine now

New member

Posts

Joined
Tue Jul 12, 2016 11:25 am

Post by kanchi2012 » Mon Oct 17, 2016 4:29 pm

is this working in 1.5.6 @fido-x

Newbie

Posts

Joined
Mon Oct 17, 2016 4:28 pm

Post by fido-x » Tue Oct 18, 2016 7:01 am

kanchi2012 wrote:is this working in 1.5.6 @fido-x
No. This mod is for OpenCart 2.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by kanchi2012 » Tue Oct 18, 2016 9:21 am

i see too bad having a bad time trying to work things out been searching an answer since yesterday... i also try to edit my contoller as same as the edseljay problem i got undefined variable i think i also need to do some editing in the module.. by the thank you for your answer i'll try to find another solution :D

Newbie

Posts

Joined
Mon Oct 17, 2016 4:28 pm

Post by fido-x » Tue Oct 18, 2016 10:29 am

Give this a try. I've backported the above vQmod .xml for use with OpenCart 1.5.6.x. Place it in your vqmod/xml folder.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by edseljay » Thu Oct 20, 2016 11:47 am

i tried solving your problem in opencart 1.5 and it works for me

go to admin/model/sale/order.php
then find this "public function getOrders($data = array()) {"
and below that line find this "AS status, o.total, " then add the "o.shipping_method, "

then just few line after there find the

$sort_data = array(
'o.order_id',
'customer',
'status',
'o.date_added',
'o.date_modified',
'o.total'
);

and then just add the 'o.shipping_method',
just like this:

$sort_data = array(
'o.order_id',
'customer',
'status',
'shipping_method',
'o.date_added',
'o.date_modified',
'o.total'
);

then next is go to your admin/controller/common/home.php
then find this:

$this->data['orders'][] = array(
'order_id' => $result['order_id'],
'customer' => $result['customer'],
'status' => $result['status'],
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'total' => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
'action' => $action
);

and then just add the 'shipping_method' => $result['shipping_method'],
just like this:

$this->data['orders'][] = array(
'order_id' => $result['order_id'],
'customer' => $result['customer'],
'status' => $result['status'],
'shipping_method' => $result['shipping_method'],
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
'total' => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
'action' => $action
);


then your done, in your backend if you used the the shipping_method variable to show the shipping_method used by the customer the variable will not be undefined anymore.. Thanks you fido-x it able to give me clue base on the xml file for opencart 2.2 that he gave me before...

New member

Posts

Joined
Tue Jul 12, 2016 11:25 am

Post by kanchi2012 » Tue Oct 25, 2016 8:20 am

thank you edseljay i recently tried your code and it worked however i think i will also try the method given by fido-x, thanks to both of you my friend...

Newbie

Posts

Joined
Mon Oct 17, 2016 4:28 pm
Who is online

Users browsing this forum: No registered users and 32 guests