Hi guy's I don't really know how to code I just look at a piece of code make changes and if it works then fine if not then I try again - probably not the best method but has worked thus far! Although i'll probably take the time to learn some day.
Anyways I use a wordpress plugin on my website to accept online food orders called wppizza. In the backend of wordpress there is page for the plugin that has an 'Order History Page' - basically orders get polled into there and it hasa dropdown menu option to change the status of the order.
So for example - when on status 'new' it is highlighted yellow and has a ringing noise (all orders when they arrive are on 'new' status by default). When changed to status 'acknowledged' it will print the order.
I have been given a code snippet by the developer so that when I change the order status it sends an email to the customer - I have edited the code to fit my needs however I am having one gripe. I would like to send an email when the status has been changed to 'delivered'. Currently it will send an email if it is changed to any status. I have done all the other parts and it works fine except for this one part but I can't figure out what he means by his instructions - what is the code needed for it to only send an email when 'delivered' is selected on the dropdown menu?
Here is the code snippet referencing that part:
I have included all the code before and one line of code after the part I need to amend. The line/lines I need to amend are
The last part is the instruction but I don't understand what i'm meant to type here I have tried a few different ways and all produce errors when trying to visit my website.
Any help would be appreciated thanks.
Anyways I use a wordpress plugin on my website to accept online food orders called wppizza. In the backend of wordpress there is page for the plugin that has an 'Order History Page' - basically orders get polled into there and it hasa dropdown menu option to change the status of the order.
So for example - when on status 'new' it is highlighted yellow and has a ringing noise (all orders when they arrive are on 'new' status by default). When changed to status 'acknowledged' it will print the order.
I have been given a code snippet by the developer so that when I change the order status it sends an email to the customer - I have edited the code to fit my needs however I am having one gripe. I would like to send an email when the status has been changed to 'delivered'. Currently it will send an email if it is changed to any status. I have done all the other parts and it works fine except for this one part but I can't figure out what he means by his instructions - what is the code needed for it to only send an email when 'delivered' is selected on the dropdown menu?
Here is the code snippet referencing that part:
Code:
/**************************************************************************************************
*
* [admin order history: send email to customer on status change via ajax call]
*
**************************************************************************************************/
add_action( 'wppizza_ajax_action_admin', 'wpp7811_pizza_status_change_email');
function wpp7811_pizza_status_change_email($postdata) {
if($postdata['vars']['type']=='statusupdate'){// could also add a " && in_array($postdata['vars']['type'],array('PROCESSED','REJECTED','REFUNDED'))" to only send when status changed to those
$status=$postdata['vars']['status'];
Code:
if($postdata['vars']['type']=='statusupdate'){// could also add a " && in_array($postdata['vars']['type'],array('PROCESSED','REJECTED','REFUNDED'))" to only send when status changed to those
The last part is the instruction but I don't understand what i'm meant to type here I have tried a few different ways and all produce errors when trying to visit my website.
Any help would be appreciated thanks.
Last edited: