Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
invoice edit to add a (question) – > company name | Event Espresso - Staging Server

Support

Home Forums Event Espresso Premium invoice edit to add a (question) – > company name

invoice edit to add a (question) – > company name

Posted: September 6, 2013 at 11:10 am

Viewing 3 reply threads


Ion Paciu

September 6, 2013 at 11:10 am

Hi,

I’m trying to add an extra field on the invoice template to display the company name for billing purposes. (the company name is a question name I’ve added on the questions grp).. this question has the question_id=20 in my case

I was able to find an old topic regarding a similar thing here:
http://staging.eventespresso.com/forums/2012/02/invoice-company-not-individual/comment-page-1/#comment-19967

I’ve followed the instruction and managed to add the extra code line in the template pdf. The problem is the regardless the question_id. on my invoice at the field where the company name should appear, the name of the attendy is display. I’ve tried to change the question_id… but still the name is displayed and not the company.

I suspect that I’ve added the code into a wrong place within the invoice template.

The code i’ve used is
[code]
$getCompany = “SELECT * FROM wp_events_answer WHERE registration_id = ‘”.$registration_id.”‘ AND question_id = ’20′”;
$getCompanyDBQ = $wpdb->get_results($getCompany);
foreach ($getCompanyDBQ as $getCompanyDBQValue){
$attendee_organization_name = $getCompanyDBQValue->answer;
}
[/code]

The code was inserted at line 70 before this:

[code]
//Added by Imon
if (count($registration_ids) > 0 && $admin == false) {
foreach ($registration_ids as $reg_id) {

[/code]

I use this code to display the line in the pdf template:

[code]
if (trim($attendee_organization_name) != “” ) {$pdf->Cell(50,5,pdftext($attendee_organization_name),0,1, ‘L’);}//Insert Company name if found
$pdf->Cell(50,5,pdftext($attendee_first . ‘ ‘ . $attendee_last),0,1, ‘L’);//Set attendee name
[/code]

Please, can you help?

Thank you

  • This topic was modified 11 years, 4 months ago by Ion Paciu.
  • This topic was modified 11 years, 4 months ago by Ion Paciu.


Dean

  • Support Staff

September 9, 2013 at 4:02 am

Hi,

There is actually already code for custom questions in the template but it is commented out

//Query Database for event and get variable
/* 	$events = $wpdb->get_results("SELECT * FROM " . EVENTS_DETAIL_TABLE . " WHERE id='" . $event_id . "'");
  foreach ($events as $event){
  //$event_id = $event->id;
  $event_name = html_entity_decode(stripslashes($event->event_name),ENT_QUOTES,"UTF-8");
  $event_desc = $event->event_desc;
  $event_description = $event->event_desc;
  $event_identifier = $event->event_identifier;
  $start_date = $event->start_date;
  } */
//This is an example of how to get custom questions for an attendee
//Get the questions for the attendee
 $q_sql = "SELECT ea.answer, eq.question
  FROM " . EVENTS_ANSWER_TABLE . " ea
  LEFT JOIN " . EVENTS_QUESTION_TABLE . " eq ON eq.id = ea.question_id
  WHERE ea.registration_id = '".$registration_id."'";
  $q_sql .= " AND ea.question_id = '2' ";
  $q_sql .= " ORDER BY eq.sequence asc ";
  $wpdb->get_results($q_sql);
 
  $organization_name = $wpdb->last_result[0]->answer;//question_id = '9' 

Remove the comments like I have done here and on this line

 $q_sql .= " AND ea.question_id = '2' "

replace the 2 with your question id (20).

Then further down, look for this code

//Set the biiling information
$pdf->SetFont('Times', 'B', 12);
$pdf->Cell(50, 5, __('Bill To: ', 'event_espresso'), 0, 1, 'L'); //Set biil to
$pdf->SetFont('Times', '', 12);
$pdf->Cell(50, 5, pdftext($attendee_first . ' ' . $attendee_last), 0, 1, 'L'); //Set attendee name
$pdf->Cell(50, 5, $organization_name, 0, 1, 'L'); //Set attendee email
$pdf->Cell(50, 5, $attendee_email, 0, 1, 'L'); //Set attendee email
//Set attendee address
$attendee_address != '' ? $pdf->Cell(100, 5, $attendee_address, 0, 1, 'L') : '';
$pdf->Cell(100, 5, (pdftext($attendee_city != '' ? $attendee_city : '') . ($attendee_state != '' ? ' ' . $attendee_state : '')), 0, 1, 'L');
$attendee_zip != '' ? $pdf->Cell(50, 5, $attendee_zip, 0, 1, 'L') : '';

Notice that I duplicated the email line and changed the variable like so

$pdf->Cell(50, 5, $organization_name, 0, 1, 'L'); //Set attendee email

That will display the company name below the persons name.


Ion Paciu

September 16, 2013 at 3:31 pm

Thank you, Dean!

It works like a charm :)


Dean

  • Support Staff

September 17, 2013 at 1:43 am

You’re welcome!

Viewing 3 reply threads

The support post ‘invoice edit to add a (question) – > company name’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso - Staging Server