Adding Product family in quote

How can I get the ‘Product family’ and ‘Product SKU’ printed in the invoice instead of product Item?
Our accountants need this info to process our invoices.
I guess there is some lookup required to get it by the ‘item_product_id=product_id’ from the ‘products’ and ‘families’ tables.
This probably resembles the request I made last year about getting the quote number in the invoice (Display quote number in invoice) but some help on coding would be welcome.
Thanks

Hi,
several month later and still no success to fix this

I need the ‘product family’ and product SKU in the invoice table left to the related items but do not succeed to get this working.

I guess I need to touch

modules/products/models/Mdl_products.php
as well as
application/views/invoice_templates/pdf/InvoicePlane.php

but fear of breaking things
Any help would be great
S

This was asked elsewhere but did not get answered.
I need to show ‘family_name’ on the left of the invoice item table for the book keeper to register the invoice correctly (I figured out SKU but fail for family_name so far).

When I list all ‘$item’ fields with

<?php print_r($item); ?>

I see ‘family_id’ but not ‘family_name’
How can I add a model to obtain the name from the related table ‘families’?
I guess I need to add to ‘pdh_helper.php’ in a ‘for $item in $items’ loop but how and where?

Any help would be very welcome
Stephane

Please stay calm and do not open multiple threads for the same topic.
This not a core functionality so support is rather limited.

My apologies for the double post, I made it because I found the solution for SKU but not yet for ‘family_name’ which relies on an extra relation which I do not succeed to create.
Sorry and thanks for your support

I found ‘a’ solution but am not entirely happy with it. Here is what I added to 2 default files:

Edits to: pdf_helper.php

look for this block

// Discount settings
$show_item_discounts = false;
foreach ($items as $item) {
    if ($item->item_discount != '0.00') {
        $show_item_discounts = true;
    }
}

insert code as shown next

// added code: Get family_name
$CI->load->model('families/mdl_families');
foreach ($items as $item) {
		$family_rel = $CI->mdl_families->where('family_id', $item->family_id)->get()->result();
		$item->family_info = (isset($family_rel[0]) ? $family_rel[0] : null);		
    }
// added code

Edits to invoiceplane_invoice.php line ~62

look for code:

<?php
foreach ($items as $item) { ?>
    <tr>

inserted code

<td><?php _trans($item->family_info->family_name); ?></td>

I would have preferred to only add the field ‘family_name’ to $item but apparently my syntax adds an array instead of just a single text field.

[family_info] => stdClass Object
 (
 [family_id] => 2
 [family_name] => 00VAR
 )

When you have time to comment @Kovah, I would love to learn what I did wrong

I am anyway very happy I could fix this myself :slight_smile: