Developers

  1. Modify Css / Styles / Layout
    1. Layout (Menu Items, General)
    2. Frontend Css
    3. Admin Css
  2. Templates
    1. Pages
      1. page.order.php
      2. page.confirm-order.php
      3. page.processing.php
      4. page.thankyou.php
      5. page.cancelled.php
      6. page.purchase-history.php
    2. Order
      1. itemised.php
      2. summary.php
      3. transaction_details.php
    3. Global
      1. orderinfo.php (Widget)
      2. openingtimes.php (Widget)
      3. additives.php (Widget)
      4. navigation.list.php (Widget)
      5. navigation.dropdown.php (Widget)
      6. search.php (Widget)
      7. totals.php (Widget)
      8. pickup_choice.php (Mixed)
      9. login.php (Module)
      10. profile.register.php (Module)
      11. profile.update.php (Module)
      12. pages.pickup_note.php (Module)
      13. formfields.inputs.php (Module)
      14. formfields.values.php (Module)
    4. Cart
      1. cart.container.php
      2. cart.shopclosed.php
      3. cart.empty.php
      4. cart.pickup_note.php
      5. cart.checkout_button.php
      6. cart.empty_cart_button.php
      7. cart.minimum_order.php
      8. minicart.php
    5. Loop (Menu Items)
      1. header.php
      2. no_results.php
      3. posts.title.php
      4. posts.thumbnail.php
      5. posts.prices.php
      6. posts.content.php
      7. posts.permalink.php
      8. additives.php
      9. pagination.php
      10. theme-wrapper.php
    6. Search Results
      1. search.php
    7. Single Menu Item
      1. single.php
    8. functions.php
  3. Filters, Actions, Functions
    1. Global WPPizza functions
    2. WPPizza options (Filter)
    3. Currency (Filter)
    4. After every order (Action)
    5. Getting orders (Function)
  4. Constants
    1. Admin Name
    2. Admin Menu Icon
    3. SORT_ITEMS_AS_ADDED
    4. SINGLE_PERMALINK_VAR
    5. WIDGET_CSS_CLASS
    6. PLAINTEXT_LINE_LENGTH
    7. ADMIN_{CONSTANTS}
    8. DEV_{CONSTANTS}
    9. INSTALL_{CONSTANTS}
    10. TRANSACTION_{CONSTANTS}
  5. Codesnippets
    1. Create your own sales report
    2. Order history - todays orders
    3. Email/Print templates
    4. Email Subject Line
    5. Add attachment to email
    6. On order status update
    7. Unconfirmed orders
    8. Customise order id
    9. Changing post type arguments
    10. Gateway filter frontend
    11. Users previous orders
    12. Dynamic menu item prices
    13. Update prices in bulk
    14. Prices output loop
    15. Pickup opening times
    16. Checkout Formfields
    17. Additional validation function
  6. Extensions / Gateways
    1. Add Ingredients
    2. Autoprint
    3. Confirm | Reject | Notify
    4. Coupons and Discounts
    5. Cross-Sells
    6. Delivery By Post/Zipcode
    7. Goodcom Printer
    8. Mailinglists
    9. Pdf Invoices
    10. Preorder
    11. Gateway - Stripe

6.7.Goodcom Printer

Filter examples to alter the goodcom printer output

wppizza_goodcom_printer_filter_xml_site

Using the 3 filters below as described will result in a print layout similar to this screenshot. The final layout will depend on actual order and customer values submitted.

@param: array(parameters)
@return: array(filtered parameters)

/* 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 : summarising 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;	
}
/* example : adding 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;
}

Additional Filter Examples

Filtering itemised order details: ‘wppizza_goodcom_printer_filter_xml_order’

@param: array(parameters)
@return: array(filtered parameters)

//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: ‘wppizza_goodcom_printer_filter_xml_ordervars’

@param: array(parameters)
@return: array(filtered parameters)

//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: ‘wppizza_goodcom_printer_filter_xml_ordervars’

@param: array(parameters)
@return: array(filtered parameters)

//example 1- bold the order id 
//example 2- omit label from payment method and center value
//example 3- enable and display ipaddress before all other vars
//example 4- do not 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']['align'] = 'center';//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;	
}

 

Filtering (omitting some) customer information: ‘wppizza_goodcom_printer_filter_xml_customer’

@param: array(parameters)
@return: array(filtered parameters)

add_filter('wppizza_goodcom_printer_filter_xml_customer', 'format_customer_data');
function format_customer_data($array){
		
	/* omit name */		
	unset($array['values']['cname']);
	/* omit email */		
	unset($array['values']['cemail']);
	/* omit address */		
	unset($array['values']['caddress']);
	/* omit first custom  field */		
	unset($array['values']['ccustom1']);
	/* etc etc */
	
	/*
		the keys (cname, cemail etc) 
		correspond to the keys / formfields in "Wppizza->OrderForm"
		(hover your mouse over the "enabled" buttons to view the keys for each field)
		
	*/
	
    return $array;	
}	

 

Filtering (adding) SKU’s to title of each item using: ‘wppizza_goodcom_printer_filter_xml_order’

@param: array
@return: array

/* adding SKU's - if set/exist - before item title */
add_filter('wppizza_goodcom_printer_filter_xml_order', 'add_sku_to_title');
function add_sku_to_title($array){
	
	$array['values']['sku'] = array(
		'sort' => 5,//before everything else (the first naturally occurring string is 'quantity' with a priority of 10)
		'enabled' => true,//no point of setting this to anything else than true
		'type' => 'name',//left hand side (item name). use 'value' to add it to right hand side
		'prefix' => '',//if you want the sku's wrapped in brackets for example, set prefix to '(' and suffix to ')' 
		'suffix' => '',//if you want the sku's wrapped in brackets for example, set prefix to '(' and suffix to ')' 
	);


return $array;	
}

 

If your particular goodcom printer model allows for fonts to be somewhat bigger you will have fewer characters per line “to play with” and may have to adjust the maximum characters per line (for dividers etc). To do so , you can do the following (reducing the default 30 chars per line to 24 in this example)

@param: int
@return: int

add_filter('wppizza_goodcom_printer_filter_max_chars_default', 'myfilter_set_goodcom_default_maxchar');
function myfilter_set_goodcom_default_maxchar($maxchar){
	$maxchar = 24;
return $maxchar;
}

// if you also need to do the equivalent for the big/bold text of the printer (reducing the default 11 to 9 in this example)
add_filter('wppizza_goodcom_printer_filter_max_chars_bold', 'myfilter_set_goodcom_bold_maxchar');
function myfilter_set_goodcom_bold_maxchar($maxchar){
	$maxchar = 9;
return $maxchar;
}

 

Ingredients (if using the “WPPizza Add Ingredients” plugin) are simply separated by | . Use the below filter to use a different divider if you wish.

@param: str
@return: str

add_filter('wppizza_goodcom_printer_filter_ai_divider', 'my_ai_divider' );
function my_ai_divider($str){
    $str = '|';/* replace | with whatever you want to use as divider between ingredients */
return $str;
}
Suggest Edit

documentor id 5