WPPizza – Goodcom Printer

Description

– WPPizza extension to allow “Goodcom” printers to accept/reject orders, intercepting the standard WPPizza order process

– Requires WPPIZZA 3.8.2+, WPPizza Confirm|Reject|Notify 1.3+, a Goodcom printer.

– If your payment gateway supports it, orders that are rejected by the printer will automatically be refunded if they were prepaid, else an email will be send to the shop reminding them to actually refund the payment from within their payment gateways account.

– Also takes “Delivery by Postcode”, “Add Ingredients” and other relevant extensions into account.

Important

  • This is NOT a standalone plugin, but an extension to the Wppizza – Confirm|Reject|Notify plugin.
  • I.e additionally to WPPizza (of course) v3.8.2+ it also requires WPPizza – Confirm|Reject|Notify v1.3+ or higher and – naturally – a Goodcom Printer

Requirements

Plugin Installation

  • If you have not done so yet, install and configure the WPPizza – Confirm|Reject|Notify Extension as described here
  • Then install the “WPPizza – Goodcom Printer” plugin by uploading the zip file in the normal wordpress manner from withing the plugin screen and activate
  • In your admin , go to the WPPizza->C,R,N and enter username, password etc as per setup instructions below

Plugin/Printer Setup – Using WiFi (periodically polling the server for new orders)

  • Login to your printer settings using your printer Terminal Id here
  • set “ResID” (field 5) to be “wppizza-goodcom” (without the quotes)
  • set “Center platform number” (field 4) to be “00”
  • set “USSD” (field 7) to be “00”
  • set “Reject Reasons” (field 15) options as appropriate, separated by colon (See “Other Notes” below)
  • set “Connection Mode” (field 22) to “00”
  • set “GPRS/3G auto check interval” (field 26) to something sensible in seconds (like 30 for example). Should probably be lower than “Timeout” (field 64)
  • set “Accept Reply Type” (field 31) to “01”
  • set “File Path” (field 36) – to be the root url of your website including http[s] and trailing slash: – e.g. “https://www.my-domain.com/” (see also “Other Notes” below)
  • set “Callback Url” (field 37) – to be the root url of your website including http[s] and trailing slash: – e.g. “https://www.my-domain.com/” (see also “Other Notes” below)
  • set “Second Confirm” (field 41) to “00”
  • set “Accept Items” (field 53) minutes options you want to offer as appropriate, separated by colon.(See Notes below)
  • set a “Login Web UserName” (field 58) – “a-zA-Z0-9_-” characters only please
  • set a “Login Web Password” (field 59) – “a-zA-Z0-9_-” characters only please
  • set “Timeout” (field 64) to something like “60” (seconds). Should probably be higher than “GPRS/3G auto check interval” (field 26)
  • set “SelectFonts” (field 52) to be “00”
  • Set all other fields – such as WIfI settings etc – as required according to your printer documentation and apply/upload your changes to the printer
  • upload one of the xml files you find in the [plugins-path]/wppizza-goodcom-printer/xml directory to the printer. See screenshots below as to what the initial layout will look like depending on the xml used. For adjustments to your requirements use the filters further down on tis page
  • goto WPPizza -> C,R,N in your WordPress admin and scroll down to the “Goodcom” settings
  • Set “Enabled” to be checked
  • set “Printer Notifications” to be “Using WiFi”
  • set the “Login Web UserName” and “Login Web Password” equivalent to the settings entered in field 58 and 59 of your printer settings
  • Leave the “Shop Confirmation” message enabled for now (see “Other Notes” below)
  • Save
  • amend localization strings (frontend, emails etc) by navigating to the “Localization” options (Tab at the top) of the plugin and set as required. Refer to the “help screen” for more info and template variables
  • See also screenshots below for some visual examples

Note: some of the above is guesswork as the goodcom documentation is somewhat sparse, but the above values have been tested and work with a gc30. other goodcom printers might have slightly different parameters and you will have to refer to your particular printers documentation (if you can find it)

