_redirect("ekomimeetsmage_admin/watch/sent/");
}
/**
* Review overview
*/
public function reviewsAction()
{
$this->loadLayout();
// header
$head = $this->getLayout()->getBlock('head');
$head->setTitle($this->__("eKomiMeetsMage Reviews Overview")." - meets-ecommerce");
$this->_setActiveMenu('meecom/ekomimeetsmage');
// content
$this->_addContent($this->getLayout()->createBlock('ekomimeetsmage/adminhtml_watch_review_head'));
$this->_addContent($this->getLayout()->createBlock('ekomimeetsmage/adminhtml_watch_review_grid'));
// footer
$this->_setLogo();
$this->renderLayout();
}
/**
* Overview of sent status
*/
public function sentAction()
{
$this->loadLayout();
// header
$head = $this->getLayout()->getBlock('head');
$head->setTitle($this->__("eKomiMeetsMage Sent Status")." - meets-ecommerce");
$this->_setActiveMenu('meecom/ekomimeetsmage');
// content
$this->_addContent($this->getLayout()->createBlock('ekomimeetsmage/adminhtml_watch_sent_head'));
$this->_addContent($this->getLayout()->createBlock('ekomimeetsmage/adminhtml_watch_sent_grid'));
// footer
$this->_setLogo();
$this->renderLayout();
}
/**
* Resends an email to a customer
*/
public function resendemailAction()
{
$queueId = $this->getRequest()->getParam('id');
$session = Mage::getSingleton('core/session');
if ($queueId <= 0) {
$session->addError($this->__("Could not load mail in queue with having no id."));
return $this->_redirect("ekomimeetsmage_admin/watch/sent");
}
$mail = Mage::getModel('ekomimeetsmage/rating_email');
$mail->load($queueId);
if ($mail->getId() <= 0) {
$session->addError($this->__("Could not find mail in queue with id %s", $queueId));
return $this->_redirect("ekomimeetsmage_admin/watch/sent");
}
/* @var $helper MeetsEcommerce_Ekomimeetsmage_Helper_Mail */
$helper = Mage::helper('ekomimeetsmage/mail');
$api = Mage::getModel('ekomimeetsmage/api');
/* @var $helper MeetsEcommerce_Ekomimeetsmage_Helper_Cron */
$cron = Mage::helper('ekomimeetsmage/cron');
$processHelper = Mage::helper('ekomimeetsmage/mail_sending_process');
$order = Mage::getModel('sales/order')->load($mail->getOrderId());
try
{
if (!$mail->getEkomiLink()) {
$settings = $api->getSettings($order->getStoreId());
$processType = $processHelper->getProcessType($order->getStoreId());
$cron->setEkomiLink($mail,$order,$settings,$processType);
$mail->save();
}
if ($helper->sendMailToCustomer($mail, $order) === true) {
$session->
addSuccess(
$this->__(
"Resent email successfully to %s %s",
$mail->getCustomerFirstname(),
$mail->getCustomerLastname()
)
);
}
}catch(Exception $e){
$session->addError(
$this->__("Could not send email for following reason: %s", $e->getMessage())
);
$this->log(" Could not send email for following reason: ".$e->getMessage());
$this->log(PHP_EOL.$e->getTraceAsString());
}
return $this->_redirect("ekomimeetsmage_admin/watch/sent");
}
/**
* Sets the logo as image
*/
private function _setLogo()
{
$this->_setCustomHtml(
'
'
);
}
/**
* Adds custom html
*
* @param string $html
*/
private function _setCustomHtml($html)
{
$block = $this->getLayout()->createBlock('meecomframe/adminhtml_general_customhtml');
$block->setHtml($html);
$this->_addContent($block);
}
public function log($message, $type=null)
{
Mage::helper('ekomimeetsmage')->log($message, $type);
}
}