VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: mailblade on April 10, 2019, 10:08:02 AM

Title: Auto-increment number counter in PDF?
Post by: mailblade on April 10, 2019, 10:08:02 AM
I would like to add an auto-increment number counter which will appear in the invoice PDF.

If I have 20 rows of items in the invoice, there should be a counter next to the first column starting with "1" all the way up to the amount of items I have in the order.

I know how to add this in a normal table, but I'm a bit confused using the VM layout.

Thanks
Title: Re: Auto-increment number counter in PDF?
Post by: AH on April 10, 2019, 11:47:16 AM
The invoice items are displayed using this template.

Create a template override for \components\com_virtuemart\views\invoice\tmpl\invoice_items.php

Write a simple counter increment and show the value in the display line.

Find the line display:

foreach($this->orderDetails['items'] as $item) {

You may want to adjust or add a new header to the table display.

Title: Re: Auto-increment number counter in PDF?
Post by: mailblade on April 11, 2019, 10:24:11 AM
Thank you AH!

That was the line I was looking for!  :D Problem solved :)
Title: Re: Auto-increment number counter in PDF?
Post by: AH on April 11, 2019, 10:43:17 AM
You are very welcome  :)