Plugin/Printer Setup – Using SMS (new orders being actively sent to the printer by SMS)

  • Setup printer fields as above, but with the following differences
  • set “Connection Mode” (field 22) to “01”
  • Setup plugin setting as above, but change
  • “Printer Notifications” to be “By SMS”
  • Furthermore, set your SMS Gateway settings as appropriate for your chosen SMS gateway and enter the printers sms/phone number into the “SMS – Sender Phonenumber” field.

Other Notes

  • Make sure you leave a space after the minutes integer in field 53 of the printer settings.
    – e.g “15 Minutes;30 Minutes;45 Minutes;60 Minutes” etc (See Screenshot).
  • If you are using the Wppizza Preorder Plugin, also add an “ASREQUESTED” option (i.e “15 Minutes;30 Minutes;45 Minutes;60 Minutes;ASREQUESTED”)
  • If you do NOT enable “Shop Confirmation” in WPPizza->C,R,N->Settings : Goodcom Printer”, orders will always be send to the customer as being accepted (with estimated delivery/pickup times), even if the printer has not yet processed the order. However, if you subsequently “Reject” the order with your printer, the customer will still be sent an email to that effect (and any payment refunded if your gateway supports it)
  • Before an order has been accepted, the estimated times displayed are based on your “Preparation Time” and “Delivery time” as set in WPPizza -> Order Settings
  • If you are using the Wppizza Preorder Plugin, you should reply to any orders that are set to be “ASAP” with an accept time. If you want to accept a preorder time requested, accept the order with the “ASREQUESTED” option set in field 53 of your printer (see above)
  • Multisite setups: “File Path”/”Callback Url” (fields 36/37) – in a multisite environment – should include the path to the subsite, or use subdomain – as appropriate

Troubleshooting – WiFi

  • double check your printer configuration settings according to the instructions above
  • enable debug in the plugin and do a dummy order
  • you will find a log file in [path]/plugins/wppizza/logs/goodcom-printer-debugall-[xyz].log
  • if you do NOT find anything in that file that looks like [a] => wppizza-goodcom [u] => abcd [p] => wxyz, the printer is not polling the server and you ‘ll have to check your printer settings again or ask goodcom for support for your particular printer as to why it’s not polling
  • WHEN YOU ARE DONE, DISABLE DEBUG AND DELETE THE LOG ABOVE AS IT MIGHT HAVE LOGIN INFO FROM YOUR PRINTER (although for added security the wppizza/logs directory is generally not accessible publicly)
  • .. further info will be added here as i find out about things. ..

Previewing Print Output

  • open the GsmXmlFormat.exe program that came with your printer (If you do not have a copy of that program, please contact goodcom)
  • Select “File->Open” and select one of the xml files in the /xml/ directory of the plugin
  • assuming you have enabled the plugin with all the relevant settings, make a (dummy) order.
  • in your browser, go to http://www.my-domain.com/?a=wppizza-goodcom&u=myusername&p=mypassword, changing domain/url, username and password according to your settings (fields 36, 58, 59)
  • the output will be something like #1_689* ...............VARIOUS DATA PARAMETERS...................*#(Example Screenshot)
  • copy/paste everything between (and including) the #’s into the top right field of the GsmXmlFormat.exe program (Example Screenshot) to view a virtual printout as it would be printed with your settings
  • if you want to check any custom filter settings, simply edit the filters as required, refresh the http://www.my-domain.com/?a=wppizza-goodcom&u=myusername&p=mypassword url and re-copy/paste the new output into the GsmXmlFormat.exe now

