Fatal error: Call to a member function getTelephone() on a non-object in Observer.php while payment using payUmoney
Fatal error: Call to a member function getTelephone() on a non-object in Observer.php while payment using payUmoney
我正在使用 Magento 1.9.2.4
版本。我在下订单后使用 SMS module
接收短信。虽然选择选项 "Pay Using Credit Card / Debit Card / Net Banking" 它正在重定向到 payUmoney
金钱页面和金额扣除但是下订单时间错误变得像这样
Fatal error: Call to a member function getTelephone() on a non-object in model/Observer.php on line 125
我的观察者代码:
public function salesOrderPlace(Varien_Event_Observer $observer)
{
try{
Mage::log("New Order Placed");
$order = Mage::getModel('sales/order');
$incrementId = Mage::getSingleton('checkout/session')->getLastOrderId();
Mage::log("Order ID:".$incrementId);
$order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
if ($order instanceof Mage_Sales_Model_Order)
{
if($this->getHelper()->issalesOrderPlace())
{
$mobilenumbers = $order->getBillingAddress()->getTelephone();
$message = $this->getHelper()->getOrderMessage($order); //enter Your Message
$customerName = $order->getCustomerName();
//curlApicall : this method will return tru or fale.
$retunValue = $this->getHelper()->curlApiCall($message,$mobilenumbers,$customerName,"New Order");
}
if($this->getHelper()->issalesOrderPlaceForAdmin())
{
$mobilenumbers = $this->getHelper()->getAdminMobileNumber();
$message = $this->getHelper()->getOrderMessageForAdmin($order); //enter Your Message
$customerName = $order->getCustomerName();
//curlApicall : this method will return tru or fale.
$retunValue = $this->getHelper()->curlApiCall($message,$mobilenumbers,$customerName,"New Order");
}
}
//return false;
}catch(Exception $e) {
Mage::log($e->getMessage());
}
}
问题出在这里
$order = Mage::getModel('sales/order');
$incrementId = Mage::getSingleton('checkout/session')->getLastOrderId();
Mage::log("Order ID:".$incrementId);
$order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
增量ID与订单id不同
使用此修复程序:
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getModel('sales/order')->load($orderId);
我正在使用 Magento 1.9.2.4
版本。我在下订单后使用 SMS module
接收短信。虽然选择选项 "Pay Using Credit Card / Debit Card / Net Banking" 它正在重定向到 payUmoney
金钱页面和金额扣除但是下订单时间错误变得像这样
Fatal error: Call to a member function getTelephone() on a non-object in model/Observer.php on line 125
我的观察者代码:
public function salesOrderPlace(Varien_Event_Observer $observer)
{
try{
Mage::log("New Order Placed");
$order = Mage::getModel('sales/order');
$incrementId = Mage::getSingleton('checkout/session')->getLastOrderId();
Mage::log("Order ID:".$incrementId);
$order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
if ($order instanceof Mage_Sales_Model_Order)
{
if($this->getHelper()->issalesOrderPlace())
{
$mobilenumbers = $order->getBillingAddress()->getTelephone();
$message = $this->getHelper()->getOrderMessage($order); //enter Your Message
$customerName = $order->getCustomerName();
//curlApicall : this method will return tru or fale.
$retunValue = $this->getHelper()->curlApiCall($message,$mobilenumbers,$customerName,"New Order");
}
if($this->getHelper()->issalesOrderPlaceForAdmin())
{
$mobilenumbers = $this->getHelper()->getAdminMobileNumber();
$message = $this->getHelper()->getOrderMessageForAdmin($order); //enter Your Message
$customerName = $order->getCustomerName();
//curlApicall : this method will return tru or fale.
$retunValue = $this->getHelper()->curlApiCall($message,$mobilenumbers,$customerName,"New Order");
}
}
//return false;
}catch(Exception $e) {
Mage::log($e->getMessage());
}
}
问题出在这里
$order = Mage::getModel('sales/order');
$incrementId = Mage::getSingleton('checkout/session')->getLastOrderId();
Mage::log("Order ID:".$incrementId);
$order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
增量ID与订单id不同
使用此修复程序:
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getModel('sales/order')->load($orderId);