Post by mash0028 » Thu Aug 18, 2016 5:28 pm

Hello, hoping someone can help me.


I have install this extension where In customer can Upload their Profile pictures

I have added another column in oc_Customer (databade) for AVATAR.

I want to show that photo to my Order list and other part of admin page.


File Name: admin/model/sale/order.php

I add New PUBLIC FUNCTION TO GET CUSTOMER _ID in ORDER_ID then Customer to Avatar Picture.
BUT SADLY NOT WORKING

Code: Select all

	public function getQVAVATAR($order_id)
		{
	   
		$this->load->model('sale/order');
		$this->load->model('sale/customer'); 


		$customer = $this->model_sale_order->getOrder($order_id);

		$customer_info = $this->model_sale_customer->getCustomer($customer['customer_id']);	

            if ($customer_info) {
               if ($customer_info['avatar']) {
                  $avatar = $this->model_tool_image->resize($customer_info['avatar'], 125, 125);
               } else {
                  $avatar = false;
               }
            }
			return $avatar;
		             }

Then adding it in controller file.

File: admin/controller/sale/order.php



$order_total = $this->model_sale_order->getTotalOrders($filter_data);

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

foreach ($results as $result) {
$data['orders'][] = array(
'order_id' => $result['order_id'],



'avatar'=> $this->model_sale_order->getQVAVATAR($result['order_id']),





'customer' => $result['customer'],
'status' => $result['status'],
'order_status_id' => $result['order_status_id'],
'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'])),
'shipping_code' => $result['shipping_code'],
'view' => $this->url->link('sale/order/info', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'] . $url, 'SSL'),
'edit' => $this->url->link('sale/order/edit', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'] . $url, 'SSL'),
'delete' => $this->url->link('sale/order/delete', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'] . $url, 'SSL')
);
}



Then add the in

FILE NAME: /admin/view/template/sale/order_list.tpl

<div><img src="<?php echo $order['avatar']; ?>"></div>

on the place I want it to show.


But I think I have a wrong coding in my MODEL FILE


I wish someone has know how to set codes properly.

Thank you so much

New member

Posts

Joined
Fri Jul 24, 2015 3:36 pm

Post by mash0028 » Thu Aug 18, 2016 5:38 pm

avatar.png

avatar.png (67 KiB) Viewed 972 times

I want to show AVATAR in Order list where Name of customer is show.

Thanks for your Big Help

New member

Posts

Joined
Fri Jul 24, 2015 3:36 pm

Post by mash0028 » Wed Aug 24, 2016 4:37 pm

I figure it out


just modify the model file


public function getAVATAR($order_id)
{

$this->load->model('sale/order');
$this->load->model('sale/customer');

$order_info = $this->model_sale_order->getOrder($order_id);

if (isset($order_info)) {
$customer = $order_info['customer_id'];
}

$customer_info = $this->model_sale_customer->getCustomer($customer);

if ($customer_info) {
if ($customer_info['avatar']) {
$avatar = $customer_info['avatar'];
} else {
$avatar = false;
}
}
return $avatar;
}




the add this to your controller file same position from my previous post.

'avatar' => $this->model_sale_order->getAvatar($result['order_id']),



Then add the in

FILE NAME: /admin/view/template/sale/order_list.tpl

<div><img src="<?php echo $order['avatar']; ?>"></div>

on the place I want it to show.

New member

Posts

Joined
Fri Jul 24, 2015 3:36 pm
Who is online

Users browsing this forum: No registered users and 6 guests