Forum Replies Created
- AuthorPosts
-
I was just clarifying to Justin that the script is built for my configuration of the printer and for him to have more than one topping/extra he would have to configure the printer to handle that.
I assume you have no tools to do this with?
I most certainly value your feedback, I know just enough to figure it out, but obviously as you’ve mentioned there is better ways of doing it.
Can you think of any way to keep the thank you page loading until shop accepts order? With the order being set to acknowledged and the order deleted from the txt file when accepted
The callback has a simple if(order accepted) which executes once shop has accepted
Hi guys,
You will have to forgive my understanding of the script. I am still fairly new to it all. The script I posted does work with MY printer setup, I have a custom receipt layout which is something you will have to do if you want more than one extra option/topping
I have a callback provided by goodcom, I would like to have the thank you page keep loading until the shop accepts the order and also set the order to acknowledged. The callback provided does nothing apart from telling the printer it’s all good
I also have not figured the deleting of orders from the txt file. I have opted to delete the file at certain times.
let me know if you need any more help
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(); [EDIT/NOTE BY ADMIN - AS PEOPLE STILL SEEM TO USE IT: THE ABOVE TWO LINES SHOULD NOT BE THERE. SEE COMMENTS FURTHER DOWN] //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); }
Hi Justin
I will update soon
All set,
created new plain text email template and use this to send email to shop
use second template in HTML to send to customer
the only thing to make it possibly a little better would be to decrease the amount of white space between each parameter.
rather than this
Order Date : February 27, 2018 3:49 pm Order ID : 138 Payment Due : £ 20.89 Delivery Type : For Delivery Paid By : Cash on Delivery Transaction Id : COD1519746586138 Note : Please allow 45 minutes for delivery.
if it could do this
Order Date :February 27, 2018 3:49 pm Order ID :138 Payment Due :£ 20.89 Delivery Type :For Delivery Paid By :Cash on Delivery Transaction Id :COD1519746586138 Note :Please allow 45 minutes for delivery.
this works perfectly for gmail, but not for outlook.com
all other properties of $email_domains end with ‘.’ see below
//where 0 = @gmail. | 1 = @googlemail. | 2 = @outlook <——– NO DOT HERE | 3 = @yahoo.| 4 =@hotmail.
but outlook does not have a .
if it can work with outlook then all my problems have been solved
Also if anyone wants details of how to set up goodcom printers to auto print, reply here. printer needs no PC just a sim card with mobile data.
I have semi working script for callback, enabling shop to accept/decline order with a reason for rejection. Email does not have this function.
Thanks again Olly
hi ollly,
prints out this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> </head> <body style="font-family: monospace;"> <pre> ORDER RECEIPT </body> </html>
So, I have set the printer to print automatically from the email sent after an order.
The printer only supports plain text, but the plain text sent in the email appears to have some html from somewhere.
Where does this html come from? Is the email pure plain text?
Many thanks
thanks for that,
i know what is needed to get the printer working.
it is this function that im having trouble getting to work with V3 of wppizza. i will make a few changes and update 🙂
This is what i have so far
add_action( 'wppizza_on_order_execute', 'print_order'); function print_order($orderId, $orderDetails) { require(WPPIZZA_PATH.'classes/class.wppizza.order.php'); $orderDetails = new WPPIZZA_ORDER(); $orderDetails->setOrderId($orderId); $order = $orderDetails->session_formatted(); $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('/homepages/1/d720204031/htdocs/clickandbuilds/NazSpice/ordini.txt', $txt, FILE_APPEND); }
Thanks for clarifying,
What would need to be different apart from the obvious file path?
I’m a bit stumped
- AuthorPosts