Example filters to adjust layout : (Screenshot)

	
// example: adding site url in header and add additional linebreak
add_filter('wppizza_goodcom_printer_filter_xml_site', 'set_header');
function set_header($array){
	$array['values']['site_url']['enabled'] = true;
	$array['values']['site_url']['format_value_post'] = '\r\r';//add additional linebreak
return $array;
}
	
	
// example summarise important values
/*
	the goodcom xml only allows for 8 segments, some of which are reserved
	so we use the filter below to add a pseudo segment underneath the 'site'
	parameters (even though they might or might not be displayed)
*/ 
add_filter('wppizza_goodcom_printer_filter_xml_site', 'set_custom_summary');
function set_custom_summary($array){
	
		//adding payment method 
		$array['values']['payment_method'] = array(
			'sort' => 1000,//sort order - first after everything in the site section
			'enabled' => true,//enabled (should be true else one might as well not do this anyway)
			'sKey' => 'ordervars',//section key , needs to be ordervars here
			'raw_value' => false,//using formatted value
			'align' =>'center',	//center
			'omit_label' => true,//omit label (i.e do not output Payment Method but only "Cash" or "Prepay")			
			'format_value_pre' => '------------Summary-----------\r',//add divider to first added parameter with label. total length should be 11 characters if set to bold by ending with \s\r instead of just \r (eg '\r--Summary--\s\r'), 30 chars if not . start with \r if linebreak is required above
			'format_value_post' => '\s\r',//'\s\r' to set payment_method value to bold
		);
		// pickup or delivery 
		$array['values']['order_type'] = array(
			'sort' => 1001,//sort order - second after everything in this section
			'enabled' => true,
			'sKey' => 'ordervars',
			'raw_value' => false,
			'align' =>'center',	//center
			'omit_label' => true,//omit label 			
			'format_value_pre' => '',//no pre format
			'format_value_post' => '\s\r',//set value to bold
		);				
			
		//adding payment due after site name 
		$array['values']['payment_due'] = array(
			'sort' => 1002,//sort order - third after everything in this section
			'enabled' => true,//enabled (should be true else one might as well not do this anyway)
			'sKey' => 'ordervars',//section key , needs to be ordervars here
			'new_label' => 'Due:',//change too long "Payment Due" to simple "To Pay" 
			'raw_value' => false,//set to true to us unformatted value (i.e price without currency to save space perhaps as it's bolded)
			'align' =>'center',	//center
			'omit_label' => false,//dont omit label 			
			'format_value_pre' => '',//no pre format
			'format_value_post' => '\s\r',//set value to bold
		);
		//adding customer telephone  number - make sure you have that field actually enabled on the order form or you will get php notices
		$array['values']['ctel'] = array(
			'sort' => 1003,//sort order - fourth after everything in this section
			'enabled' => true,//enabled (should be true else one might as well not do this anyway)
			'sKey' => 'customer',//section key , needs to be customer here
			'raw_value' => true,//must be true, as there is no specific value_formatted for customer vars
			'align' =>'center',	//center
			'omit_label' => false,//do not omit label 			
			'format_value_pre' => '',//no pre format
			'format_value_post' => '',//not bold
		);
		//adding total
		$array['values']['total'] = array(
			'sort' => 1004,//sort order - fifth after everything in this section
			'enabled' => true,//enabled (should be true else one might as well not do this anyway)
			'sKey' => 'summary',//section key , needs to be customer here
			'raw_value' => false,//show formatted value (i.e with currency symbol)
			'align' =>'center',	//center
			'omit_label' => false,//do not omit label 			
			'format_value_pre' => '',//no pre format
			'format_value_post' => '',//not bold
		);
	
    return $array;	
}
	
	
// add an arbitrary footer with divider
add_filter('wppizza_goodcom_printer_filter_xml_footer', 'set_footer');
function set_footer($array){

	/* 
		display a footer, centered using spaces
		with a divider above the text
	*/
	$array['label']['enabled'] = true;
	$array['label']['localization'] = 'some arbitrary footer';
	$array['label']['align'] = array('center'=>' ', 'divider' => 'pre');//center using spaces, set center to '' to not align, 'divider' to false to omit divider, 'post' for divider below

return $array;
}
	

