Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

pdf invoices for admin only


GemRock

Recommended Posts

Hello!

 

Would be possible show order comments into pdf invoice?

 

Thanks :)

 

there is no reason why comments can't be shown in pdf invoices, although I haven't implemented it and there is no site asking for this as yet.

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

  • Replies 74
  • Created
  • Last Reply

Top Posters In This Topic

Great contrib.

Can you tell me how...

 

i am very sorry but i am afraid i dont have the time to cover customisation of the pdf invoice - 100 shops could have 100 different ideas about what it'd look like. i can only try to answer questions RE installation issues.

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

  • 3 months later...

Thanks for your contrib, Ken.

It all works well after a bit of tweaking and customization for multi-language site and the printed pdf file certainly looks a lot better than the page dump I was using as an invoice!

Mike

Link to comment
Share on other sites

am recieving this error:

 

FPDF error: Missing or incorrect image file: images/br_banner.jpg

 

even after checking post #3 and this is want I have in that file:

 

define('PDF_INVOICE_IMAGE', 'store_images/images/br_banner.jpg');

 

that is the location for that image. So am I missing something?

 

Thanks.

 

Bennett

Link to comment
Share on other sites

...define('PDF_INVOICE_IMAGE', 'store_images/images/br_banner.jpg');...

only you know, where & what is this "store_images" defined?

and after several months you still cant get it work??

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

I did remove it some back because of doing some chages to site, but decided to reinstall this mod. Your post # 3 refers to this code in invoice_pdf.php

 

define('INVOICE_TEXT_THANK_YOU', 'Thank you for shopping at');

define('STORE_URL_ADDRESS', 'http://www.yoursite.co.uk');

define('PDF_INV_FOOTER_TEXT', INVOICE_TEXT_THANK_YOU." ".STORE_NAME . ' (your VAT number if any)');

define('PDF_INVOICE_IMAGE', 'images/oscommerce.png');

 

I changed the image file name to br_banner.jpg as this:

 

define('INVOICE_TEXT_THANK_YOU', 'Thank you for shopping at');

define('STORE_URL_ADDRESS', 'http://brs-giftshop.com');

define('PDF_INV_FOOTER_TEXT', INVOICE_TEXT_THANK_YOU." ".STORE_NAME . ' (your VAT number if any)');

define('PDF_INVOICE_IMAGE', 'store_images/images/br_banner.jpg');

 

The reason why I use store_images/images/br_banner.jpg, because that is where it is located. I do assume we can use our own image in place of the oscommerce image file.

Link to comment
Share on other sites

I did remove it some back because of doing some chages to site, but decided to reinstall this mod. Your post # 3 refers to this code in invoice_pdf.php

 

 

 

I changed the image file name to br_banner.jpg as this:

 

 

 

The reason why I use store_images/images/br_banner.jpg, because that is where it is located. I do assume we can use our own image in place of the oscommerce image file.

 

 

Thanks, I have it working now.

Link to comment
Share on other sites

Thanks, I have it working now.

what i said in post #3 is quite general:

Open [admin]/invoice_pdf.php, edit lines 15 to 25 for your shop and your taste (font & colour).
which does not say specifically how you would customise it further.

the error msg you posted does not refer to the folder store_images. you could have simply uploaded the logo to every images folder one of which would work if you dont bother to find out exactly which folder it looks for the logo in. anyway, glad you make it work now.

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

  • 1 month later...
If what you want is nothing more than print/save invoices from admin, and do not want to make lots of changes to your shop, especially database changes, to achieve this little tiny thing, then this is the contribution for you.

 

Here is the installation instruction (if you need it) that is not included in the package:

see it

Link to comment
Share on other sites

  • 1 month later...

I have installed the script works great other than the image. I called the image oscommerce.jpg which just replaced the one in your script so that it shows. Which it does, the only problem is despite the image being saved at 300dpi it shows really pixilated. Is there anywhere within the script that can stop this from happening and give a much better image quality.

 

Thanks Phil

Link to comment
Share on other sites

..the only problem is despite the image being saved at 300dpi it shows really pixilated...

 

if your logo quality is good and is not the same size as the original oscommerce.png but shows up in the invoice not as the original size, ie, bigger, then try to change line 104:

$size[0]*PDF_INV_IMG_CORRECTION

which is width, and

$size[1]*PDF_INV_IMG_CORRECTION

which is height, to a number that reflects your logo size. i am not sure what the unit of size there would be, but it seems to be, eg, for 100px you would enter 25. try different number to see which one fits.

 

Ken

Edited by GemRock

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

  • 4 weeks later...

Hello All,

 

Many thanks for this contribution.

 

Is there a way to get the product's image (small) to show on the pdf invoice INSTEAD of the product name ?

 

 

