Jump to content

Phone format with prefix in PDF invoice


Recommended Posts

Hello,

I need to have in my PDF invoice instead of phone number eg.: '123456789',

phone number with prefix eg.: 'tel: 123456789'

 

I can't find solution. Please help me find code where it is possible to change it.

 

Thanks

 

Milan

Link to comment
Share on other sites

Can you screen the spot you mention? It should be enough to modify the invoice tpl inside the /pdf/ folder, or the php of the class if you mean the address

 

This is example of my PDF Invoice address. Last two numbers are mobile phone and our national VAT number (IČO). These two numbers are very similar. I would like to distinguish these numbers with prefixes 
IČO: 723836xx
tel: 7345080xx

 

 

PDF_faktura.PNG

Link to comment
Share on other sites

Thank you for your suggestions. There was neccessary to make these changes in classes/pdf/HTMLTemplateInvoice.php

public function getContent()
	{
		$country = new Country((int)$this->order->id_address_invoice);
		$invoice_address = new Address((int)$this->order->id_address_invoice);		
		$formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' ');
		
		$state_pos1 = strpos($formatted_invoice_address,"Czech Republic"); // find position of word "Czech Republic" in address
		$str_tel_ico = substr($formatted_invoice_address,$state_pos1 + 20); // 20 characters plus this position
		$str_tel_ico_mod = 'tel: ' . $str_tel_ico; //add to the beginning "tel: "
		
		$ICO_position = strpos($str_tel_ico_mod,"<br />"); // find position of word "<br />"
		if ($ICO_position > '0'){
			$str_ico = substr($str_tel_ico_mod,$ICO_position + 6); // 6 characters plus this position
			$str_ico_mod = 'IČO: ' . $str_ico; //add to the beginning "IČO:"		
			$str_tel_ico_mod = str_replace($str_ico,$str_ico_mod,$str_tel_ico_mod); 
			}
		$formatted_invoice_address = str_replace($str_tel_ico,$str_tel_ico_mod,$formatted_invoice_address); 
		
		
		$formatted_delivery_address = '';
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...