Support

Home Forums Event Espresso Premium Bulk download pdf (invoice, receipt)

Bulk download pdf (invoice, receipt)

Posted: December 2, 2019 at 4:34 am


motio

December 2, 2019 at 4:34 am

Our accounting department needs a pdf file for each invoice. I would like to be able to download it in bulk. There must be a way to accomplish that.

I found a php script that compress multiple files into a zip file and download that zip file:

<?php
if(isset($_POST['files']))
{
$error = ""; //error holder
if(isset($_POST['createzip']))
{
$post = $_POST; 
$file_folder = "files/"; // folder to load files
if(extension_loaded('zip'))
{ 
// Checking ZIP extension is available
if(isset($post['files']) and count($post['files']) > 0)
{ 
// Checking files are selected
$zip = new ZipArchive(); // Load zip library 
$zip_name = time().".zip"; // Zip name
if($zip->open($zip_name, ZIPARCHIVE::CREATE)!==TRUE)
{ 
 // Opening zip file to load files
$error .= "* Sorry ZIP creation failed at this time";
}
foreach($post['files'] as $file)
{ 
$zip->addFile($file_folder.$file); // Adding files into zip
}
$zip->close();
if(file_exists($zip_name))
{
// push to download the zip
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="'.$zip_name.'"');
readfile($zip_name);
// remove zip file is exists in temp path
unlink($zip_name);
}
 
}
else
$error .= "* Please select file to zip ";
}
else
$error .= "* You dont have ZIP extension";
}
}
?>

Now I need the files to compress them into a zip.

Event Espresso generates a file via this url:
?ee=msg_url_trigger&snd_msgr=pdf&gen_msgr=html&message_type=invoice&context=purchaser&token=1-40b3ed9394e7528256be16a0c02e716f&GRP_ID=7&id=0

How do I get the token of an attendee?
With the Kint debugger I couldn’t find the token in the attendee object.


Josh

  • Support Staff

December 2, 2019 at 8:09 am

Hi,

You’ll actually need to work with the Registration object, then use the available
reg_url_link() method.

The support post ‘Bulk download pdf (invoice, receipt)’ 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