I already have the product images showing up in the standard oscommerce image by using the invoice image contribution ( http://addons.oscommerce.com/info/2904 ) which wrks fine.

Link to comment
Share on other sites

Is there a way to get the product's image (small) to show on the pdf invoice

there is a will there is a way. but would it be worth the effort? if there are quite a few products on the invoice then the problem it creates could be more than it solves.

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

  • 2 months later...

I have problems in this contribution with the MVS(MultiVendorShiping).

 

Making and order on web with the normal shoping process , when clickig create PDF on admin it works.

 

But if the customers uses MVS options and finalice the order. Then in admin I click on CretePDF and there is not products. All cell in white!!! (extrange)

 

The lines of pdf_invoice.php are these:

 

//Show the products information line by line
.
.
$pdf->MultiCell(18,6,$order->products[$i]['model'],1,'L', '1');
.
.
$pdf->MultiCell(9,6,$order->products[$i]['qty'],1,'C', '1');
.
.
$pdf->MultiCell(128,6,substr($order->products[$i]['name'],0,60),1,'L', '1');
.
.
etc.

Link to comment
Share on other sites

its not been tested on MVS so sorry dont know whats the problem. I wish i had the time to look into it.

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

  • 2 months later...

Hi Ken,

 

Not sure if this is still actively supported, but I previously had this running perfectly in conjunction with PDF Customer Invoices v1.2, but I switched my site to a new domain name and PHP5 earlier this year, and this is now the only thing left that isn't working. I stayed with the same service provider, but just moved to a new domain.

 

As far as I can tell, the only difference between the new and old domain is that I plumped for PHP5 this time. Unfortunately, I am getting the dreaded: FPDF error: Some data has already been output, can't send PDF file and I have uninstalled and reinstalled, but to no avail, and just can't fathom why just a straight swap over will have broken this excellent add-on.

 

Any ideas?

 

Jonathan

Link to comment
Share on other sites

  • 2 months later...

the error tells you quite clearly: the image (invoice_logo.jpg) file referred to in the invoice_pdf.php was not there (admin/images/).

 

 

 

Ken

 

Thanks.. realised that the error comes from the missing logo. Make sure to insert the logo in your images/ folder and if you have SSL enabled, also paste it into your public_ssl/images/ folder.

Edited by akakai
Link to comment
Share on other sites

  • 4 months later...

My pdf invoice is missing some text - only showing Sold to:, Deliver to:, Order:# and all the rest of the invoice fields like items and so is missing

My shops address, e-mail and so on is however showing

 

The PDF packing slip is showing correctly with all fields

 

Where can I start to solve this?

 

Please I need help

Getting the Phoenix off the ground

Link to comment
Share on other sites

  • 1 month later...

if your logo quality is good and is not the same size as the original oscommerce.png but shows up in the invoice not as the original size, ie, bigger, then try to change line 104:

$size[0]*PDF_INV_IMG_CORRECTION

which is width, and

$size[1]*PDF_INV_IMG_CORRECTION

which is height, to a number that reflects your logo size. i am not sure what the unit of size there would be, but it seems to be, eg, for 100px you would enter 25. try different number to see which one fits.

 

Ken

 

Ken,

 

I've been havng the same problem with the blurry image. Though I cannot find the PDF_INV_IMG_CORRECTION in my files. The pieces of code related to the images I see are:

	//Put an image on the page
if(!isset($this->images[$file]))
{
	//First use of image, get info
	if($type=='')
	{
		$pos=strrpos($file,'.');
		if(!$pos)
			$this->Error('Image file has no extension and no type was specified: '.$file);
		$type=substr($file,$pos+1);
	}
	$type=strtolower($type);
	$mqr=get_magic_quotes_runtime();
	set_magic_quotes_runtime(0);
	if($type=='jpg' || $type=='jpeg')
		$info=$this->_parsejpg($file);
	elseif($type=='png')
		$info=$this->_parsepng($file);
	else
	{
		//Allow for additional formats
		$mtd='_parse'.$type;
		if(!method_exists($this,$mtd))
			$this->Error('Unsupported image type: '.$type);
		$info=$this->$mtd($file);
	}
	set_magic_quotes_runtime($mqr);
	$info['i']=count($this->images)+1;
	$this->images[$file]=$info;
}
else
	$info=$this->images[$file];
//Automatic width and height calculation if needed
if($w==0 && $h==0)
{
	//Put image at 72 dpi
	$w=$info['w']/$this->k;
	$h=$info['h']/$this->k;
}
if($w==0)
	$w=$h*$info['w']/$info['h'];
if($h==0)
	$h=$w*$info['h']/$info['w'];
$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
if($link)
	$this->Link($x,$y,$w,$h,$link);
}

 

in the classes/fpdf.php

 

and the bit below in pdf_invoice.php

 

global $HTTP_GET_VARS, $highlight_color, $date, $image_function, $customer_id;
//Logo
   $this->$image_function(PDF_INVOICE_IMAGE,44,8, FILENAME_DEFAULT);

 

What can I change or delete in order to stop this code messing around with my image size? I am using a 72 DPI jpeg.

 

Thanks,

Tom

Edited by tfoolen
Link to comment
Share on other sites

...and the bit below in pdf_invoice.php

What can I change or delete in order to stop this code messing around with my image size? I am using a 72 DPI jpeg.

 

Thanks,

Tom

in the file shown above, the full line 104 looks like this (taken from a live shop):

$this->$image_function(PDF_INVOICE_IMAGE,7,10,($size[0]*0.3),($size[1]*0.3),'', FILENAME_DEFAULT);

in the above example, the constant PDF_INV_IMG_CORRECTION has been replaced by actual figures 0.3. try different figures to suit your need.

 

Ken

Edited by GemRock

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...