Forum Replies Created
- AuthorPosts
-
that’s got nothing to do with anything
again, what do you get when you add
file_put_contents(‘path/to/some/file.log’, print_r($details_completed, true));
directly at the top of your function you are calling with the on_order_Execute hooki.e
add_action( 'wppizza_on_order_execute', 'my_order_app', 10, 3); function my_order_app($order_id, $details_completed, $tid) { file_put_contents('path/to/some/file.log', print_r($details_completed, true)); }
post the whole data that you receive in this file
furthermore -as a more direct answer to the question
a) there’s no provision for that because
b) in 99% of cases (exceptions prove the rule and all that and might work for some prices) it will not be what’s required anyway
assuming you have prices like 9.95, 7.95 and 5.95 if one were to blanket apply 10% you’d end up with 8.96, 7.16, 5.36
I dont think anyone will want these kind of odd prices so you’d have to do most of them manually anywaydoesnt it make more – or at least just as much – sense to simply apply a discount of 10% if pickup across the board ??
>Any update yet about the issue?
no, becuase epay.dk have not replied to my re-activation of my test account nor have they setup a new test account i applied for (yet, on both counts)re class: correct
have you tried a simple
file_put_contents('path/to/some/file.log', print_r($details_completed, true));
right after
function my_order_app($order_id, $details_completed) {
and had a look at that file
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 order
and 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_details
actually 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 yourreturn
statement is before thefile_put_contents..
)b) your
$template_ids[] = 1;
however makes the third parameter inwppizza_on_order_execute
https://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_execute
hooki.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. - AuthorPosts