log("== Order event observer", Zend_Log::DEBUG); $this->log("= Version: ".Mage::helper('ekomimeetsmage')->getVersion(), Zend_Log::DEBUG); $this->log( "= StoreType: ".(Mage::helper('ekomimeetsmage')->isMultistore() ? "multistore" : "singlestore"), Zend_Log::DEBUG ); $order = $observer->getData('order'); $api_data = Mage::helper('ekomimeetsmage/api_data')->fetch( Mage::helper('ekomimeetsmage')->isMultistore() ? $order->getStoreId() : null ); if ($api_data["api_id"] !== "") { $emailData = array( "ekomi_rating_email_id" => null, "order_id" => $order->getId(), #emails without ekomi_link are not sended to ekomi yet "ekomi_link" => null, "send_out_date" => null, "sent_date" => null, "sent_status" => MeetsEcommerce_Ekomimeetsmage_Model_Rating_Email::STATUS_PENDING ); $this->log(" Saved following data: ", Zend_Log::DEBUG); $this->log(" ".var_export($emailData, true), Zend_Log::DEBUG); try{ Mage::getModel('ekomimeetsmage/rating_email')->setData($emailData)->save(); $this->log(" Saved email to send out.", Zend_Log::DEBUG); }catch(Exception $e){ $this->log("Email saving failed: ".$e->getMessage(), Zend_Log::ERR); $this->log($emailData, Zend_Log::ERR); } } } /** * eKomi Logger * * @param mixed $message * @param int $type */ private function log($message, $type=Zend_Log::INFO) { Mage::helper('ekomimeetsmage')->log($message, $type); } }