Show the number of guests on invoice_customer_pdf.php

More
6 years 7 months ago #10197 by gmonamour
Hi,
I need the number of guests on my personal invoice.
So I've tried to get it by using a piece of code kept from reservation_complete_customer_pdf.php file
<?php foreach ($displayData['reservation']->reserved_room_details as $room) : ?>
	<p>
					<?php echo JText::_("SR_ADULT_NUMBER") . ': ' . $room->adults_number ?>
				</p>

                <?php if ($room->children_number > 0) : ?>
				<p>
					<?php echo JText::_("SR_CHILDREN_NUMBER") . ': ' . $room->children_number ?>
				</p>
				<?php foreach ($room->other_info as $info) : ?>
					<ul>
						<?php if (substr($info->key, 0, 5) == 'child') : ?>
							<li>
								<?php echo JText::_('SR_' . $info->key) . ': ' . JText::plural('SR_CHILD_AGE_SELECTION', $info->value) ?>
							</li>
						<?php endif; ?>
					</ul>
				<?php endforeach; ?>
                <?php endif; ?>
	<?php endforeach; ?>
But it does not get the information.
I suppose that it is not supported on the invoice_customer_pdf.php file.
Could you help me to achieve that information?
Thanks a lot in advance
My best regards

My site with Solidres www.gmonamour.it/

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

More
6 years 7 months ago #10205 by solidres
Hi,

You can modify this file to query more information so that you can add it into your invoice template:

/plugins/solidres/invoice/invoice.php (method onSolidresGenerateInvoice())

Regards,

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

More
6 years 7 months ago #10223 by gmonamour
Hi,
I'm not so good in PHP so your solution is too much difficult for me.
So, I thought to add this code in the invoice_customer_pdf.php file
$database = &JFactory::getDBO();
$database->setQuery("SELECT children_number FROM #__sr_reservation_room_xref 
  WHERE reservation_id = '" . $reservationId . "'");
echo $database->loadResult();
It works but I'm not be able to get the id of the reservation (that I need to put into $reservationId).
I've tried with that
$reservationId = $displayData['reservation']->id;
But the result is null
Could you help me to get the reservation id code, please?
Thanks a lot

My site with Solidres www.gmonamour.it/

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

More
6 years 7 months ago #10225 by solidres
Hi,

This variable is correct: $displayData->id

It is null because it need to be called via JLayout, not called directly, please refer to our existing code for more details.

Regards,

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

More
6 years 7 months ago #10230 by gmonamour
Hi,
please, help me more, please!
Thanks a lot

My site with Solidres www.gmonamour.it/

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

More
6 years 7 months ago #10231 by gmonamour
Hi,
wait, maybe I am arrived!

My site with Solidres www.gmonamour.it/

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

Moderators: solidres
Powered by Kunena Forum

All the things you need to make your work easier. Did you like Solidres?