Integration with Goodcom wireless order printer

WPPizza – A Restaurant Plugin for WordPress Support User contributions Integration with Goodcom wireless order printer

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24005
    marcomarsala
    Participant

    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);
    }
    #24270
    tofayel
    Participant

    Can you guide us step by step on how to integrate wireless printer?

    #24273
    marcomarsala
    Participant
    This reply has been marked as private.
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Integration with Goodcom wireless order printer’ is closed to new replies.