Post by magzen » Thu Oct 01, 2015 5:55 pm

Hello,

I used a free module for having product images in orders for Opencart 1.5, iam trying to change some of the code to work in the Opencart 2.0.3.1, but dont work out well for me since iam not a developer.

i changed the

class="left to class="text-left
class="right to class="text-right

$totals to $total

if someone can help fix the code to work for Opencart 2

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
	<id>Image_in_Admin_Orders</id>
	<version>1.1</version>
	<vqmver>2.3.2</vqmver>
	<author>@Brunte27</author>
	<file name="admin/view/template/sale/order_info.tpl">
		<operation error="log">
			<search position="after"><![CDATA[<td class="text-left"><?php echo $column_product; ?></td>]]></search>
			<add><![CDATA[<td class="text-left"><?php echo "Image"; ?></td>]]></add>
		</operation>
		<operation error="log">
			<search position="replace"><![CDATA[<tbody>]]></search>
			<add><![CDATA[]]></add>
		</operation>
		<operation error="log">
			<search position="replace"><![CDATA[<?php foreach ($products as $product) { ?>]]></search>
			<add><![CDATA[          <?php foreach ($products as $product) { ?>
		  <?php $productinfo = $this->db->query("SELECT * FROM " . DB_PREFIX . "product WHERE product_id = '" . ($product['product_id'] . "'"));?>
          <tbody id="product-row<?php echo $product['order_product_id']; ?>">]]></add>
		</operation>
		<operation error="log">
			<search position="replace"><![CDATA[<td colspan="4" class="text-right"><?php echo $total['title']; ?>:</td>]]></search>
			<add><![CDATA[	 <td colspan="5" class="text-right"><?php echo $total['title']; ?>:</td>]]></add>
		</operation>
		<operation error="log">
			<search position="before"><![CDATA[<td class="text-left"><?php echo $product['model']; ?></td>]]></search>
			<add><![CDATA[			  <td>
			 <img src="<?php echo HTTPS_CATALOG."image/".$productinfo->row['image']; ?>" width="60" height="60" />
			 </td>]]></add>
		</operation>
	</file>
</modification>
Thanks

My Opencart Stores
http://www.crea-diem.com
http://www.bazaargadgets.com


Active Member

Posts

Joined
Tue Jun 05, 2012 7:04 pm


Post by grgr » Fri Oct 02, 2015 4:17 pm

Fixed: No. So here's a new one:

Code: Select all

<modification>
  <id>Admin Order Info Image</id>
  <version>1.1</version>
  <vqmver>2.3.2</vqmver>
  <author>grgr</author>
	<file name="admin/view/template/sale/order_info.tpl">
		<operation>
			<search position="before"><![CDATA[
<td class="text-left"><?php echo $column_product; ?></td>
			 ]]></search>
             <add><![CDATA[
			 <td class="text-left"><?php echo $column_image; ?></td>
			 ]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[
<td class="text-left"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
			 ]]></search>
             <add><![CDATA[
                  <td class="text-left"><img src="<?php echo $product['image']; ?>" /></td>
			 ]]></add>
		</operation>
	</file>
	
	<file name="admin/controller/sale/order.php">
		<operation>
			<search position="before"><![CDATA[
$data['column_product']
			 ]]></search>
             <add><![CDATA[
			$data['column_image'] = $this->language->get('column_image');
			 ]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[
$data['products'][] = array(
			 ]]></search>
             <add><![CDATA[			 
				$this->load->model('tool/image');
				$iquery = $this->db->query("SELECT image FROM " . DB_PREFIX . "product WHERE product_id = '" . $product['product_id'] . "'");
				
				if (is_file(DIR_IMAGE . $iquery->row['image'])) {
					$image = $this->model_tool_image->resize($iquery->row['image'], 40, 40);
				} else {
					$image = $this->model_tool_image->resize('no_image.png', 40, 40);
				}
			]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[
$data['products'][] = array(
			 ]]></search>
             <add><![CDATA[
					'image'    		   => $image,
			]]></add>
		</operation>
	</file>
	
	<file name="admin/language/english/sale/order.php">
		<operation>
			<search position="before"><![CDATA[
$_['column_weight']
			 ]]></search>
             <add><![CDATA[
$_['column_image']            = 'Image';
			 ]]></add>
		</operation>
	</file>
</modification>

Image Image Image Image Image Image Image Image


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by magzen » Fri Oct 02, 2015 8:35 pm

grgr wrote:Fixed: No. So here's a new one:

Code: Select all

<modification>
  <id>Admin Order Info Image</id>
  <version>1.1</version>
  <vqmver>2.3.2</vqmver>
  <author>grgr</author>
	<file name="admin/view/template/sale/order_info.tpl">
		<operation>
			<search position="before"><![CDATA[
<td class="text-left"><?php echo $column_product; ?></td>
			 ]]></search>
             <add><![CDATA[
			 <td class="text-left"><?php echo $column_image; ?></td>
			 ]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[
<td class="text-left"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
			 ]]></search>
             <add><![CDATA[
                  <td class="text-left"><img src="<?php echo $product['image']; ?>" /></td>
			 ]]></add>
		</operation>
	</file>
	
	<file name="admin/controller/sale/order.php">
		<operation>
			<search position="before"><![CDATA[
$data['column_product']
			 ]]></search>
             <add><![CDATA[
			$data['column_image'] = $this->language->get('column_image');
			 ]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[
$data['products'][] = array(
			 ]]></search>
             <add><![CDATA[			 
				$this->load->model('tool/image');
				$iquery = $this->db->query("SELECT image FROM " . DB_PREFIX . "product WHERE product_id = '" . $product['product_id'] . "'");
				
				if (is_file(DIR_IMAGE . $iquery->row['image'])) {
					$image = $this->model_tool_image->resize($iquery->row['image'], 40, 40);
				} else {
					$image = $this->model_tool_image->resize('no_image.png', 40, 40);
				}
			]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[
$data['products'][] = array(
			 ]]></search>
             <add><![CDATA[
					'image'    		   => $image,
			]]></add>
		</operation>
	</file>
	
	<file name="admin/language/english/sale/order.php">
		<operation>
			<search position="before"><![CDATA[
$_['column_weight']
			 ]]></search>
             <add><![CDATA[
$_['column_image']            = 'Image';
			 ]]></add>
		</operation>
	</file>
</modification>
Thanks alot appreciated :D , you should add it to your collection of modules, maybe someone else is interested in it to :) .

/magzen

My Opencart Stores
http://www.crea-diem.com
http://www.bazaargadgets.com


Active Member

Posts

Joined
Tue Jun 05, 2012 7:04 pm

Who is online

Users browsing this forum: No registered users and 47 guests