Jump to content

How to: Break $item['description'] line items


developer10

Recommended Posts

Hi,

 

I'm trying to customize the invoice PDF (invoicepdf.tpl). Everything is going OK except for the fact I'm unable to break the $item['description'] line items.

 

Currently, it is in the following form:

 

6 x MyProductGroup - MyProductName @ 2.75(price)

(also the discount rate will be shown if present)

 

What I want to achieve is to break all of those grouped items so I can create additional columns, for example:

 

Item No. Description (product name only) Quantity Discount rate Total amount or very similar to this

 

 

How can this be achieved? I was looking at the quotepdf.tpl and saw there separate items like $item['unitprice'], $item['discount'], etc.. But when I try to apply those to invoicepdf.tpl, PDF fails to generate.

 

 

Any suggestions?

 

 

Thanks

Link to comment
Share on other sites

I don't know if this is any help or not, but the description would be categorized as a string. (At least I think)

 

Anyway, take a look at this page: http://www.tcpdf.org/examples.php

 

It has examples of the available code as well as doc's. That is the engine used to generate pdf's.

 

Kyle

 

Yes, it indeed seems that the invoice description is stored as a string (i looked it up directly in the database).

 

I'm thinking about breaking up the string on certain criteria but not sure if that can be achieved correctly. Too bad there's no other option for this. In my country it's not very convenient to have such an item on the invoice.

 

My ex hosting provider is using WHMCS. When I received the final invoice to my home address, I noticed they have their invoice in the form I want. However, when I log into my account with them (it's still active) and I click "View invoice" I notice the description item is not broke into separate items. That leads me to conclusion they probably manually make final invoices that are to be mailed to customers. It does, however, have the "PAID" title at the top, as with WHMCS invoices.

Link to comment
Share on other sites

Yes, it indeed seems that the invoice description is stored as a string (i looked it up directly in the database).

 

I'm thinking about breaking up the string on certain criteria but not sure if that can be achieved correctly. Too bad there's no other option for this. In my country it's not very convenient to have such an item on the invoice.

 

My ex hosting provider is using WHMCS. When I received the final invoice to my home address, I noticed they have their invoice in the form I want. However, when I log into my account with them (it's still active) and I click "View invoice" I notice the description item is not broke into separate items. That leads me to conclusion they probably manually make final invoices that are to be mailed to customers. It does, however, have the "PAID" title at the top, as with WHMCS invoices.

 

 

You could break the string up after each space then list each item that way. Not sure if this is what you are looking for but it is at least an idea.

Link to comment
Share on other sites

You could break the string up after each space then list each item that way. Not sure if this is what you are looking for but it is at least an idea.

 

Spaces arent a good fit because I cant predict what number of words will be there in a descriptions (product group and product name are variable).

 

But I think there must be something useful. I'll post back if I find a good solution so others can benefit from it too.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated