Barcode on delivery note with VM IDnR Addon

Before you ask about IDnR Addon see the VirtueMart - Invoice, Delivery Note and Receipt Addon
webmastergreg
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 16 Apr 2012, 22:52

Barcode on delivery note with VM IDnR Addon

Post by webmastergreg »

Hello,

first of all, thank you very much for this awesome plugin (VM IDnR Addon) that is perfect for our needs.

So my goal is to have on the Delivery note a barcode (C39) for a concatenation of the $a['order_id'] and $a['delivery_id'].
Because we already scan our shipping ID (TNT) but we also need to scan the Reference of the Delivery note to fill the field in our TNT dashboard.

So I've seen that the TCPDF barcode call was already here in plugins/phocapdf/virtuemart.php and I tweak it just a little bit, and managed to have a barcode on the footer.

Code: Select all

			//$barcode = '4483-499';
		// define barcode style
		$style = array(
    	'text' => true,
    	'label' => $barcode,
    	'font' => 'helvetica',
    	'fontsize' => 8,
    	'stretchtext' => 3
			);

			if (!empty($barcode)) {
				$this->Ln($line_width);
				$barcode_width = round(($this->getPageWidth() - $ormargins['left'] - $ormargins['right'])/3);
				$this->write1DBarcode($barcode, 'C39', $this->GetX(), $cur_y + $line_width, $barcode_width, (($this->getFooterMargin() / 3) - $line_width), 0.3, $style, 'N');	
			}
That's ok, but now we need to feed the barcode with the goods $a['order_id'] and $a['delivery_id'] so I tried :
in: plugins/phocapdf/virtuemart/virtuemartpdfoutput.php line399

Code: Select all

$a['orderdel_c39']  = $this->getBarC39( $a['orderdel_c39'] );
($a['orderdel_c39'] is the concatened result that I want)

With this on line 233 of the virtuemart.php

Code: Select all

	function getBarC39($bc) {
			//$barcode = $this->getBarC39();
		// define barcode style
		$style = array(
    	'text' => true,
    	'label' => $bc,
    	'font' => 'helvetica',
    	'fontsize' => 8,
    	'stretchtext' => 3
			);

			if (!empty($bc)) {
				$this->Ln($line_width);
				$barcode_width = round(($this->getPageWidth() - $ormargins['left'] - $ormargins['right'])/3);
				$this->write1DBarcode($bc, 'C39', $this->GetX(), $cur_y + $line_width, $barcode_width, (($this->getFooterMargin() / 3) - $line_width), 0.3, $style, 'N');	
			}
			return $bc;
		}
So yes it works, but barcode appear on the very top left of the PDF.

Could you please advice about the best method to use to get this work correctly please ?
I think I miss something....very simple, but I'm bit confused about which file is the king in this issue.

Thanks in advance.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Barcode on delivery note with VM IDnR Addon

Post by Jan »

Hi, unfortunatelly, I have no experiences with the barcode and positioning of elements needs to be done per tests (set the position and test if it fits your needs :-( )

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