Skip to content

Commit

Permalink
Version 0.1.1
Browse files Browse the repository at this point in the history
* Add support for OpenCart 3.0.
* Bugfix - properly support DB prefix.
  • Loading branch information
DavisNT committed Jun 11, 2023
1 parent 54b7950 commit e3267fb
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Invoice-MPN-Loc.ocmod.xml → Invoice-MPN-Loc_oc23.ocmod.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Replace model with manufacturer, MPN and location in admin inv.</name>
<version>0.1</version>
<version>0.1.1</version>
<author>Dāvis Mošenkovs</author>
<link>https://github.com/DavisNT/OC-Invoice-MPN-Loc</link>
<code>davisnt_invoicempnloc</code>
Expand All @@ -11,7 +11,7 @@
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
]]></search>
<add position="replace"><![CDATA[
$query = $this->db->query("SELECT op.*, p.mpn, p.location, m.name AS manufacturer FROM " . DB_PREFIX . "order_product op LEFT JOIN product p ON op.product_id = p.product_id LEFT JOIN manufacturer m ON p.manufacturer_id = m.manufacturer_id WHERE order_id = '" . (int)$order_id . "'");
$query = $this->db->query("SELECT op.*, p.mpn, p.location, m.name AS manufacturer FROM " . DB_PREFIX . "order_product op LEFT JOIN " . DB_PREFIX . "product p ON op.product_id = p.product_id LEFT JOIN " . DB_PREFIX . "manufacturer m ON p.manufacturer_id = m.manufacturer_id WHERE order_id = '" . (int)$order_id . "'");
]]></add>
</operation>
</file>
Expand Down
61 changes: 61 additions & 0 deletions Invoice-MPN-Loc_oc30.ocmod/install.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Replace model with manufacturer, MPN and location in admin inv.</name>
<version>0.1.1</version>
<author>Dāvis Mošenkovs</author>
<link>https://github.com/DavisNT/OC-Invoice-MPN-Loc</link>
<code>davisnt_invoicempnloc</code>
<file path="admin/model/sale/order.php">
<operation>
<search index="0"><![CDATA[
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
]]></search>
<add position="replace"><![CDATA[
$query = $this->db->query("SELECT op.*, p.mpn, p.location, m.name AS manufacturer FROM " . DB_PREFIX . "order_product op LEFT JOIN " . DB_PREFIX . "product p ON op.product_id = p.product_id LEFT JOIN " . DB_PREFIX . "manufacturer m ON p.manufacturer_id = m.manufacturer_id WHERE order_id = '" . (int)$order_id . "'");
]]></add>
</operation>
</file>
<file path="admin/controller/sale/order.php">
<operation>
<search index="0"><![CDATA[
'model' => $product['model'],
]]></search>
<add position="replace"><![CDATA[
'model' => $product['model'],
'mpn' => $product['mpn'],
'location' => $product['location'],
'manufacturer' => $product['manufacturer'],
]]></add>
</operation>
</file>
<file path="admin/view/template/sale/order_invoice.twig">
<operation>
<search index="0"><![CDATA[
<td><b>{{ column_model }}</b></td>
]]></search>
<add position="replace"><![CDATA[
<td><b>{{ column_manufacturer }}</b></td>
<td><b>{{ column_mpn }}</b></td>
<td><b>{{ column_location }}</b></td>
]]></add>
</operation>
<operation>
<search index="0"><![CDATA[
<td>{{ product.model }}</td>
]]></search>
<add position="replace"><![CDATA[
<td>{{ product.manufacturer }}</td>
<td>{{ product.mpn }}</td>
<td>{{ product.location }}</td>
]]></add>
</operation>
<operation>
<search index="0"><![CDATA[
<td class="text-right" colspan="4"><b>{{ total.title }}</b></td>
]]></search>
<add position="replace"><![CDATA[
<td class="text-right" colspan="6"><b>{{ total.title }}</b></td>
]]></add>
</operation>
</file>
</modification>
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
OpenCart 2.3 Invoice MPN Loc
OpenCart 2.3/3.0 Invoice MPN Loc
===============
OpenCart 2.3 modification to display Manufacturer name, MPN and Location instead of Model in invoices (in OpenCart admin interface).
OpenCart 2.3 and 3.0 modification to display Manufacturer name, MPN and Location instead of Model in invoices (in OpenCart admin interface).

## Introduction

This modification changes invoices in OpenCart admin interface - adds Manufacturer, MPN and Location columns, and removes Model column from table of products in the invoice.

This is tested only on OpenCart 2.3.0.2.
This is tested only on OpenCart 2.3.0.2 and OpenCart 3.0.3.8.

## Installation

1. For OpenCart 3.0 inside the folder `Invoice-MPN-Loc_oc30.ocmod` compress `install.xml` into `Invoice-MPN-Loc_oc30.ocmod.zip`.
1. Open Extensions Installer in OpenCart admin interface.
1. Upload/install `Invoice-MPN-Loc.ocmod.xml`.
1. On OpenCart 2.3 upload/install `Invoice-MPN-Loc_oc23.ocmod.xml`.
1. On OpenCart 3.0 upload/install `Invoice-MPN-Loc_oc30.ocmod.zip`.
1. Open Modifications in OpenCart admin interface and click Refresh.
1. Edit the language file (e.g. `admin/language/en-gb/sale/order.php`) of your OpenCart installation (e.g. via FTP) and add (or adjust if needed) lines like these:

Expand Down

0 comments on commit e3267fb

Please sign in to comment.