Add custom field to PDF invoice

  • Posts: 251
  • Thank you received: 2
9 years 2 months ago #215353

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.3

Hi,
I created a custom field to get VAT number from my client. It appears correctly in the registration form and also in the order's administration, but it not appear in the PDF invoice within the invoice address and shipping address.

How can i add this field?
Thank you so much.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 2 months ago #215355

Hi,

To customize the PDF invoice, you need to modify directly the plugin or create an internal file for override.
See : www.hikashop.com/forum/4-how-to/879392-t...f-plugin.html#214817

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: Nello

Please Log in or Create an account to join the conversation.

  • Posts: 251
  • Thank you received: 2
9 years 1 month ago #215416

Hi,
i'm sorry but I don't know how to get the value of field "address_vat" from the table "address" in the invoice.php file.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 1 month ago #215418

Hi,

It looks like you managed to do that:
www.hikashop.com/forum/4-how-to/9505-pdf...html?start=20#215417

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: Nello

Please Log in or Create an account to join the conversation.

  • Posts: 251
  • Thank you received: 2
9 years 1 month ago #215467

I solved editing the plugin invoice.php as below

	<table class="addresses">
		<tr>
			<?php
			$addresses = array('billing_address','shipping_address');
			foreach($addresses as $oneAddress){
			if(empty($order->$oneAddress)) continue;
			if ($oneAddress=='shipping_address' && empty($pluginsShipping)) continue; ?>
			<td valign="top">
				<fieldset>
				<legend><?php echo JText::_('HIKASHOP_'.strtoupper($oneAddress)); ?></legend>
					<?php
					if(!empty($order->$oneAddress->address_company)) echo $order->$oneAddress->address_company.'<br/>';
					echo $order->$oneAddress->address_title.' '.$order->$oneAddress->address_firstname.' '.$order->$oneAddress->address_lastname.'<br/>';
					echo $order->$oneAddress->address_street.'<br/>';
					echo $order->$oneAddress->address_post_code.' '.$order->$oneAddress->address_city.' '.$order->$oneAddress->address_state.'<br/>';
					echo $order->$oneAddress->address_country.'<br/>';
					if(!empty($order->$oneAddress->address_telephone)) echo JText::sprintf('TELEPHONE_IN_ADDRESS',$order->$oneAddress->address_telephone).'<br/>';
					if(!empty($order->$oneAddress->address_vat)) echo JText::_('VAT_NUMBER').' : '.$order->$oneAddress->address_vat.'<br/>';
					?>
				</fieldset>
			</td>
			<?php } ?>
		</tr>
	</table>
So, I can have all the fiscal fields needed in my invoice, but not in the shipping note.

Thank you.

Last edit: 9 years 1 month ago by Jerome. Reason: [code] is nice

Please Log in or Create an account to join the conversation.

Time to create page: 0.048 seconds
Powered by Kunena Forum