Customisation of PDF Invoice

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #209241

-- HikaShop version -- : 2.5.0

Hi,

I'm trying to add bank account information to the attached PDF Invoice, but the 'echo $payment->payment_params->information;' is not adding the information to the invoice. I have the same line in the Order Creation Notification Email and that works just fine. I've also tried to replace the last echo line with the second code block below, but that doesn't work either.

Any idea where I'm going wrong?

Thanks,
David

	<?php
		if(!isset($order->order_invoice_number)) $order->order_invoice_number = $order->order_number;
		echo JText::_('DATE').': '.hikashop_getDate($order->order_created,'%d %B %Y ').'<br />';
		echo JText::_('INVOICE').': '.$order->order_invoice_number.'<br />';
		echo JText::_('ORDER_NUMBER').': '.$order->order_number.'<br />';
		
		if (!empty($pluginsShipping))
			echo JText::_('HIKASHOP_SHIPPING_METHOD').': '.$pluginsShipping->getName($order->order_shipping_method, $order->order_shipping_id).'<br />' ;
		if(!empty($pluginsPayment))
			echo JText::_('HIKASHOP_PAYMENT_METHOD').': '.$pluginsPayment->getName($order->order_payment_method, $order->order_payment_id).'<br /><br />';
			
			echo $payment->payment_params->information;
			
	?>

$paymentClass = hikashop_get('class.payment');
$payment = $paymentClass->get($data->order_payment_id);
$payment->payment_params = unserialize($payment->payment_params);
echo $payment->payment_params->information;

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
9 years 4 months ago #209247

Hi,

As you can see in the invoice.php file, the data of the order is stored in the $order variable. So instead of:

$paymentClass = hikashop_get('class.payment');
$payment = $paymentClass->get($data->order_payment_id);
$payment->payment_params = unserialize($payment->payment_params);
echo $payment->payment_params->information;
you want to use:
$paymentClass = hikashop_get('class.payment');
$payment = $paymentClass->get($order->order_payment_id);
$payment->payment_params = unserialize($payment->payment_params);
echo $payment->payment_params->information;

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #209267

Hi,

Tried, but still doesn't work. Any other idea?

//David

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
9 years 4 months ago #209303

Hi,

I don't see why that would work.
It must come from the way you added it to the invoice.
could you provide the code with a few lines before and after so that we can see where you put it in your invoice.php file ?

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #209347

Thanks!

Full code below. Essentially the same as the original. I'm not sure if it makes any difference, but I'm using Hika Market as well.

//David

Code removed by a moderator

Last edit: 9 years 4 months ago by Jerome.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
9 years 4 months ago #209370

Try with that code instead:
$paymentClass = hikashop_get('class.payment');
$payment = $paymentClass->get($order->order_payment_id);
echo $payment->payment_params->information;

I've tested it on my end and it works fine:
take.ms/9QGD9

The following user(s) said Thank You: DavidThor

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #209388

Thanks! Perfect!

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

Time to create page: 0.047 seconds
Powered by Kunena Forum