Announcement

Collapse
No announcement yet.

Best approach to display product category on invoices

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best approach to display product category on invoices

    So I've been porting my invoice and quote themes from FusionInvoice and now for the final touches I want to display the product category on the invoices.

    I will have a column called article, this will be the product category then I will have a column called description where I will use the sales order, invoice, quote name attribute.

    Like this (bold isn't working):

    <!-- {{#each itemList}} -->
    <tr>
    <td style="font-size: 9px;">{{productCategory.name}}</td>
    <td style="width:40%; font-size: 9px;">{{name}}</td>
    <td style="width:10%; text-align: right; font-size: 9px;" nowrap>{{quantity}}</td>
    <td style="width:15%; text-align: right; font-size: 9px;" nowrap>{{unitPrice}}</td>
    <td style="width:15%; text-align: right; font-size: 9px;" nowrap>{{amount}}</td>
    </tr>
    <!-- {{/each}} -->​

  • #2
    It doesn't work, because InvoiceItem doesn't have information about category of product. You should create relation between Product categories and Invoice Item (or Quote Item) and use formula or hook to fetch id of product category after creation from linked product.

    Comment


    • #3
      Originally posted by emillod View Post
      It doesn't work, because InvoiceItem doesn't have information about category of product. You should create relation between Product categories and Invoice Item (or Quote Item) and use formula or hook to fetch id of product category after creation from linked product.
      Thank you for the tip, so I create a relation between invoice item -->​ product categories and then use formula inside the PDF template?

      Comment


      • #4
        I've prepared an extension for you which will populate product category
        Here you have link to download package: https://devcrm.it/download/?file=8ea...5-e802178cc528

        Comment


        • #5
          Originally posted by emillod View Post
          I've prepared an extension for you which will populate product category
          Here you have link to download package: https://devcrm.it/download/?file=8ea...5-e802178cc528
          Wow, thanks mate!

          How do I access the placeholders for the product category?

          Comment


          • #6
            novastream you can use {{productCategoryId}}, you can use also other fields, for example {{productCategory.parentName}} or {{{productCategory.description}}}

            Comment


            • #7
              Of course you have to use them in each tag like in your initial post to handle many products once

              Comment


              • #8
                Originally posted by emillod View Post
                Of course you have to use them in each tag like in your initial post to handle many products once
                Thanks, but I cant get it to work. I'm working on sales orders at the moment so I've added SalesOrderItem to your plugin, am I doing it wrong?

                Comment


                • #9
                  Aaaaah, i forgot about Sales Orders! I'm sorry! Pleasy try with Quotes or Invoices and let me know. In this time i'll add this to extension and test it on my environment

                  Comment


                  • #10
                    It's working You can download fixed package from the same url: https://devcrm.it/download/?file=8ea...5-e802178cc528
                    Click image for larger version

Name:	image.png
Views:	147
Size:	25.3 KB
ID:	85383
                    Attached Files

                    Comment


                    • #11
                      I use simply tag {{productCategoryName}}

                      Comment


                      • #12
                        Originally posted by emillod View Post
                        I use simply tag {{productCategoryName}}
                        Thank you for all the help, its working now if you ever come to sweden I will buy you a beer

                        Comment


                        • #13
                          novastream Haha, no problem, you're welcome )

                          Comment

                          Working...
                          X