AnsweredAssumed Answered

SugarPDF getting a foreach inside a table without adding rows

Question asked by Francesca Shiekh on Sep 29, 2017
Latest reply on Feb 26, 2018 by Francesca Shiekh

I have a custom PDF in PDFManager.

I need to loop inside a table:

<table header>

<loop through the rows>

<table footer>

 

This works fine but....

 

 

<!--START_PRODUCT_LOOP-->
<tr>
<td>{foreach from=$bundle.products item="product"}</td>
</tr>
<tr>
<td>{if isset($product.quantity)}{$product.quantity}{/if}</td>
<td>{if isset($product.name)}{$product.name}{/if}</td>
<td class="right">{if $fields.display_discount_c}{if isset($product.discount_price)}{$product.discount_price}{/if}{/if}</td>
<td class="right">{if $fields.display_discount_c}{if isset($product.ext_price)}{$product.ext_price}{/if}{else}{if $product.total_amount}{$product.total_amount}{/if}{/if}</td>
<td class="right">{sugar_currency_format var=$product.line_tax_amount_c currency_id=$product.currency_id}</td>
<td class="right">{if $fields.display_discount_c}{if isset($product.discount_amount)} {if !empty($product.discount_select)} {sugar_number_format var=$product.discount_amount}% {else} {sugar_currency_format var=$product.discount_amount currency_id=$product.currency_id} {/if}{/if}{/if}</td>
</tr>
<tr>
<td>{/foreach}</td>
</tr>
<!--END_PRODUCT_LOOP-->

it adds two blank lines between products (one for the open foreach and one of the end);

 

I have to add a row to the table to house the smarty for the foreach, otherwise, it gets automatically moved to outside the table (as any text would if placed outside row tags on an html table).

 

What is the correct way to do this without introducing blank lines?

 

Thanks

FrancescaS

Outcomes