WPPizza – A Restaurant Plugin for WordPress › Support › Code Snippets WPPizza v2.x (read only)
(Code Snippets for v3.x) › run action on status update (admin)
Viewing 1 post (of 1 total)
- AuthorPosts
- 17 June, 2014 at 10:35 am #4085
example. when you change the status of an order to PROCESSED you could automatically open the print dialog to print it somewhere .
if you want to do something else on change of status , change as required.add_action('admin_footer', 'wppizza_print_processed_orders'); function wppizza_print_processed_orders(){ global $current_screen; if(isset($current_screen) && $current_screen->id=='wppizza_page_wppizza-order-history'){ echo"<script type='text/javascript'> /* <![CDATA[ */ jQuery(document).ready(function($){ $(document).on('change', '.wppizza_order_status', function(e){ var self=$(this); var selId=self.attr('id').split('-').pop(-1); var selfVal=self.val(); /* do things when you change the status to PROCESSED, in this case trigger the print button **/ if(selfVal=='PROCESSED'){ var triggerTarget=$('#wppizza-print-order-'+selId+''); triggerTarget.trigger('click'); } }); }); /* ]]> */ </script>"; } }
- AuthorPosts
Viewing 1 post (of 1 total)
- The topic ‘run action on status update (admin)’ is closed to new replies.