How to add extra information field invoice to pdf

  • Posts: 138
  • Thank you received: 1
9 years 6 months ago #175420

-- HikaShop version -- : 2.3.3
-- Joomla version -- : 2.5.19
-- PHP version -- : ?
-- Browser(s) name and version -- : all
-- Error-message(debug-mod must be tuned on) -- : not

Hello,

When a customer orders a product in the webshop they get an confirmation e-mail including the pdf. In our webshop it is possible for people to ad some text that gets included in the confirmation e-mail. (this option is called field in the backend of hikashop.)

So whe would like to get this information not only in the e-mail but also in the pdf. However we can not find the code responisble for this. Can you tell uss what the code is or where we can find it?

Thanks already!

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
9 years 6 months ago #175431

Hi,

You can find the file "invoice.php" to generate the PDF invoice from the PDF invoice plugin of Hikashop in the folder plugins/hikashop/attachinvoice/attachinvoice/ of your website.
The order data is available in the variable $order in that file

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

  • Posts: 138
  • Thank you received: 1
9 years 6 months ago #175565

Hello yes we understand that we have to adapt the invoice.php file. to change the pdf. However there is no data in this file for the comments that people at in the field option at the checkout. This information is only showed in the e-mail not in the pdf!

So we like to know where this e-mail gets his data from. (wich file) and were in this file it is giving info about the extra field part. So we can copy this and put it in the invoice.php file. :)

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

  • Posts: 12953
  • Thank you received: 1778
9 years 6 months ago #175571

Hello,

So we like to know where this e-mail gets his data from. (wich file) and were in this file it is giving info about the extra field part. So we can copy this and put it in the invoice.php file. :)

You'll just have to edit the "plugins/hikashop/attachinvoice/attachinvoice/invoice.php" file, here are the lines which are displaying the "extra field part" :
<fieldset class="hikashop_order_custom_fields_fieldset">
		<legend><?php echo JText::_('ADDITIONAL_INFORMATION'); ?></legend>
		<table class="hikashop_order_custom_fields_table adminlist" cellpadding="1" width="100%">
			<?php foreach($fields['order'] as $fieldName => $oneExtraField) {
				if(!@$oneExtraField->field_frontcomp || empty($order->$fieldName)) continue;
			?>
				<tr class="hikashop_order_custom_field_<?php echo $fieldName;?>_line">
					<td class="key">
						<?php echo $fieldsClass->getFieldName($oneExtraField);?>
					</td>
					<td>
						<?php echo $fieldsClass->show($oneExtraField,$order->$fieldName); ?>
					</td>
				</tr>
			<?php }	?>
		</table>
	</fieldset>

Last edit: 9 years 6 months ago by nicolas.

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

  • Posts: 138
  • Thank you received: 1
9 years 6 months ago #176372

Hello,

Thanks for your reaction. We did place the code in the invoice.php file and part of the stuff worked. What happends:

It is showing the first sentence of the extra field name.
It is not showing the second line of the fiels name.
It is also not showing the comment that people put into this field.

The field is also showing in the pdf when people do not put any comment into the field. Wich shouldnt be eather.

How is this possible as it should be the same code?

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
9 years 6 months ago #176404

Hi,

The forum engine stripped the

['order']
part of the code Mohamed gave you.
I believe that it's why it's not working properly.
Also, there should also be some extra code around that code:
<?php if(hikashop_level(2) && !empty($fields['order'])){?>
	<fieldset class="hikashop_order_custom_fields_fieldset">
		<legend><?php echo JText::_('ADDITIONAL_INFORMATION'); ?></legend>
		<table class="hikashop_order_custom_fields_table adminlist" cellpadding="1" width="100%">
			<?php foreach($fields['order'] as $fieldName => $oneExtraField) {
				if(!@$oneExtraField->field_frontcomp || empty($order->$fieldName)) continue;
			?>
				<tr class="hikashop_order_custom_field_<?php echo $fieldName;?>_line">
					<td class="key">
						<?php echo $fieldsClass->getFieldName($oneExtraField);?>
					</td>
					<td>
						<?php echo $fieldsClass->show($oneExtraField,$order->$fieldName); ?>
					</td>
				</tr>
			<?php }	?>
		</table>
	</fieldset>
	<br/>
	<?php } ?>
Note that this code is already in the attachinvoice/invoice.php file so if you don't have it, it means that you have an old version of the plugin and you might be missing something else in the code of the plugin for that code to work properly.

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

  • Posts: 138
  • Thank you received: 1
9 years 6 months ago #176530

Hi we have the latest update. The code is already in the file but nothing is working. With the first code we got at least a part of the code was showing but right now we dont get any result. The complete extra field is not showing. Is there something blocking it?

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
9 years 6 months ago #176665

When you update HikaShop it doesn't update the PDF invoice plugin. Do you have the latest version of the plugin ?
Do you have the line $fields = $fieldsClass->getFields('backend',$order,'order'); in the attachinvoice.php file of the plugin ?

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

  • Posts: 138
  • Thank you received: 1
9 years 6 months ago #176819

Hi thanks for the answer. No we dont have this in the code so i think we dont have the last plugin. However if i go to our products in the menu above we only see the bussinesupload. NOt the plugin.

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
9 years 5 months ago #176825

The PDF invoice sale is not a subscription so that's why you don't see it there.
Please use our contact form to request the latest version with your order number and a link to this thread :
www.hikashop.com/support/contact-us.html

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

Time to create page: 0.089 seconds
Powered by Kunena Forum