Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Pictures in orders - edit admin/orders.php


nabuhonodozor

Recommended Posts

Dear All,

 

I am looking for a way to display product pictures in orders - I was searching for this ability for a long time.

 

I have a shop with many small items with similar names but different designs.

 

When I see an order Ill have to go to phpmyadmin and check in a database for a precise product number and description.

It would be great if I could just see that particular product.

 

Ive tried to edit admin/orders.php

The code for showing list of products is located around line 229.

Ive put such a line there:

 

' <td class="dataTableContent" valign="top">' . tep_image(DIR_WS_CATALOG_IMAGES . $order->products[$i]['products_name'], 30, 30);

 

But I am complete PHP illiterate and of course it dont work. :huh:

 

Please help me add product pictures to clients orders. :rolleyes:

 

Best regards,

Piotr

Link to comment
Share on other sites

Since the object $order does by default not contain the image information, there are some further steps necessary to show them in the admin orders.

 

At first you got to extend the /admin/includes/classes/order.php the following way:

 

	  $index = 0;
  $orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
  while ($orders_products = tep_db_fetch_array($orders_products_query)) {
	$products_image_query = tep_db_query("SELECT products_image from ". TABLE_PRODUCTS ." WHERE products_id = '". (int)$orders_products['products_id']."'");
	$products_image_result = tep_db_fetch_array($products_image_query);
	if ($products_image_result['products_image'] == ''){
	  $products_image_result['products_image'] = 'no_image.jpg';
	  }
	$this->products[$index] = array('qty' => $orders_products['products_quantity'],
								'id' => $orders_products['products_id'],
									'name' => $orders_products['products_name'],
									'image' => $products_image_result['products_image'],
									'model' => $orders_products['products_model'],
									'tax' => $orders_products['products_tax'],
									'price' => $orders_products['products_price'],
									'final_price' => $orders_products['final_price']);

 

The you got to alter /admin/orders.php like:

 

	for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
  echo '		  <tr class="dataTableRow">' . "\n" .
	   '			<td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
	   '			<td class="dataTableContent" valign="top">' . $order->products[$i]['name'] .'<br>'. tep_image(DIR_WS_CATALOG_IMAGES . $order->products[$i]['image'],$order->products[$i]['name'],30 ,30);

 

Hope that helps.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...