public function getInvitationStatus($order_id, $status) { if ($status == MW_Affiliate_Model_Statusinvitation::PURCHASE) { $collection = Mage::getModel('affiliate/affiliatehistory')->getCollection()->addFieldToFilter('order_id', array('eq' => $order_id)); foreach ($collection as $item) { $orderStatus = $item->getStatus(); break; } return MW_Affiliate_Model_Status::getLabel($orderStatus); } else { return Mage::helper('affiliate')->__('Completed'); } }
public function render(Varien_Object $row) { if (empty($row['status'])) { return ''; } if ($row['status'] == MW_Affiliate_Model_Statusinvitation::PURCHASE) { $orderId = $row['order_id']; $collection = Mage::getModel('affiliate/affiliatehistory')->getCollection()->addFieldToFilter('order_id', array('eq' => $orderId)); foreach ($collection as $item) { $orderStatus = $item->getStatus(); break; } return MW_Affiliate_Model_Status::getLabel($orderStatus); } else { return Mage::helper('affiliate')->__('Completed'); } }
public function getStatusText($status) { return MW_Affiliate_Model_Status::getLabel($status); }
public function updateStatusAction() { $history_ids = (array) $this->getRequest()->getParam('mw_history_id'); $status = (int) $this->getRequest()->getParam('status'); if (!is_array($history_ids)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('affiliate')->__('Please select affiliate history(s)')); } else { try { $count_success = 0; $count_error = 0; foreach ($history_ids as $history_id) { $history = Mage::getModel('affiliate/affiliatetransaction')->load($history_id); $order_id = $history->getOrderId(); $status_order = (int) $history->getStatus(); if ($status == MW_Affiliate_Model_Status::CANCELED) { if ($status_order == MW_Affiliate_Model_Status::PENDING) { $count_success = $count_success + 1; MW_Affiliate_Model_Observer::saveOrderCanceled($order_id); } else { $count_error = $count_error + 1; } } else { if ($status == MW_Affiliate_Model_Status::COMPLETE) { if ($status_order == MW_Affiliate_Model_Status::PENDING) { $count_success = $count_success + 1; MW_Affiliate_Model_Observer::saveOrderComplete($order_id); } else { $count_error = $count_error + 1; } } else { if ($status == MW_Affiliate_Model_Status::CLOSED) { if ($status_order == MW_Affiliate_Model_Status::COMPLETE) { $count_success = $count_success + 1; MW_Affiliate_Model_Observer::saveOrderClosed($order_id); } else { $count_error = $count_error + 1; } } } } } $status_label = MW_Affiliate_Model_Status::getLabel($status); if ($count_success > 0) { $this->_getSession()->addSuccess($this->__('%s order(s) have been %s', $count_success, $status_label)); } if ($count_error > 0) { $this->_getSession()->addError($this->__('%s order(s) cannot be %s', $count_error, $status_label)); } } catch (Mage_Core_Model_Exception $e) { $this->_getSession()->addError($e->getMessage()); } catch (Exception $e) { $this->_getSession()->addError($e->getMessage()); } } $this->_redirect('*/*/index'); }