I am about to sell tickets on my webshop, where I would like to attach a PDF. However I would only like to attach the PDF if the order contains the product type virtual products. In this way I make sure that people buying normal product will not receive a PDF. Is this possible?
1 Answer
I assume you 'manually' send these PDF files (own/3rd party module).
You could loop through order items before sending the PDF of the order, checking for product type:
$sendPdf = false;
foreach ($order->getAllVisibleItems() as $orderItem) {
if ($orderItem->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL) {
$sendPdf = true;
break;
}
}
if ($sendPdf) {
// Send your PDF
}