$item->product_sku in invoices but not in quotes?


I just realized that there is no $item->product_sku available in pdf templates for quotes, but it is available in pdf templates for invoices.

I have InvoicePlane 1.5.11 running and i wonder what’s the logic behind that?

Is there a way i can activate that variable for quotes also?



The difference is in application/modules/quotes/models/Mdl_quote_items.php (no join with the product table) vs. application/modules/invoices/models/Mdl_items.php (with a join to the product table).

Maybe i can patch this for myself. I’ll keep you updated in case anyone else needs that too.


Here is my patch to make values from the product table also available in the pdf template for quotes:

# diff -u application/modules/quotes/models/Mdl_quote_items.php.orig application/modules/quotes/models/Mdl_quote_items.php
--- application/modules/quotes/models/Mdl_quote_items.php.orig  2020-04-11 19:02:08.000000000 +0200
+++ application/modules/quotes/models/Mdl_quote_items.php       2021-01-11 11:30:00.981821000 +0100
@@ -24,7 +24,8 @@
     public function default_select()
-        $this->db->select('ip_quote_item_amounts.*, ip_quote_items.*, item_tax_rates.tax_rate_percent AS item_tax_rate_percent');
+        $this->db->select('ip_quote_item_amounts.*, ip_products.*, ip_quote_items.*,
+            item_tax_rates.tax_rate_percent AS item_tax_rate_percent');
     public function default_order_by()
@@ -36,6 +37,7 @@
         $this->db->join('ip_quote_item_amounts', 'ip_quote_item_amounts.item_id = ip_quote_items.item_id', 'left');
         $this->db->join('ip_tax_rates AS item_tax_rates', 'item_tax_rates.tax_rate_id = ip_quote_items.item_tax_rate_id', 'left');
+        $this->db->join('ip_products', 'ip_products.product_id = ip_quote_items.item_product_id', 'left');
@@ -49,6 +51,11 @@
                 'label' => trans('quote'),
                 'rules' => 'required',
+            'item_sku' => [
+                'field' => 'item_sku',
+                'label' => trans('item_sku'),
+                'rules' => 'required|unique',
+            ],
             'item_name' => [
                 'field' => 'item_name',
                 'label' => trans('item_name'),

The patch was done against the currently released version 1.5.11. Maybe it’s something to include in 1.5.12?

DISCLAIMER: When you use this patch, you alter a part of the core code and this patch will be lost after every update to the core code (unless it gets incorporated by someone with commit privileges). You have to re-patch after each core code update!


Hi Markus and thank you for the patch.
Feel free to commit your work at GitHub => GitHub - InvoicePlane/InvoicePlane: A self-hosted open source application for managing your invoices, clients and payments.

Just open a PullRequest and write what exactly it does. What is getting added and what (if) is getting removed. After this I can create a Test-Release which you then can test

Thanks for the offer!

Just a quick question: I assume that i have to create the pull-request in the 1.5.12 branch. And i’ll open an Issue beforehand that i reference in the pull request, right?

I’ll setup a dev VM too as i might have some more feature-requests… I am using FreeBSD with nginx and php-fpm on the server side.

Yes please PR against 1.5.12

Thats optional but thats ofc very ok.

Once your PR is requested against 1.5.12 just write it here and I will create your Test-Release and append it here.

Ok, my first pull request is up! :muscle:

As the issue tracker that’s linked in CONTRIBUTING https://development.invoiceplane.com/ seems down and issues on github are deactivated i omitted this optional step.


Thanks for your contribution.

Here is your testfile. Please be aware that this is not tested and is an unofficial build just for you (your PR).

BACKUP BACKUP BACKUP! :slight_smile:

# Value
name MarkusTestv1.5.12-Preview.zip
md5 e23036f16099e3256a39c7640607c82d
sha256 4d3f0e7bc4922d7408995e2b83a1844bfc1edb8a3bdbbc856d6fa2503fac6f60
size 13.250 MiB

Downloadlink 1: LINK
Checksumlink 1: LINK

Downloadlink 2: LINK
Checksumlink 2: LINK

Please review your testbuild and test it. After this give feedback and tell us if everything was fine.


I now have a development VM to test such releases up and running. Your provided preview release works for me as intended. I have seen that it is already merged into the release branch on github (YAY!).

Thanks for your help and for accepting my suggestion!


1 Like

You are welcome!
As this is a free and opensource project we actually rely on people that actually also contribute code and not just wishes :slight_smile:

Thanks for your contribution once again.
If such contributions will sum up a bit I may develop a tool that will semi.automatically build test-releases so contributors can test this faster and easier :wink:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.