Aos_line_item_groups_name Repeat Content Problem

When adding the $aos_line_item_groups_name variable i get the table correct but if i have two Groups at my quote then the PDF is messed up.

For example if i have the following at my template …

  1. Heading 1
  2. some text
  3. Table with Groups
  4. content
  5. Price
  6. date

With 2 Groups Everything from 3 and down will be generated two times and i have a pdf like this

  1. Heading 1
  2. some text
  3. Table with Groups 1
  4. content
  5. Price
  6. date
  7. Table with Groups 2
  8. content
  9. Price
  10. date

How can i fix this ??

thanks

1 Like

The PDF is being generated from modules/AOS_PDF_Templates/generatePdf.php so in order to achieve what you are looking to do, first copy the file to custom path and also change the entryPoint for generatePDF so that i points to the custom file, then you can add your changes to the file as you like.

I looked at the code in question to see if it was something obvious, and quick to patch locally. I would need to actually study the dev docs in order to create an effective solution. All I can say is, “beans”.

What I did discover is that the content only repeats if it’s below the table that contains $aos_line_items_groups_name - so if you use that as your last piece of content, you can have an effective outcome without having to modify the pdfGenerate.php file or add your own AOS_Line_Item_Groups class.

Quick follow-up here, and for anyone else looking to resolve this without any customization –

I have discovered that if you include the variable $aos_line_item_groups_number on the same line as $aos_line_item_groups_name and they are both inside of a <table> element, none of the content following the table will repeat.

Example (note the <h3> tag inside the <thead>):

   <table style="font-size: 11px; width: 100%; color:#333333; border-style:solid; border-width:1px; border-color:#fff; text-align:center;" cellpadding="4" cellspacing="1">
      <thead>
        <tr>
          <td>
            <h3>$aos_line_item_groups_number. $aos_line_item_groups_name</h3>
          </td>
        </tr>
      </thead>
      <tbody>
        <tr style="font-weight:bold;">
          <td style="background-color: #04545d; color: #ffffff; font-weight: bold;" width="50">Qty</td>
          <td style="background-color: #04545d; color: #ffffff; font-weight: bold;" width="120">Product</td>
          <td style="background-color: #04545d; color: #ffffff; font-weight: bold;" width="240">Description</td>
          <td style="background-color: #04545d; color: #ffffff; font-weight: bold;" width="70">List*</td>
          <td style="background-color: #04545d; color: #ffffff; font-weight: bold;" width="70">Discount</td>
          <td style="background-color: #04545d; color: #ffffff; font-weight: bold;" width="70">Sale Price*</td>
          <td style="background-color: #04545d; color: #ffffff; font-weight: bold;" width="70">Line Total</td>
        </tr>
        <tr>
          <td style="border-bottom-color:#c0c0c0; border-right-color:#c0c0c0;" width="50" valign="middle">$aos_products_quotes_product_qty</td>
          <td style="border-bottom-color:#c0c0c0; border-right-color:#c0c0c0; text-align:left;" width="120" valign="middle">$aos_products_quotes_name</td>
          <td style="border-bottom-color:#c0c0c0; border-right-color:#c0c0c0; text-align:left;" width="240" valign="middle">$aos_products_quotes_item_description</td>
          <td style="border-bottom-color:#c0c0c0; border-right-color:#c0c0c0;" width="70" valign="middle">$aos_products_quotes_product_list_price</td>
          <td style="border-bottom-color:#c0c0c0; border-right-color:#c0c0c0;" width="70" valign="middle">$aos_products_quotes_product_discount</td>
          <td style="border-bottom-color:#c0c0c0; border-right-color:#c0c0c0;" width="70" valign="middle">$aos_products_quotes_product_unit_price</td>
          <td style="border-bottom-color:#c0c0c0;" width="70" valign="middle">$aos_products_quotes_product_total_price</td>
        </tr>
        <tr>
          <td style="border-bottom-color:#c0c0c0; border-right-color:#c0c0c0; text-align:left;" colspan="3" valign="middle">$aos_services_quotes_name</td>
          <td style="border-bottom-color:#c0c0c0; border-right-color:#c0c0c0;" width="70" valign="middle">$aos_services_quotes_service_list_price</td>
          <td style="border-bottom-color:#c0c0c0; border-right-color:#c0c0c0;" width="70" valign="middle">$aos_services_quotes_service_discount</td>
          <td style="border-bottom-color:#c0c0c0; border-right-color:#c0c0c0;" width="70" valign="middle">$aos_services_quotes_service_unit_price</td>
          <td style="border-bottom-color:#c0c0c0;" width="70" valign="middle">$aos_services_quotes_service_total_price</td>
        </tr>
        <tr>
          <td colspan="2"></td>
          <td style="background-color: #04545d; color: #ffffff; font-weight:bold;" valign="middle">Totals</td>
          <td style="border-right-color:#c0c0c0;" width="70" valign="middle">$total_amt</td>
          <td style="border-right-color:#c0c0c0;" width="70" valign="middle">$discount_amount</td>
          <td style="border-right-color:#c0c0c0;" width="70" valign="middle">$subtotal_amount</td>
          <td style="background-color: #6C239C; color: #ffffff; font-weight: bold;" width="70" valign="middle">Grand Total</td>
        </tr>
        <tr>
          <td colspan="6"></td>
          <td style="font-weight:bold;" width="70">$total_amount</td>
        </tr>
      </tbody>
    </table>

<!-- Content that comes after this table will not print inside of the item groups loop -->

This was the fastest, most immediate solution I discovered. If you’re okay with showing a simple indexing number before your group name, then it’ll do.

Edit: One issue you may also run into, is the $discount_amount variable, and any of its alternativees (e.g. $aos_quotes_discount_amount_usdollar) will no longer display in the PDF output. I’m not sure the correlation between using the groups loop and this, but I just can’t get it to show anymore.