News:

Support the VirtueMart project and become a member

Main Menu

Invoice PDF files from HTML

Started by timlogotim, September 19, 2014, 01:19:25 AM

Previous topic - Next topic

timlogotim

I have developed a very nice looking HTML file complete with internal style sheet that is intended to end up as the PDF invoice file.  Where can I place the raw HTML to be used by VM2 for invoices that are mailed by default to customers after checking out? 

Also, are there tags that I can use in my template that will call the individual elements (ie Item #, Description, Street Address 1, etc) that I can use in my template?  Where can I find the list of those items to be included in my template?

jenkinhill

The invoice template files are in components/com_virtuemart/views/invoice/tmpl/   I believe you will need to merge your code with those files and use the edited files as template overrides.
http://docs.virtuemart.net/tutorials/templating-layouts.html
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

timlogotim

Thanks for the reply.  Looking in the folder there are 20+ files.  I would need to edit all of these in order to get my PDF document styled according to my HTML template I created for invoices?

timlogotim

Is that correct that I would need to edit all of those documents just for the PDF?  If not, can you provide a little clarity on what is the simplest way to take my HTML and have it populated with the specific VM data?

jenkinhill

You will see there are files with invoice in the name. And there are also header & footer html email files. AFAIK together those make up the invoice file.
Dnd of course there are the options for header & footer in Shop/Invoices/Emails.

There is a plugin to make invoices easier to edit, http://forum.virtuemart.net/index.php?topic=115141.0
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

timlogotim

I realize I may be sounding ignorant here, but you realize I am only talking about a PDF document that gets emailed with order confirmations to customers.  The emails themselves are being handled by a plugin called VM Email Manager Plus.  So the emails themselves look great.  I just need a presentable PDF. 

To answer you question, I see several files that refer to invoices.  What is my guide for how these files interact/combine with each other?  I don't understand at all the editing process...though I have all of the HTML design that I need.  Just need to implement it into VM correctly.

Regarding the plugin you mentioned, is that tool just for the PDF editing?  Seems like at first blush it handles other things as well.  Can I use it to ONLY edit the pdf that get's attached?

timlogotim

I looked at the plugin, but it doesn't seem to offer any type of HTML editing at all (that I found).  I tried the online demo and it is a very odd editor indeed, and doesn't give specific control over each field. Instead in lumps things together in chunks and gives you a limited way of placing them around. 

Does anyone in the world know how to use HTML editing to make good looking PDF files for invoices in VM?  Does anyone have any example you could share of exactly what you did to get a customized (customized element placements and omissions, not just your logo :)) looking PDF file?  Which files (exactly were edited) and which ones weren't.  I have HTML/CSS ready that makes a perfect one page PDF file.  I just want to use it to display virtuemart data.  It seems this would be explained somewhere, but I have been able to find nothing but confusion regarding the topic in all threads. 

Please help if you are able.  Thanks so much!

timlogotim

Because this topic is such murky water, please feel free to talk to me like I am a complete noob.  The more detail and step by step info you can provide, the more helpful in this case.  All pride aside at this point :)  Just need some good solid honest help to get these PDF files looking good.

Thanks all!

timlogotim

Is anyone able to help me with this?

GJC Web Design

No one is going to spend time experimenting with their template files to give you the answer..
Where is the harm in you experimenting with your invoice template files?  What is the worst that could happen?

If you haven't the skills then you need to employ someone who has...
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

timlogotim

Thank you so much for your kind contribution Mr GJC Web Design.  The entire community is surely more educated now.   :-\

QuoteNo one is going to spend time experimenting with their template files to give you the answer..
That very well may be the case.  However, that also is not what I asked anyone to do.  I asked how it was intended to be done by the Virtuemart team when they built this.  The fact that no one has responded to this thread (or clearly resolved any of the similar questions related to PDF invoices on this forum) likely has everything to do with the fact that no one knows how to do it.  I could be wrong, here, but in my experience most folks are very kind to deal with and are generally very generous with their knowledge.  As a matter of fact, the majority of what I know regarding web design and programming is a direct result of kind people helping out and pointing me in the right direction.  That said, your comment would be more appropriate if you had instead said "
QuoteI am not going to spend time experimenting with their template files to give you the answer.
- because if someone knows, it's been my experience that they are happy to share what they've learned.

