VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: zebrafilm on April 25, 2012, 10:47:40 AM

Title: What/where is generating the invoice PDF
Post by: zebrafilm on April 25, 2012, 10:47:40 AM
I have a whole bunch of overrides in my template system but something seems to break the invoice PDF creation.
I am not sure if it is because I have the whole CART/INVOICE folders in overrides or not.
All emails are created but after setting the order to confirmed, I get a white screen and the invoice is no longer created.
So I was wondering:

1. What/where is the invoice created
2. Which files are used for this PDF (header mainly)

Bastiaan
Title: Re: What/where is generating the invoice PDF
Post by: Marius on April 26, 2012, 22:36:22 PM
take a look here...

http://forum.virtuemart.net/index.php?topic=98841.msg326136#msg326136
Title: Re: What/where is generating the invoice PDF
Post by: zebrafilm on April 27, 2012, 10:35:37 AM
Marius thanks for the links but I assume the problem in that thread was solved.

First:
My overrides work well for emails to customers and admins. But I can't get grip on the PDF invoice that gets created. I still want to change things there for example in the header but I can't find how that one is assembled.

Second issue:
It seems the creation of the PDF's is a delicate process, I had some trouble keeping them going and in the admin, clicking the invoice icon gives an empty window.
The print window show the right info though.
The PDF is also created (in folder outside the root) and send. So that works.

If I use Milbo's link to check the mail: index.php?option=com_virtuemart&view=invoice&layout=invoice&tmpl=component&order_number=ccad03&order_pass=p_331ae
I get the print view of the invoice.

J2.5.4 / VM 2.0.6(a)




 
Title: Re: What/where is generating the invoice PDF
Post by: zebrafilm on May 30, 2012, 15:59:32 PM
Ok weeks later and I see only more people with the same question.

Could someone make a little better info about how /where to customize the header and footer of the PDF invoice.
It seems everything is pretty clear when it comes to emails etc. but this is just the last peice of the puzzle.
I am assuming it is some where hidden with a if /then statement in one of the template files.

For example in my order confirmation email the image/logo is just the right way but in the PDF it is only shown partly because it seems 4x bigger than normal....

Any help appreciated!

Bastiaan
Title: Re: What/where is generating the invoice PDF
Post by: alf1234 on June 10, 2012, 03:09:22 AM
Hi,
from what i can tell, it is: /components/com_virtuemart/views/invoice/tmpl/invoice.php
it also grabs info from variables set in:
/components/com_virtuemart/views/invoice/view.html.php
such as vendorAddress

problem is, you can't override the pdf template. don't know why. if anyone has a solution i would love to know. all the other files in the invoice folder work with override (ie the mail_html_xxxxxxxxx.php files all override perfectly, but the invoice_xxxxxxx.php files dont work with overrride)
Title: Re: What/where is generating the invoice PDF
Post by: carsten888 on July 06, 2012, 11:57:26 AM
I don't think the whole pdf-creation is using any templates which can be overridden.

My logo is way too big, while in the vendor folder the size is good (90x90 in the vendor folder and 60x60 in vendor/resized). In the pdf the image is blown up to width 391x143, and only the top third of the image is displayed, showing nasty pixels. No vendor info is displayed at all.
Title: Re: What/where is generating the invoice PDF
Post by: john2012 on July 21, 2012, 21:32:27 PM
Quote from: carsten888 on July 06, 2012, 11:57:26 AM
I don't think the whole pdf-creation is using any templates which can be overridden.
My logo is way too big, while in the vendor folder the size is good (90x90 in the vendor folder and 60x60 in vendor/resized). In the pdf the image is blown up to width 391x143, and only the top third of the image is displayed, showing nasty pixels. No vendor info is displayed at all.

I have exactly the same problem of size of logo vendor
Have you one track(runway) of solution? for fix
(sorry for my bad english)
thank s

VIrtuemart 2.0.8e
Title: Re: What/where is generating the invoice PDF
Post by: carsten888 on July 22, 2012, 08:37:16 AM
no
Title: Re: What/where is generating the invoice PDF
Post by: Bremzy on July 25, 2012, 00:40:32 AM
I have the same problem. Any solution?
Title: Re: What/where is generating the invoice PDF
Post by: carsten888 on July 25, 2012, 13:13:32 PM
no.

I had another look at this. I agree with alf1234, pdf can't be overriden. (version 2.0.8c)

According to this post
http://forum.virtuemart.net/index.php?topic=98841.msg326744#msg326744
you can easily check the output with this type of url:
(order number and pass can be found in the vm backend > orders > order)

the invoice:
index.php?option=com_virtuemart&view=invoice&layout=invoice&tmpl=component&order_number=7b178794&order_pass=p_38764e

