The following code highlights the modifications
to the processOrders.inc.php code for this.
// If we got order IDs to process, do that
if ($_REQUEST['orderIds'])
{
echo "
Processing...
";
// First, authenticate with the SMS Gateway
$sms = new SMSGateway();
// Pass Clickatell username, password and API ID
if (!$sms->Init("username", "password", "3015229"))
{
$msg = "Could not authenticate with SMS Gateway.";
}
$updated = 0;
$sent = 0;
foreach($_REQUEST['orderIds'] as $orderId)
{
$ordObj->Load($orderId);
// Change the status to 'Processing...'
if ($ordObj->UpdateStatus('P'))
{
$updated++;
}
$msg = "Order dispatched. Pizzas will reach you within
30 minutes. - POTR";
// Now send an SMS: to, from, message
Sending Text Messages
[ 108 ]
if ($sms->Send($ordObj->phone, "170212345678", $msg))
{
$sent++;
}
}
echo "
$updated orders updated. $sent messages sent.<
/b>
";
}
6. Congratulations! This completes sending SMS notifications when orders are
dispatched. The screen for Luigi will look similar to the following screenshot.
7. Well, we should fix the grammar on that page to take care of singulars,
but we expect a lot of orders! So let's keep it at that for now, and see what
happened here.
Pages:
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151