How To Edit Print Invoice Template

Dear team,

I want to edit print_invoice template to show an additional field under products description table for each product row. ( I'm referring to this page dispatch=orders.print_invoice&order_id=3844506)

I find it difficult to relevant template file. Kindly educate me on which file to edit and from which locations.

Regards,

What template editor do you use? Old or new one?

Settings -> Appearance -> Email templates mode

Hi,

Thanks for your reply,

Let me elaborate what I need to do.

There is an addon installed to show a field called 'location' below the SKU of each item in the order details page.

When I try to print the invoice I do not see this location field added to print preview page. Its just shows as normal invoice without this field.

I want to add this location field to this invoice product table.

How can I go about and add this field here? I'm unable to find proper template file to do this changes.

Thank you,

At first please answer on my question

HI,

Sorry, my mistake, I could not answer you at first,

I checked the settings. Its New.

Thank you,

The list of available variables in the new document editor is limited. At first, contact addon developers and ask them to extend this module and add Location variable to the list of available variables in the new editor

Hi,

Thanks for your reply,

I have been given this task to do myself. So that is why trying to find a way to extend it.

If you could advice me on what are the steps to do in order to achieve this, would be really great.

I already noted that I need to add few entries in template snippets and template related tables. I would like to know how to do this.

Regards,

Variables are not in tables. You will need to add classes and private functions to get the data and apply it to the variables in the template. It is not s simple process. You can look in the documentation for how to add a variable to a template. See "Variables" section on this page: https://docs.cs-cart.com/latest/developer_guide/core/documents/documents.html

Good luck!

I agree with tbirnseth. The process of adding new variables is not trivial and programming skills are required here

Hello all,

Thank you so much Tbirnseth, and eComLabs for your advice on this.

I'm actually going through the docs referred by Tbirnseth. I have to implement a solution myself and I somehow can manage programming part as well.

In case If I come across any further issues I'll post it here.

Thanks again for your valuable advises.

Hi all,

Sorry for my late update.

I did manage to achieve what was needed.

But the way I implemented my solution was rather simple approach. What I did was I created a variable class which implements IVariable interface. And in the constructor method, using Context variable I accessed Order object reference and its items.

Then I concatenated the information what I wanted to show along with the items.

This resolved my issue.

Thank you for providing guidelines in this regards.