Add this to the functions.php of your theme to add integration with Goodcom wireless order printer. Configure the printer to pull orders in php mode from http://yourdomain.com/ordini.txt
It supports WP-Pizza Ingredients add-on.
add_action( 'wppizza_on_order_executed', 'print_order');
function print_order($orderId) {
require(WPPIZZA_PATH.'classes/wppizza.order.details.inc.php');
$orderDetails = new WPPIZZA_ORDER_DETAILS();
$orderDetails->setOrderId($orderId);
$order = $orderDetails->getOrder();
$pickup_delivery = ($order['ordervars']['pickup_delivery']['value'] == 'For Delivery' ? 1 : 2);
$txt = "#PastaSpeed*$pickup_delivery*$orderId*";
foreach($order['items'] as $item) {
$nome = html_entity_decode($item[name]);
$prodotto = trim(preg_replace('/\s+/', ' ', "$nome $item[size] $item[addinfo_plaintext]"));
$txt .= "$item[quantity];$prodotto;$item[pricetotal];";
}
// ccustom3 is a custom field "name on the bell"
$via = $order['customer']['post']['caddress']['value'] . ($order['customer']['post']['ccustom3']['value'] ? " c/o {$order[customer][post][ccustom3][value]}" : '');
$ora = date('H:i d/m', strtotime($order['customer']['post']['wppizza_preorder']['value']));
if($order['customer']['post']['ccustom6']['value'])
$pagamento = 'Bancomat';
$txt .= "*{$order[summary][delivery][value]}*;{$order[summary][total][value]};;{$order[customer][post][cname][value]};$via;$ora;;;$pagamento;{$order[customer][post][ctel][value]};*{$order[customer][post][ccustom2][value]}#\r\n";
file_put_contents('/var/www/vhosts/pastaspeed.com/httpdocs/ordini.txt', $txt, FILE_APPEND);
}