Product Category Description in PDF Quote

So a product is in some category. This category has a description.
The product itself is used as a Line Item on a quote.
I want to print out the quote in pdf but there is no option to use [color=#0000ff]$aos_products_aos_product_category_description[/color] in PDF Templates.
Closest I can get is the name of category ($aos_products_aos_product_category_name) but not its description.
How can I overcome this limitation?

And there is also a question number 2.
Is there a way to use this category description or product description on the same PDF Template where the line items are but not in the Line Item table.
I want to have a big description with lots of text before the actual table with prices, discounts, totals, etc…So if some Line Item is a Product it should print out its description before the pricing table.
How can I do this? I tried several ideas but non of it worked.

Just to make this questions more obvious. I am looking for a PDF Quote that would have the following structure:

PRODUCT_CATEGORY_001_description
“loremipsum loremipsum loremipsum”
Product_abc1_description (Product_abc1 is in 001 category)
“lorem ipsum dolor sit amet”
Product_abc2_description (Product_abc2 is in 001 category)
…
Product_abcX_description (Product_abcX is in 001 category)
PRODUCT_CATEGORY_002_description
“blah blah blah”
Product_def1_description (Product_def1 is in 002 category)
“loremblah ipsumblah blah”
Product_def2_description (Product_def2 is in 002 category)
…
Product_defX_description (Product_defX is in 002 category)
PRODUCT_CATEGORY_00x_description
Product_xyz1_description (Product_xyz1 is in 00x category)
Product_xyz2_description (Product_xyz2 is in 00x category)
…
Product_xyzX_description (Product_xyzX is in 00x category)

The array of Categories and Products are those bounded to the Line Items : Products from the quote that I wish to print.

And then after all this descriptions I want to print a pricing table consisting of all the line items in the quote.

How can it be done?

It seams to be quite a complicated tweak to achieve such a simple adjustment in the PDF Templates. It looks like I need to change several things (generatePdf.php and some other files as well) to be able to make it work like I want it to.
Does anyone have experience in making changes with the presentation of the Line Items fields in AOS PDF Templates? What do I need to do?

HI! i have the same trouble could you solve it?

This one is very tricky. You need to know how to make lots of customization and coding in order to make it work.
Here is what I did:

  • created custom field for product category description in edit and detail view on quotes module

  • changed line_items.js in custom/modules/AOS_Products_Quotes with new function to generate array of product_part_numbers every time the list of items is being changed and pass this array with ajax call (to the entry point in the next text bullet)

  • created php file and custom entry for it under custom/modules/AOS_Quotes in which I connect to database and execute stored procedure with select for products categories and descriptions and with parameters received from ajax call to this entry point; also in the same file I accept results and send it back to ajax as json object on success to be json_encoded as text to the custom field

  • add this custom field on your pdf template.

This solution is my workaround. It is not the best one since you don’t have any formatting of the text on this custom field. A lot better would be to create some table with product categories and descriptions but I am not sure how to do it without heavy messing around with templateParser.

1 Like