Forum Replies Created
-
AuthorPosts
-
6 March, 2018 at 11:58 am in reply to: create a "view-only" menu without disabling orders globally #35637
>However, when I add items on the view-only page and then navigate to regular order page, these items will be in the cart.
i cannot see how.
please show me the page / url where you experience this behaviour4 March, 2018 at 6:16 pm in reply to: create a "view-only" menu without disabling orders globally #35546simply dont put a cart of the view only page
I’m not disputing that it works for you (how could I . I dont have one of these printers)
All I’m saying is that you are causing unnecessary overheads by getting the parameters again when they already exist
and if you one day decide to add another customer formfield for example (or remove one for that matter) you will have to add it to this script again wheras a simple foreach loop in the first place would already take care of thatagain. i would suggest you change your action as mentioned, get rid of the ‘new order class’ etc and use the parameter available
(and perhaps brush up on how wordpress action/filter priorities and parameters work )@proof
ah, i know where you are going wrong here regarding my note to the benefits of//declare new ORDER class and assign order details to var orderand assuming your action hook usage is as you posted itit should be
add_action( 'wppizza_on_order_execute', 'print_order', 10, 3); /*or if you want */ add_action( 'wppizza_on_order_execute', 'print_order', 1, 3);not
add_action( 'wppizza_on_order_execute', 'print_order', 1);
otherwise the 2nd and 3rd parameter will not be available to you !!!As a sidenote while I am here, I would also suggest something a bit more dynamic regarding the “all other order details” as they are variable and not always the same everywhere
perhaps something along these lines (will no doubt need tweaking according to what goodcom printers really need, but as a starting point)$additional_data = array(); /* customer data */ $customer_data = array(); foreach($order[customer] as $k=>$v){ $customer_data[$k]=$v['value'];//or value_formatted } $additional_data[] = '{'.implode('};{', $customer_data).'}';//tweak as required /* order vars */ $ordervars= array(); foreach($order[ordervars] as $k=>$v){ $ordervars[$k]=$v['value'];//or value_formatted } $additional_data[] = '{'.implode('};{', $ordervars).'}';//tweak as required /* add $order[summary] too (this will always be 2 levels deep to account for multiple taxrates for example) so somewhat as above but a 2 level/nested foreach loop*/ /* then put it together - assuming it needs "*" between things - probably needs tweaking too as i dont know what those printers need but I would think one gets the idea*/ $txt .= implode('*', $additional_data);Hi
don’t mean to criticize and as mentioned I know nothing about those printers.
maybe I’m missing something, but what’s the supposed benefit of doing this ?//declare new ORDER class and assign order details to var order $order = new WPPIZZA_ORDER(); $order = $order->session_formatted();as it happens i’ve just finished something would allow you to do that (and a bunch of other things)
that includes twilio,clickatell or tm4b (or simple email confirmation)might be a couple of days or so until it’s available though
thanks for chiming in.
after all i can only give abstract advice as i know nothing about these printers so anything more concrete would be appreciated
cheerssimply save the $order_details array into a file somewhere and have a look at the array
it should be quite self explanatory what is whati.e something like file_put_contents(‘../ordini.txt’, print_r($order_details , true));
and then build your actual string as you need it
(and perhaps the same with the other parameters like the $print_templates vars etc etc )
please check what
$order_detailsactually containsstuff like
$txt .= $order_details[‘$delivery_type’];
makes no sense
and using print_r in a variable should also be print_r($var, true) in any event
@justin
technically speaking you should really start your own topic, but given that this is somewhat closely related let’s keep it going here for now as it might be interesting for anyone else that deals with goodcom printers (sorry proof)now, regarding your code above (@justin)
a) your$txt = ...andfile_put_contents..will do nothing (for starters yourreturnstatement is before thefile_put_contents..)b) your
$template_ids[] = 1;however makes the third parameter inwppizza_on_order_executehttps://docs.wp-pizza.com/developers/?section=action-wppizza_on_order_execute contain the template stuff.
so you can now use that parameter in thatwppizza_on_order_executehooki.e simplify your above filter to just be
add_filter('wppizza_on_order_execute_get_print_templates_by_id', 'my_prefix_my_filter'); function my_prefix_my_filter($template_ids){ $template_ids[] = 1; return $template_ids; }and then do what you need to do with third parameter in the wppizza_on_order_execute
i.eadd_action('wppizza_on_order_execute', 'my_prefix_my_action', 10, 3); function my_prefix_my_action($order_id, $order_details, $print_templates){ /* do something here with the now available $print_templates parameter like file_put_contents('../ordini.txt', $mystuff, FILE_APPEND); etc etc etc */ }but of course , if proof wants to chime in here with a v3 implementation
please doplease read the thread .
it says it all there . i.ehttps://docs.wp-pizza.com/developers/?section=action-wppizza_on_order_execute
>What if I downgread to wppizza v2?
unless you have a backup from before you upgraded to v3, you cant
as is clearly stated
https://docs.wp-pizza.com/getting-started/?section=upgrade-v2-x-v3-xThis reply has been marked as private.This reply has been marked as private.https://www.w3schools.com/css/css_rwd_mediaqueries.asp
for any further information regarding css and media queries, please use your favourite search engine
there are thousands of articles on the net regarding this , all of which will explain things in detailuse css and media queries
seems to me that perhaps your certificate on your server is the problem or ssl is not enabled but it’s just a guess
-
AuthorPosts