The following is the code I use in an Order Confirmation module. I am creating a pdf file using fpdf
and also sending an email. Subsequently, I clear out a shopping cart and redisplay the menu.
In the code below, I have commented out the creation of the pdf file. When I do this the email is sent and the cart is emptied by the javascript code
<script type="text/javascript">
doCart(\'EmptyCart\',\'0\', \'0\', \' \', \'partCheckOut\');
</script>
but if I uncomment the code for the creation of the pdf:
$pdf->getHdrDtl();
$pdf->Header();
$pdf->Footer();
$pdf->generatePDF();
the pdf file is created, the email is sent, but the cart is not emptied and the menu is not redisplayed.
Does anyone have any suggestions or ideas?
if (isset($_POST['confirm']))
{
$Cart->ConfirmOrder();
/*
$pdf->getHdrDtl();
$pdf->Header();
$pdf->Footer();
$pdf->generatePDF();
*
*/
$Cart->sendOrderEmails($dealer_email);
echo '
<script type="text/javascript">
doCart(\'EmptyCart\',\'0\', \'0\', \' \', \'partCheckOut\');
</script>
';
$group = $_SESSION['group'];
if ($group == 1){
header("Refresh: 1; ./admin_menu.php");
exit;
}
if ($group == 2){
header("Refresh: 1; ./user_menu.php");
exit;
}
if ($group == 3){
header("Refresh: 1; ./admin_menu.php");
exit;
}
}