Invoice - Delivery Note - Question

Before you ask about IDnR Addon see the VirtueMart - Invoice, Delivery Note and Receipt Addon
laurie_lewis
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 06 Jun 2008, 07:07
Location: Australia

Re: Invoice - Delivery Note - Question

Post by laurie_lewis »

Hi Jan,

I have had a little bit of time to begin looking at how I can modify this so that a user can print out an invoice from the account maintenance page. What I have done is to begin with this code:-
[code]
<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
*
* @created For VirtueMart 1.1 created by Jan Pavelka
* @info https://www.phoca.cz/
* @copyright Copyright (C) 2008 Jan Pavelka. All rights reserved.
* @modified by Laurie Lewis to run from Account Maintenance for user access.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @copyright Copyright (C) 2006 Ingemar Fällman. All rights reserved.
* @copyright Copyright (C) 2004-2005 Soeren Eberhardt. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*
* http://virtuemart.net
*/
mm_showMyFileName( __FILE__ );

global $VM_LANG, $mosConfig_live_site;

$order_id = vmGet( $_REQUEST, 'order_id', 0);

// Get Order information
$dbo =& new ps_DB;
$q = "SELECT * FROM #__{vm}_orders WHERE ";
$q .= "#__{vm}_orders.user_id='" . $auth["user_id"] . "' ";
$q .= "AND #__{vm}_orders.order_id='$order_id'";
$dbo->query($q);

if ($dbo->next_record()) {

$user_id = $dbo->f("user_id");

// Get Vendor_to information
$dbv = new ps_DB;
$q = "SELECT * from #__{vm}_vendor ";
$q .= "WHERE vendor_id = '".$_SESSION['ps_vendor_id']."'";
$dbv->query($q);
$dbv->next_record();

// Get Bill_To information
$dbbt = new ps_DB;
$q = "SELECT * FROM #__{vm}_order_user_info WHERE order_id ='$order_id ' ";
$q .= "AND address_type='BT' " ;
$dbbt->query($q);
$dbbt->next_record();

// Get Ship_To information
$dbst = new ps_DB;
$q = "SELECT * FROM #__{vm}_order_user_info WHERE order_id='$order_id' ";
$q .= "AND address_type='ST' " ;
$dbst->query($q);
$dbst->next_record();

// Retrieve Payment Information
$dbpm = new ps_DB;
$q = "SELECT * FROM `#__{vm}_payment_method`, `#__{vm}_order_payment`, `#__{vm}_orders` ";
$q .= "WHERE #__{vm}_order_payment.order_id='$order_id' ";
$q .= "AND #__{vm}_payment_method.payment_method_id=#__{vm}_order_payment.payment_method_id ";
$q .= "AND #__{vm}_orders.user_id='" . $auth["user_id"] . "' ";
$q .= "AND #__{vm}_orders.order_id='$order_id' ";
$dbpm->query($q);
$dbpm->next_record();

require_once( JPATH_COMPONENT.DS.'pdf'.DS.'delivery.pdf.php' );
PhocaDeliveryPDF::createPDF( $VM_LANG, $d, $dbv, $dbo, $dbbt, $dbst, $dbpm, $current_admin_user, $obliterated, $doc);
if ($doc =='') {
exit;
} else {
return true;
}
}
else
{
echo '<h4>'._LOGIN_TEXT .'</h4><br/>';
include(PAGEPATH.'checkout.login_form.php');
echo '<br/><br/>';
}
?>
[/code]

but, unfortunately I have this error message coming up. I have put xampp onto the laptop while I am away from the office and looking at this so not sure if that is the problem, but here is the error message:-

[quote]
Warning: require_once(C:\xampp\htdocs\mdh_test\components\com_virtuemart\pdf\delivery.pdf.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\mdh_test\administrator\components\com_virtuemart\html\account.order_pdf.php on line 64

Fatal error: require_once() [function.require]: Failed opening required 'C:\xampp\htdocs\mdh_test\components\com_virtuemart\pdf\delivery.pdf.php' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\mdh_test\administrator\components\com_virtuemart\html\account.order_pdf.php on line 64
[/quote]

any ideas???

Thanks

Laurie
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Invoice - Delivery Note - Question

Post by Jan »

maybe some files are missed in your server ... :idea:
If you find Phoca extensions useful, please support the project
laurie_lewis
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 06 Jun 2008, 07:07
Location: Australia

Re: Invoice - Delivery Note - Question

Post by laurie_lewis »

Hi Jan,

Can't sleep so looking at this thing again :x :x :x :x .

Of course it could not find the files - it is looking at the component directory not the administrator/component directory. It must be looking there as it is the user and not the administrator that is calling the program - I think anyway - well I guess at best.

I have recreated your pdf directory and files in the /components/com_virtuemart directory. It begins to progress through there ok and then hits the lines of code:--

$pdf->AddPage();
$pdf->SetFont( $pdfFont, "", 12 );

These are in delivery.pdf.php around line 67/68

It gets to these lines and I get the error message
[quote]
Warning: addfont(D:/Inetpub/wwwroot/_OPENSOURCE/tcpdf/fonts/freesans.php): failed to open stream: No such file or directory in /var/www/html/test/mdh/libraries/tcpdf/tcpdf.php on line 1909

Warning: addfont(): Failed opening 'D:/Inetpub/wwwroot/_OPENSOURCE/tcpdf/fonts/freesans.php' for inclusion (include_path='.:/usr/share/pear') in /var/www/html/test/mdh/libraries/tcpdf/tcpdf.php on line 1909
TCPDF error: Could not include font definition file
[/quote]

Any ideas for the dumb beginner. I thought I was making headway but obviously not.

Thanks a lot

Laurie
laurie_lewis
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 06 Jun 2008, 07:07
Location: Australia

Re: Invoice - Delivery Note - Question

Post by laurie_lewis »

Hi again Jan,

I found that I can use the JPATH_COMPONENT_ADMINISTRATOR variable instead of the JPATH_COMPONENT variable to point to the same directory.

I am still having the problem with the path to the fonts :x :x :x .

I know that I am getting the error message as the contents of printpdf.php are not being loaded. I can see that you are calling it as a function, but I have no idea on how to do this or how I can get around it as I am just trying to pass the order number.

Learning - slowly

Laurie
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Invoice - Delivery Note - Question

Post by Jan »

Hi, do you have the name of the font in your xml language file :

langage/your-LANG/your-LANG.xml

?
If you find Phoca extensions useful, please support the project
Post Reply