Hello guys,
I've tried to modify invoice.tpl to create my own, and I want to add column with Number, at first position on 'product' table and I need to count products from foreach loop.
And I don't know how to make a counter in invoice loop, any help?
Thank you.
Note that you should correct two files
Customer invoice
design/themes/THEME/mail/templates/orders/invoice.tpl
Admin invoice
design/backend/mail/templates/orders/invoice.tpl
Thank you for answer.
I know I should edit those files.
I already tried to edit them, but my question is how to make a counter in foreach loop. If I make like this
{ foreach ... }
Is not working.. And I don't know where should I use the code for counter and maybe for the code itself.
Best regards,
1inplus
Hi!
Thank you for answer. I know I should edit those files. I already tried to edit them, but my question is how to make a counter in foreach loop. If I make like this { foreach … } Is not working… And I don’t know where should I use the code for counter and maybe for the code itself. Best regards, 1inplus
Try to use this code:
{$count = 1}
{ foreach … }
{$count} - is for the column
{$count = $count + 1} - can be used in the foreach
{/foreach… }
P.S. not tested
Best regards,
Alternative solution
{foreach ... name="products"}
{$smarty.foreach.products.iteration}
{/foreach}
@Cart-Power
It's not working..
Code tested
{ $count = 0 }
{foreach from=$order_info.products item="oi"}
{ $count = $count +1 }
{$smarty.foreach.products.iteration}
{hook name="orders:items_list_row"}
{if !$oi.extra.parent}
{$count}
And the view I have:
@eComLabs
Honestly, I don't know how to use this.
{$smarty.foreach.products.iteration}
I'm new in Cs-Cart, and now I'm learning. Hope this is not a stupid message.
@Cart-Power
It's not working..
Code tested
Try to remove extra spaces. E.g.
{$count = 0}
{foreach from=$order_info.products item="oi"}
{$count = $count +1}
{hook name="orders:items_list_row"}
{if !$oi.extra.parent}
{$count}
or use our solution
{foreach from=$order_info.products item="oi" name="products"}
{hook name="orders:items_list_row"}
{if !$oi.extra.parent}
{$smarty.foreach.products.iteration}
It's working with first code.
Thank you so much.
Best regards,
Andrei
cbdit
April 25, 2022, 12:00am
11
I have a question if anyone is listening.
When I go into "Print Invoice" at the top of the page is the logo and the word "INVOICE" My boss would like me to change that word. Can you tell me where that is possible? I also need to change it on the mail notification.
Thank you
I think, you should change corresponding language variable