Product image on order history
Posted: Sun Oct 08, 2017 8:52 am
Hi my friends. Sorry my english little.
This code is opencart xml for show product image on order history.
I downloaded extensions on opencart.com
i am studying convert to twig.
But i don't convert any codes.
<?php foreach ($vouchers as $voucher) { ?>
<?php $int=0;foreach ($products as $product) {$int = $int + (int)$product['quantity']; ?> <?php } ?>
please help to convert twig code. thx.
This code is opencart xml for show product image on order history.
I downloaded extensions on opencart.com
i am studying convert to twig.
But i don't convert any codes.
<?php foreach ($vouchers as $voucher) { ?>
<?php $int=0;foreach ($products as $product) {$int = $int + (int)$product['quantity']; ?> <?php } ?>
please help to convert twig code. thx.
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<modification>
<id>Admin Image in Order and Invoice and Quantity Total</id>
<version>OC 2.3.0.2</version>
<vqmver>2.6.1</vqmver>
<author>Passko</author>
<file name="admin/controller/sale/order.php">
<operation>
<search position="before"><![CDATA[
$data['column_product']
]]></search>
<add><![CDATA[
$data['column_product_image'] = $this->language->get('column_product_image');
]]></add>
</operation>
<!-- order_info starts -->
<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'], 100, 100);
} 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>
<!-- order_info ends -->
<!-- order_invoice starts -->
<operation>
<search position="before" index="1"><![CDATA[
$product_data[] = 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'], 100, 100);
} else {
$image = $this->model_tool_image->resize('no_image.png', 40, 40);
}
]]></add>
</operation>
<operation>
<search position="after" index="1"><![CDATA[
$product_data[] = array(
]]></search>
<add><![CDATA[
'image' => $image,
]]></add>
</operation>
<!-- order_invoice ends -->
</file>
<!-- rename english language folder if necessary-->
<file name="admin/language/en-gb/sale/order.php">
<operation>
<search position="before"><![CDATA[
$_['column_weight']
]]></search>
<add><![CDATA[
$_['column_product_image'] = 'Product Image';
]]></add>
</operation>
</file>
<file name="admin/view/template/sale/order_info.tpl">
<!-- images in orders starts -->
<operation>
<search position="before"><![CDATA[
<td class="text-left">{{ column_product }}</td>
]]></search>
<add><![CDATA[
<td class="text-left">{{ column_product_image }}</td>
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
<td class="text-left"><a href="{{ product.href }}">{{ product.name }}</a>
]]></search>
<add><![CDATA[
<td class="text-left"><img src="{{ product.image }}" /></td>
]]></add>
</operation>
<!-- images in orders ends -->
<!-- quantity in orders starts -->
<operation>
<search position="before"><![CDATA[
<?php foreach ($vouchers as $voucher) { ?>
]]></search>
<add><![CDATA[
<tr id="add_row">
<?php $int=0;foreach ($products as $product) {$int = $int + (int)$product['quantity']; ?> <?php } ?>
<td></td>
<td></td>
<td></td>
<td class="text-right"><b>{{ int }}</b> Pcs</td>
<td></td>
<td></td>
</tr>
]]></add>
</operation>
<!-- quantity in orders ends -->
<!-- fix columns starts -->
<operation>
<search position="replace"><![CDATA[
<td colspan="4" class="text-right">
]]></search>
<add><![CDATA[
<td colspan="5" class="text-right">
]]></add>
</operation>
<!-- fix columns ends -->
</file>
<file name="admin/view/template/sale/order_invoice.tpl">
<!-- images in invoice starts -->
<operation>
<search position="before"><![CDATA[
<td><b>{{ column_product }}</b></td>
]]></search>
<add><![CDATA[
<td><b>{{ column_product_image }}</b></td>
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
<td>{{ product.name }}
]]></search>
<add><![CDATA[
<td><img src="{{ product.image }}" /></td>
]]></add>
</operation>
<!-- images in invoice ends -->
<!-- quantity in orders starts -->
<operation>
<search position="before"><![CDATA[
<?php foreach ($order['voucher'] as $voucher) { ?>
]]></search>
<add><![CDATA[
<tr id="add_row">
<?php $int=0;foreach ($order['product'] as $product) {$int = $int + (int)$product['quantity']; ?> <?php } ?>
<td></td>
<td></td>
<td></td>
<td class="text-right"><b>{{ int }}</b> Pcs</td>
<td></td>
<td></td>
</tr>
]]></add>
</operation>
<!-- quantity in orders ends -->
<!-- fix columns starts -->
<operation>
<search position="replace"><![CDATA[
<td class="text-right" colspan="4">
]]></search>
<add><![CDATA[
<td class="text-right" colspan="5">
]]></add>
</operation>
<!-- fix columns ends -->
</file>
</modification>