I'm currently looking for a method from which I can get the order status based on the order id
, customer email
and customer last name
.
I'd written this code so far
public function orderHistoryAction(){
$req = $this->getRequest();
$oid = $req->getParam('oid', '');
$lnm = $req->getParam('lnm', '');
$eml = $req->getParam('eml', '');
$order = Mage::getModel('sales/order')->loadByIncrementId($oid);
if ($order->getId()) {
if ((strcasecmp($lnm, $order->getCustomerLastname()) == 0) && (strcasecmp($eml, $order->getCustomerEmail()) == 0)) {
echo $order->getStatusLabel();
} else {
echo 'invalid';
}
} else {
echo 'invalid';
}
}
and is working well for both customer and guest. But this doesn't seems to me the right approach. I supposed to used something like written in this blog or this blog. If anybody could make me correct?