Some additional filter examples

	
/* filtering itemised order details */
//example 1- remove prices from order items , 
//example 2- display prices unformatted (without currency symbol to perhaps save on space)
//example 3- dont display brackets around size
//example 4- dont display sizes at all (only a good idea if there is only ever 1 size )
add_filter('wppizza_goodcom_printer_filter_xml_order', 'format_order_items');
function format_order_items($array){
		
		
	//example 1 
	$array['values']['pricetotal_formatted']['enabled'] = false;
		
	//example 2 
	$array['values']['pricetotal_formatted']['enabled'] = false;
	$array['values']['pricetotal']['enabled'] = true;

	//example 3 
	$array['values']['price_label']['prefix'] = '';
	$array['values']['price_label']['suffix'] = '';

	//example 4
	$array['values']['price_label']['enabled'] = false;

    
    return $array;	
}	
	
	
/* filtering ordervars labels */
//example 1- remove divider and label 
//example 2- dont center 
//example 3- center using "_" (underscore) character instead of "-"
//example 4- remove label and use defined character as divider
//example 5- set a different label
//example 6- bold label
add_filter('wppizza_goodcom_printer_filter_xml_ordervars', 'format_ordervars_label');
function format_ordervars_label($array){
		
	//example 1
	$array['label']['enabled'] = false;

	//example 2
	$array['label']['align'] = false;

	//example 3
	$array['label']['align']['center'] = '_';

	//example 4
	$array['label']['enabled'] = false;
	$array['label']['align']['center'] = '_';
	$array['label']['align']['divider'] = true;
		
	//example 5		
	$array['label']['localization'] = 'other text';		

	//example 6		
	$array['label']['format_post'] = '\s\r';		
		

    return $array;	
}	
	
	
/* filtering ordervars values output*/
//example 1- bold the order id 
//example 2- omit label from payment method
//example 3- enable and display ipaddress before all other vars
//example 4- dont display date
//example 5- display transaction id, remove label, (bold it) and move it after order_type  
//example 6- use unformatted value (this might not always differ for all variables)
//example 7- using raw db values 
//example 8- do not display "please allolow x minutes etc etc 

add_filter('wppizza_goodcom_printer_filter_xml_ordervars', 'format_ordervars');
function format_ordervars($array){
	
	//example 1 
	$array['values']['order_id']['format_value_post'] = '\s\r';

	//example 2 
	$array['values']['payment_method']['omit_label'] = true;//simply omitting label
	$array['values']['payment_method']['omit_label'] = 'center';//omitting label and centering value
	
	//example 3 
	$array['values']['ip_address']['sort'] = 1;
	$array['values']['ip_address']['enabled'] = true;		

	//example 4 
	$array['values']['order_date']['enabled'] = false;

	//example 5 
	$array['values']['transaction_id']['sort'] = 55;//order type is 50
	$array['values']['transaction_id']['enabled'] = true;	
	$array['values']['transaction_id']['omit_label'] = true;
	$array['values']['transaction_id']['format_value_post'] = '\s\r';
	
	//example 6.1 NOT bolding , must perhaps add linebreak before if no label (depending on where it's displayed)
	$array['values']['transaction_id']['sort'] = 55;//order type is 50
	$array['values']['transaction_id']['enabled'] = true;	
	$array['values']['transaction_id']['omit_label'] = true;
	$array['values']['transaction_id']['format_value_pre'] = '\r';
	
	//example 7 
	$array['values']['order_date']['raw_value'] = true;// would display 2018-10-23 12:25:59 or similar instead of -depending on your site date/time format settings) October, 23 2018 12:25 or similar
	$array['values']['total']['raw_value'] = true;// would display 3000.95 instead of $3,000.00 (or similar, depending on locale)

	//example 8 
	$array['values']['pickup_delivery']['enabled'] = false;
				
return $array;	
}
	

Support

For additional support please visit the “Support Forum”

Screenshots

default print


using wppizza-goodcom-default.xml
selected right align


using wppizza-goodcom-selected-right-align.xml
no align


using wppizza-goodcom-no-align.xml
default print – with filters


using wppizza-goodcom-default.xml
filters – info
printer settings – example WiFi
plugin settings – WiFi
plugin settings – SMS