the pdf of the invoice:
index.php?option=com_virtuemart&view=invoice&layout=invoice&tmpl=component&order_number=7b178794&order_pass=p_38764e&format=pdf

I'm using a template override to hide the SKU column (clients don't need to see that, would be nice to have this optional in the VM config).
In the normal order view, the column is gone. In the pdf format, the column is there again.
Title: Re: What/where is generating the invoice PDF
Post by: WebStuff on December 04, 2012, 12:32:45 PM
For those struggling with the pdf invoice picture size there is a setting in /[YOUR_SITE_ROOT]/components/com_virtuemart/controllers/invoice.php
around line 146:
$pdf->SetHeaderData($imagePath, 60, $view->vendor->vendor_store_name, $view->vendorAddress);

It appears to me the 60 in this line is actually a width setting for the picture as if I reduce this to 30 the whole of my image is displayed.
First picture is with it left at 60 the second is with it set at 30. You can maybe try experimenting with higher or lower values to see what works for you.

Don't know why there isn't a height option for specifying the header height but I'll keep digging.

This is in the controllers folder so I don't think it can be overridden so you'll have to change this each upgrade.

Hope this helps.


[attachment cleanup by admin]
Title: Re: What/where is generating the invoice PDF
Post by: caquita16 on December 08, 2012, 21:40:43 PM
Hi, I have a similar problems.

How I can remove extra space before and after to vendor details in PDF invoice?
(com_virtuemart/views/invoice/tmpl/invoice.php)


When I make a pdf invoice, VM include uncomfortable spaces (image-1).

I've been trying remove that myself but I've not could. I was modifying this file: "com_virtuemart/views/invoice/tmpl/invoice.php".
<?php
/**
 *
 * Order detail view
 *
 * @package    VirtueMart
 * @subpackage Orders
 * @author Max Milbers, Valerie Isaksen
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: details.php 5412 2012-02-09 19:27:55Z alatak $
 */
//index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&order_number=xx&order_pass=p_yy
//
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
JHTML::stylesheet('vmpanels.css'JURI::root() . 'components/com_virtuemart/assets/css/');
if (
$this->_layout == "invoice") {
    
$document JFactory::getDocument();
    
$document->setTitle(JText::_('COM_VIRTUEMART_ORDER_PRINT_PO_NUMBER') . ' ' $this->orderDetails['details']['BT']->order_number ' ' $this->vendor->vendor_store_name);
//$document->setName( JText::_('COM_VIRTUEMART_ACC_ORDER_INFO').' '.$this->orderDetails['details']['BT']->order_number);
//$document->setDescription( JText::_('COM_VIRTUEMART_ORDER_PRINT_PO_NUMBER').' '.$this->orderDetails['details']['BT']->order_number);
}

if (
$this->headFooter) {
    
?>

<div class="vendor-details-view">
    <h1><?php echo $this->vendor->vendor_store_name;
        if (!empty(
$this->vendor->images[0])) {
            
?>

            <div class="vendor-image">
                <?php echo $this->vendor->images[0]->displayMediaThumb(''false); ?>
            </div>
            <?php
        
}
        
?>
    </h1>
<div class="vendor-details-address">
<?php //Attention this is removed, please use directly
//echo $this->vendorAddress;
echo shopFunctions::renderVendorAddress($this->vendor->virtuemart_vendor_id'<br />');
?>

</div>
</div>

<div class="vendor-description">
<?php //echo $this->vendor->vendor_store_desc.'<br>';


    /* foreach($this->vendorAddress as $userfields){

         foreach($userfields['fields'] as $item){
             if(!empty($item['value'])){
                 if($item['name']==='agreed'){
                     $item['value'] =  ($item['value']===0) ? JText::_('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_NO'):JText::_('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_YES');
                 }
             ?>
<!-- span class="titles"><?php echo $item['title'?></span -->
                         <span class="values vm2<?php echo '-'.$item['name'?>" ><?php echo $this->escape($item['value']) ?></span>
                     <?php if ($item['name'] != 'title' and $item['name'] != 'first_name' and $item['name'] != 'middle_name' and $item['name'] != 'zip') { ?>
                         <br class="clear" />
                     <?php
                 
}
             }
         }
     }*/
}
?>
</div> <?php


if ($this->print) {
    
?>


<body onload="javascript:print();">

<div class='spaceStyle'>
    <?php
//  echo require(__DIR__.'/mail_html_shopper.php');
    
?>

</div>
<div class='spaceStyle'>
    <?php
    
echo $this->loadTemplate('order');
    
?>

</div>

<div class='spaceStyle'>
    <?php
    
echo $this->loadTemplate('items');
    
?>

</div>
    <?php    //echo $this->vendor->vendor_legal_info; ?>
</body>
<?php
} else {

    
?>


<?php

    
echo $this->loadTemplate('order');

    
?>



<div class='spaceStyle'>
<?php

    $tabarray 
= array();

    
$tabarray['items'] = 'COM_VIRTUEMART_ORDER_ITEM';
    
$tabarray['history'] = 'COM_VIRTUEMART_ORDER_HISTORY';

    
shopFunctionsF::buildTabs$this$tabarray);
    echo 
