WPPizza – A Restaurant Plugin for WordPress › Support › General Support › Goodcom printer with ver3.7
- AuthorPosts
- 30 August, 2018 at 11:34 pm #38998
Hi Olly,
Is anyone having issues printing with the goodcom printers?
Mine was working well with ver3.6.6
In the debug log I get this:#0 /home/wp-includes/class-wp-hook.php(288): print_order(‘916’)
#1 /home/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array)
#2 /home/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#3 /home/wp-content/plugins/wppizza/classes/class.wppizza.order_execute.php(892): do_action(‘wppizza_on_orde…’, ‘916’, Array, false)
#4 /home/wp-content/plugins/wppizza/ajax/ajax.wppizza.php(912): WPPIZZA_ORDER_EXECUTE->order_execute(Array)
#5 /home/wp-content/plugins/wppizza/classes/class.wppizza.actions.php(47): require(‘/home/megnacou/…’)
#6 /home/ in /home/megnacou/public_html/shop/wp-content/themes/ember/functions.php on line 82
[30-Aug-2018 20:35:40 UTC] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘post_theme_setup’ not found or invalid function name in /home/wp-includes/class-wp-hook.php on line 286Dont know if this is the reason why the printer is not printing.
Please help.PS I used Proof code to get printer on ver3.6.6 and lower:
add_action( ‘wppizza_on_order_execute’, ‘print_order’, 1);
function print_order($order_id, $order, $print_templates) {//declare new ORDER class and assign order details to var order
$order = new WPPIZZA_ORDER();
$order = $order->session_formatted();//check if delivery or pickup
$pickup_delivery = ($order[‘ordervars’][‘order_type’][‘value_formatted’] == ‘For Delivery’ ? 1 : 2);
//check if order has been paid
$order_paid = ($order[‘ordervars’][‘payment_method’][‘value_formatted’] == ‘Cash’ ? 7 : 6);//add pickup_delivery and order_id to txt file
$txt = “#NazSpice*$pickup_delivery*$order_id*”;//add each item from order into txt file, including ONE extra option
foreach($order[‘order’][‘items’] as $item) {$txt .= “$item[quantity];$item[title];$item[pricetotal_formatted];$item[price_label];”;
}//add all other order details into txt file
$txt .= “*{$order[summary][delivery_charges][0][label]}*{$order[summary][discount][0][value_formatted]};{$order[summary][total][0][value_formatted]};{$order[ordervars][wp_user_id][value_formatted]};{$order[customer][cname][value]};{$order[‘customer’][‘caddress’][‘value’]};{$order[customer][ctel][value]};{$order[ordervars][order_date][value_formatted]};$order_paid;{$order[ordervars][payment_gateway][value]};{$order[customer][ccomments][value]}*{$order[customer][ccustom1][value]}#\r\n”;file_put_contents(‘../ordini.txt’, $txt, FILE_APPEND);
}30 August, 2018 at 11:55 pm #38999a) post_theme_setup is not hooked into / called by *ANY* wppizza plugin
b) you are using wppizza_on_order_execute v2 coding with v3 of wppizzahttps://docs.wp-pizza.com/developers/?section=action-wppizza_on_order_execute
in fact i am even surprised that your coding works at all – i would suggest – for starters you get rid of
$order = new WPPIZZA_ORDER(); $order = $order->session_formatted();
as you are overwriting the whole purpose of having this as parameter in the hook in the first place
furthermore
add_action( ‘wppizza_on_order_execute’, ‘print_order’, 1);
should be
add_action( ‘wppizza_on_order_execute’, ‘print_order’, 1, 3);if you want to access all 3 parameters
please refer to the wordpress codex regarding priorities and (number of) parameters of filters/action hooks
- AuthorPosts
- The topic ‘Goodcom printer with ver3.7’ is closed to new replies.