Author Topic: What/where is generating the invoice PDF  (Read 12070 times)

zebrafilm

  • Jr. Member
  • **
  • Posts: 58
What/where is generating the invoice PDF
« 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

Marius

  • Beginner
  • *
  • Posts: 21

zebrafilm

  • Jr. Member
  • **
  • Posts: 58
Re: What/where is generating the invoice PDF
« Reply #2 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)




 

zebrafilm

  • Jr. Member
  • **
  • Posts: 58
Re: What/where is generating the invoice PDF
« Reply #3 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

alf1234

  • Beginner
  • *
  • Posts: 16
Re: What/where is generating the invoice PDF
« Reply #4 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)

carsten888

  • Jr. Member
  • **
  • Posts: 199
    • pages-and-items.com
Re: What/where is generating the invoice PDF
« Reply #5 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.

john2012

  • Beginner
  • *
  • Posts: 6
Re: What/where is generating the invoice PDF
« Reply #6 on: July 21, 2012, 21:32:27 pm »
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

carsten888

  • Jr. Member
  • **
  • Posts: 199
    • pages-and-items.com
Re: What/where is generating the invoice PDF
« Reply #7 on: July 22, 2012, 08:37:16 am »
no

Bremzy

  • Beginner
  • *
  • Posts: 13
Re: What/where is generating the invoice PDF
« Reply #8 on: July 25, 2012, 00:40:32 am »
I have the same problem. Any solution?

carsten888

  • Jr. Member
  • **
  • Posts: 199
    • pages-and-items.com
Re: What/where is generating the invoice PDF
« Reply #9 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.

mirrorsandglass

  • Jr. Member
  • **
  • Posts: 149
  • Time Is Precious, Waste It Wisely
Re: What/where is generating the invoice PDF
« Reply #10 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:
Code: [Select]
$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.

caquita16

  • Beginner
  • *
  • Posts: 2
Re: What/where is generating the invoice PDF
« Reply #11 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".
Code: [Select]
<?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.

randomdev

  • Jr. Member
  • **
  • Posts: 90
Re: What/where is generating the invoice PDF
« Reply #12 on: December 13, 2012, 04:43:26 am »
I am having the same problem with spacing.

edensan

  • Beginner
  • *
  • Posts: 12
Re: What/where is generating the invoice PDF
« Reply #13 on: March 18, 2014, 19:49:55 pm »
still no solution for this??

gr edensan

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 24513
  • On vacation
    • Jenkin Hill Internet
Re: What/where is generating the invoice PDF
« Reply #14 on: March 18, 2014, 20:10:30 pm »
ERrrr solution for what? This thread is over a year old.....
Kelvyn
Jenkin Hill Internet,
Keswick, Lake District

Unsolicited PMs/emails will be ignored.

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

Currently using VM3.0.17 on Joomla 3.5.1 PHP 5.5.30

Testing VM3.0.17 on Joomla 3.5.1