QuoteWhere is the harm in you experimenting with your invoice template files?
Nothing sir.  I do it all the time.  There is no indication as to specifically which files are involved, though, to experiment with.  Surely it's not all files in  components/com_virtuemart/views/invoice/tmpl/

QuoteWhat is the worst that could happen?
Not entirely sure.  However, altering files that have nothing to do with the PDF files could break things that may not be immediately noticed.  Best to start with knowing the actual files that are SUPPOSED to be altered for the specific issue I'm working on.

QuoteIf you haven't the skills then you need to employ someone who has...
You're a treat.  Thanks for this brilliant comment.  I'm so glad you joined into this conversation to help us all.  Looking at your threads, at least you are consistent with how you respond to people on this forum.


jenkinhill

Abuse of other forum members will not be tolerated.

You were told which files template are used for the template, and if you look carefully at invoice.php you will see that php is used to call any required additional templates, any required required data and enter it into the html structure.

eg: this bit calls the file invoice-order.php which loads its own data & structure
<div class='spaceStyle'>
    <?php
    echo $this->loadTemplate('order');
    ?>
</div>

And this next bit calls the file invoice-items.php

<div class='spaceStyle'>
    <?php
    if ($this->print) {
   echo $this->loadTemplate('items');
    } else {
   // NOT in print mode, full HTML view for a browser:
        $tabarray = array('items'=>'COM_VIRTUEMART_ORDER_ITEM', 'history'=>'COM_VIRTUEMART_ORDER_HISTORY');
   shopFunctionsF::buildTabs( $this, $tabarray);
    }
    ?>
</div>

You will need to integrate or merge your code with the default files. It is of course, a lot of work. If you really do not understand it then like anyone else would do, employ someone who can do it.
Or use a third party extension instead. eg http://advanced-virtuemart-invoices.cmsmart.net/virtuemart-extensions/virtuemart-order-management

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

timlogotim

I received your warning from the forum.  I would like to say that I did not intend to insult (or abuse?) anyone here, and I'm sorry that is how my post was received.  Many folks in the open source community provide helpful feedback, and to be honest I was irritated by the response I received from the above member.  I did not feel as though it were a productive post and I honestly didn't see how it was helpful.  Reading over my post, I shouldn't have posted the last line which did, in fact, have an insulting tone.  I apologize.

Now, moving forward with the topic.  Thanks jenkinhill for responding and offering some clarity.  Now I know which files to begin working on and experimenting with.  To me, this is the type of information that helps all of us.

Thanks again.

Regarding the third party plugin, I looked at that, but I don't see where to edit HTML.  In your experience, does that tool have a way of working with HTML in the backend of VM?  Just trying to understand the application of that plugin and how it is intended to be used in this circumstance.  Can you advise?


timlogotim

Is there a way to simply "turn off" the feature to add a PDF invoice to the emails being sent?  If so, that seems like it might be the quickest way to fix the problem.

GJC Web Design

The point I am making is that yes - it would seem no one knows - the TCPDF library it uses is a very obscure and touchy thing -
I tried for one of my clients to produce a nice product pdf and had to give up -

I instead hacked in another PDF library to Joomla (dompdf) and could simply produce nice looking pdfs with simple logical html code.. but that is another story here...

I would assume most leave the thing alone and get on with it.. their is rudimentary styling in the vendor ->invoice that passes thru..
Jenks has told you exactly what files are used in its production -- now it is time for you to try a bit of experimentation
BUT - if you want someone to sit down and spend time to find out how it works and then pass this knowledge to you - expect to put your hand in your pocket for their time...

All the posts here from the usual suspects are given freely - without them there wouldn't be a forum - this isn't commercial software - no one gets paid a penny from VM its-self - if Jenks averages 2 mins a post he has already spent 87 unpaid 8 hour days on here ..

Once you have a couple of 100 informative posts on here then you can feel free to moan about other posters... but until then well.... silence might be the better part of valour...
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation