Post by trait » Thu Apr 15, 2010 10:33 am

Dear All,
this time, I am writing about the orders products page show product images as the attachment file.

-------------------------------------------------------------------------------
new update file for opencart v1.5.1.1 7/8/2011
-------------------------------------------------------------------------------
there are 3 files need to be modified.
opencart_v1.4.x\admin\view\template\sale\order_form.tpl
opencart_v1.4.x\admin\controller\sale\order.php
opencart_v1.4.x\admin\model\sale\order.php

opencart_v1.4.x\admin\view\template\sale\order_form.tpl
find

Code: Select all

<div id="tab_product" class="vtabs_page">
bold text are the added

Code: Select all

      <div id="tab_product" class="vtabs_page">
        <table id="product" class="list">
          <thead>
            <tr>
              [b]<td class="left"> </td>[/b]
              <td class="left"><?php echo $column_product; ?></td>
              <td class="left"><?php echo $column_model; ?></td>
              <td class="right"><?php echo $column_quantity; ?></td>
              <td class="right"><?php echo $column_price; ?></td>
              <td class="right" width="1"><?php echo $column_total; ?></td>
            </tr>
          </thead>
          <?php foreach ($products as $product) { ?>
          <tbody>
            <tr>
	      [b]<td width="80"><img src="<?php echo $product['thumb']; ?>" /></td>[/b]
              <td class="left"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
                <?php foreach ($product['option'] as $option) { ?>
                <br />
                &nbsp;<small> - <?php echo $option['name']; ?> <?php echo $option['value']; ?></small>
                <?php } ?></td>
              <td class="left"><?php echo $product['model']; ?></td>
              <td class="right"><?php echo $product['quantity']; ?></td>
              <td class="right"><?php echo $product['price']; ?></td>
              <td class="right"><?php echo $product['total']; ?></td>
            </tr>
          </tbody>
          <?php } ?>
look, I just add the 'thumb' to the $product array, so the next
Modify opencart_v1.4.x\admin\controller\sale\order.php
find

Code: Select all

$this->load->model('sale/customer_group');
add a new line

Code: Select all

$this->load->model('tool/image');


find

Code: Select all

$this->data['products'][] = array(
before this, add

Code: Select all

if ($product['image']) {
                    $image = $product['image'];
                } else {
                    $image = 'no_image.jpg';
                }
and then after this

add

Code: Select all

					'thumb'   => $this->model_tool_image->resize($image, $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height')),
					
between

Code: Select all

$this->data['products'][] = array(
and

Code: Select all

'name'     => $product['name'],
the last, need to modify the opencart_v1.4.x\admin\model\sale\order.php
modify

Code: Select all

public function getOrderProducts($order_id) {
function
to

Code: Select all

public function getOrderProducts($order_id) {
		$query = $this->db->query("SELECT op.*,p.image FROM " . DB_PREFIX . "order_product op LEFT JOIN " . DB_PREFIX . "product p ON op.product_id=p.product_id WHERE order_id = '" . (int)$order_id . "'");
	
		return $query->rows;
	}
Ok, save these files, and you'll see the products details with images on the orders page.

Good day,
Ady
http://www.trait-tech.com

Attachments

untitled.jpg

untitled.jpg (141.5 KiB) Viewed 1860 times

modify your code just like this

Last edited by trait on Sun Aug 07, 2011 6:34 pm, edited 2 times in total.

TRAIT-TECH.COM Wholesale electronics with factory price, dropshipper from China


User avatar
New member

Posts

Joined
Sat Apr 03, 2010 10:38 am


Post by dramony » Fri Apr 16, 2010 9:19 pm

How about on OC 1.3.2?

Thank you!

User avatar
Active Member

Posts

Joined
Sat Oct 24, 2009 12:34 pm

Post by trait » Fri Apr 16, 2010 9:42 pm

Sorrt, I don't test it.

I only use OpenCart from the 1.4.6

TRAIT-TECH.COM Wholesale electronics with factory price, dropshipper from China


User avatar
New member

Posts

Joined
Sat Apr 03, 2010 10:38 am


Post by op_user » Tue Jul 27, 2010 4:08 pm

this relates to my request here: http://forum.opencart.com/viewtopic.php?f=21&t=17752

Any chance you can help with this along with adding the category and sub category next to the product name?

I am waiting for Open Cart 3.0


New member

Posts

Joined
Thu Dec 10, 2009 9:45 am

Post by felizone » Thu May 05, 2011 12:18 am

Dear All,

I follow this tutorial , but not success at all.
Anyone can help?

error message:

Notice: Undefined variable: image in C:\AppServ\www\upload1\admin\controller\sale\order.php on line 587".

Thanksm
Feliz

New member

Posts

Joined
Thu Apr 08, 2010 3:28 pm

Post by allenshea » Wed May 11, 2011 7:15 pm

felizone wrote:Dear All,

I follow this tutorial , but not success at all.
Anyone can help?

error message:

Notice: Undefined variable: image in C:\AppServ\www\upload1\admin\controller\sale\order.php on line 587".

Thanksm
Feliz

Sounds this doesn't work, I also had problem in admin\controller\sale\order.php

I know nothing about PHP and SQL, but I still try my best to understand it.


Active Member

Posts

Joined
Mon Dec 14, 2009 10:01 pm

Post by fgrace » Mon Jun 20, 2011 10:12 pm

Hi

I also followed this tutorial line by line and get an error message.
I would be really grateful for some help to display the product image in the order details.

regards
FG

New member

Posts

Joined
Sat May 01, 2010 6:22 am

Post by trait » Tue Aug 02, 2011 7:48 pm

Code: Select all

foreach ($products as $product) {
				$option_data = array();
				
				$options = $this->model_sale_order->getOrderOptions($this->request->get['order_id'], $product['order_product_id']);
	
				foreach ($options as $option) {
					$option_data[] = array(
						'name'  => $option['name'],
						'value' => $option['value']
					);
				}
                if ($product['image']) {
                    $image = $product['image'];
                } else {
                    $image = 'no_image.jpg';
                }
			  
				$this->data['products'][] = array(
					'thumb'   => $this->model_tool_image->resize($image, $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height')),
					'name'     => $product['name'],
					'model'    => $product['model'],
					'option'   => $option_data,
					'quantity' => $product['quantity'],
					'price'    => $this->currency->format($product['price'], $order_info['currency'], $order_info['value']),
					'total'    => $this->currency->format($product['total'], $order_info['currency'], $order_info['value']),
					'href'     => HTTPS_SERVER . 'index.php?route=catalog/product/update&product_id=' . $product['product_id']
				);
			}
Please follow this example code at opencart\admin\controller\sale\order.php to make $image work

Sorry to make so many troubles

Ady

TRAIT-TECH.COM Wholesale electronics with factory price, dropshipper from China


User avatar
New member

Posts

Joined
Sat Apr 03, 2010 10:38 am


Post by yiyinlah » Tue Aug 09, 2011 7:54 pm

Hello!

Can you write a complete instructions for

Version 1.4.9.5 ?

Please!

Thank you very much!

I'm using Opencart 1.5.4.1 & vQmod 2.3.2.


User avatar
Active Member

Posts

Joined
Thu Sep 23, 2010 1:19 pm
Location - Singapore
Who is online

Users browsing this forum: No registered users and 11 guests