'</div>
    <br clear="all"/><br/>'
;
}

if (
$this->headFooter) {
    echo 
$this->vendor->vendor_legal_info;
}

?>


But I'm not sure that this .php have the key.

Can you help me in this?

Thanks.

I use VM 2.0.14 on Joomla! 2.5.8.

[attachment cleanup by admin]
Title: Re: What/where is generating the invoice PDF
Post by: randomdev on December 13, 2012, 04:43:26 AM
I am having the same problem with spacing.
Title: Re: What/where is generating the invoice PDF
Post by: edensan on March 18, 2014, 19:49:55 PM
still no solution for this??

gr edensan
Title: Re: What/where is generating the invoice PDF
Post by: jenkinhill on March 18, 2014, 20:10:30 PM
ERrrr solution for what? This thread is over a year old.....
Title: Re: What/where is generating the invoice PDF
Post by: edensan on March 19, 2014, 08:58:12 AM
the fact that my manufactorslogo is way big

if i set under configuration template then also my productimages are small

so product image must be 360x360

and logo must be 100x100

how do i do that?

gr edensan

[attachment cleanup by admin]
Title: Re: What/where is generating the invoice PDF
Post by: jenkinhill on March 19, 2014, 09:46:06 AM
Edit the header file to include in-line css for the image size. See components/com_virtuemart/views/invoice/tmpl/mail_html_header.php which already has this code to set the image width to the size of the original image.
" style="width: <?php echo $this->vendor->vendor_letter_header_imagesize; ?>mm;"

Use the edited file as a template override - see http://docs.virtuemart.net/tutorials/33-templating-layouts.html and http://www.ostraining.com/blog/joomla/overrides
Title: Re: What/where is generating the invoice PDF
Post by: edensan on March 19, 2014, 16:13:41 PM
i did change the file from:

" style="width: <?php echo $this->vendor->vendor_letter_header_imagesize?>mm;"

to:


" style="width: 70 mm;"

no change on the pdf invoice stil verry big logo

what am i doing wrong?

joomla 2.5.16
vm 2.0.26d


gr and thanks for effort so far... appreciated
Title: Re: What/where is generating the invoice PDF
Post by: jenkinhill on March 19, 2014, 22:52:18 PM
Don't confuse px with mm. I suspect you need to use px in your style, and I'd use both height and width.
Title: Re: What/where is generating the invoice PDF
Post by: fit on February 17, 2015, 07:21:47 AM
I still have the same issue a year later..... editing both templates has no effect on the pdf invoice generated. The pdf id currently very unformatted and not suitable for use with clients.

VM 2.6.14

Did anyone find a solution?
Title: Re: What/where is generating the invoice PDF
Post by: carsten888 on February 17, 2015, 08:20:54 AM
no. I gave up. Clients just get a silly looking invoice.

But then again, the huge pixalated image is sort of trendy, so maybe no one notices the image is just wrong.

Too bad about the SKU showing on the invoice. Online I can hide that with css/javascript, but not in the pdf.
Title: Re: What/where is generating the invoice PDF
Post by: AH on February 17, 2015, 10:34:41 AM
QuoteToo bad about the SKU showing on the invoice.

Create a template override - Copy :-
invoice_items.php

to:

templates/YOURTEMPLATE/html/com_virtuemart/invoice/invoice_items.php

And remove the sku elements


QuoteOnline I can hide that with css/javascript, but not in the pdf.

Again create an override - Copy :- details_items.php

to

templates/YOURTEMPLATE/html/com_virtuemart/orders/details_items.php

And remove the sku elements
Title: Re: What/where is generating the invoice PDF
Post by: carsten888 on February 17, 2015, 11:31:24 AM
@hutson
thank you, but that won't remove the sku from the pdf
Title: Re: What/where is generating the invoice PDF
Post by: AH on February 17, 2015, 11:36:20 AM
Have you tried it??
Title: Re: What/where is generating the invoice PDF
Post by: carsten888 on February 17, 2015, 11:38:57 AM
yes
http://forum.virtuemart.net/index.php?topic=101821.msg352251#msg352251
unless this has changed in VM3.
Title: Re: What/where is generating the invoice PDF
Post by: AH on February 17, 2015, 12:10:03 PM
Have any of your invoice overrides functioned?

invoice_items.php

Invoice - PDF creation calls this file for its order line details

<td align="left" width="5%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SKU'?></strong></td>

AND

Quote<?php echo $item->order_item_sku; ?>