Support

Home Forums Event Espresso Premium Attendee Company to Invoice/Default # Rows on reports

Attendee Company to Invoice/Default # Rows on reports

Posted: April 10, 2015 at 2:16 pm

Viewing 7 reply threads


Remi Nel

April 10, 2015 at 2:16 pm

Hi,

I have two items that I’m trying to do, but struggling and could use some help. I am using EE3 with the MER plugin enabled.

1. I would like to add the Attendee’s company to the invoice and I tried what was suggested here (https://eventespresso.com/topic/adding-company-name-to-invoice) without success. Instead, I currently have a blank line now between the name and email address.

2. Our standard event has over 75 attendees and when viewing the Attendee Reports and trying to export to Excel, it defaults to 50 rows at a time. Is there a way to set the default to a higher value?

Thanks,
Remi


Lorenzo Orlando Caum

  • Support Staff

April 13, 2015 at 12:07 pm

Hi Remi,

On your first question, note that the IDs that are referenced will be different for your own site.

You can check by going to the registration forms area of Event Espresso within your WP dashboard and then browsing to that question.

It will be a numeric value like 25.

Next, when you applied the changes for that answer in the invoice, did you set it to look for your actual ID (numeric value) for your company question (attendee company question)?

On your section question, the information is retrieved from the database so we’ve set it to default to a lower value.

You can retrieve the additional records by adjusting the option that appears towards the top of the screen:

http://cl.ly/image/0T1v3W3N3j2F


Lorenzo


Remi Nel

April 13, 2015 at 12:26 pm

Hi Lorenzo,

I have tried both the order/sequence number (2) and the id listed in the url (11) and neither worked. See question image here:.

On the second item, I have been adjusting it using that box, but I would like for it to remember/default to 100 if possible.

Thanks,
Remi


Lorenzo Orlando Caum

  • Support Staff

April 13, 2015 at 1:23 pm

Hi, there isn’t an option to change the default option from 50 at this time.

If the question id is 11, then that is the answer ID that should be referenced.

What is the exact code change that you applied to the invoice?

Could you copy and paste it here?


Lorenzo


Remi Nel

April 13, 2015 at 1:31 pm

This code was commented out. I un-commented it and changed the question id to 11.

//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 = ’11’ “;
$q_sql .= ” ORDER BY eq.sequence asc “;
$wpdb->get_results($q_sql);

$organization_name = $wpdb->last_result[0]->answer;//question_id = ’11’

I un-commented the variable line (line 47 on my template.php file):

$attendee_organization_name = $attendee->organization_name;

I also added a line in the section ‘Set the billing information’ to pull in this variable:

//Set the billing 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, $attendee_organization_name, 0, 1, ‘L’); //Set attendee company
$pdf->Cell(50, 5, $attendee_email, 0, 1, ‘L’); //Set attendee email


Lorenzo Orlando Caum

  • Support Staff

April 13, 2015 at 1:42 pm

Alright, that block of code isn’t needed.

Try reversing any changes. Then start the tutorial again from here:

https://eventespresso.com/topic/adding-company-name-to-invoice/#post-86737

$organization_name = do_shortcode('[EE_ANSWER q="11" a="'.$attendee_id.'"]');

The above code sets a variable equal to the answer for your question which is the company name.

Then you can use this to display the variable in the invoice:

$pdf->Cell(50, 5, $organization_name, 0, 1, โ€˜Lโ€™);


Lorenzo


Tony

  • Support Staff

April 13, 2015 at 1:49 pm

Hi Remi,

If you notice in this post:

https://eventespresso.com/topic/adding-company-name-to-invoice/#post-86056

I mention you can do this in a much easier way than using the above code ๐Ÿ™‚

This code:

//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 = โ€™11โ€™ โ€œ;
$q_sql .= โ€ ORDER BY eq.sequence asc โ€œ;
$wpdb->get_results($q_sql);
$organization_name = $wpdb->last_result[0]->answer;//question_id = โ€™11โ€™

Should pull in the question and answer value for question id 11 and for a specific attendee. You can then use it within the template….

However, there is a much easier way that does the above for you.

$organization_name = do_shortcode('[EE_ANSWER q="11" a="'.$attendee_id.'"]');

So comment out the first section of code again and add that just after it.

Then, on line 47 you should something like this:

$attendee_organization_name = $attendee->organization_name;

You can comment that out again too.

You should end up with something like this – http://take.ms/c7TBL

That assigned the answer to ‘Company Name’ to the variable $organization_name

So then you’ll change your billing information to this:

//Set the billing 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 company
$pdf->Cell(50, 5, $attendee_email, 0, 1, โ€˜Lโ€™); //Set attendee email

Which should pull all the information in for you.

Does that help?


Remi Nel

April 13, 2015 at 9:47 pm

Lorenzo and Tony,

Thank you both for the response. That helped and it is working.

Thanks again!

Remi

Viewing 7 reply threads

The support post ‘Attendee Company to Invoice/Default # Rows on reports’ 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