Example #1
0
 public function render(Varien_Object $row)
 {
     if (!$row->getInfo()) {
         $row->setInfo("—");
     }
     echo $row->getInfo();
 }
Example #2
0
 public function getAffiliateInfo()
 {
     if (!is_null($this->_affiliateInfo)) {
         return $this->_affiliateInfo;
     }
     $info = array();
     //hainh 22-07-2014
     if (Mage::getSingleton('affiliateplus/session')->getTopAffiliateIndentifyCode()) {
         $accountCode = Mage::getSingleton('affiliateplus/session')->getTopAffiliateIndentifyCode();
         $account = Mage::getModel('affiliateplus/account')->setStoreId(Mage::app()->getStore()->getId())->loadByIdentifyCode($accountCode);
         if ($account->getId() && $account->getStatus() == 1 && $account->getId() != Mage::helper('affiliateplus/account')->getAccount()->getId()) {
             $info[$accountCode] = array('index' => 1, 'code' => $accountCode, 'account' => $account);
         }
         $infoObj = new Varien_Object(array('info' => $info));
         $this->_affiliateInfo = $infoObj->getInfo();
         return $this->_affiliateInfo;
     }
     //end edit
     // Check Life-Time sales commission
     if (Mage::helper('affiliateplus/config')->getCommissionConfig('life_time_sales')) {
         $tracksCollection = Mage::getResourceModel('affiliateplus/tracking_collection');
         $customer = Mage::getSingleton('customer/session')->getCustomer();
         if ($customer && $customer->getId()) {
             $tracksCollection->getSelect()->where("customer_id = {$customer->getId()} OR customer_email = ?", $customer->getEmail());
         } else {
             /* hainh update 25-04-2014 */
             if (Mage::getSingleton('checkout/session')->hasQuote()) {
                 $quote = Mage::getSingleton('checkout/session')->getQuote();
                 $customerEmail = $quote->getCustomerEmail();
             } else {
                 $customerEmail = "";
             }
             $tracksCollection->addFieldToFilter('customer_email', $customerEmail);
             /* end update */
         }
         $track = $tracksCollection->getFirstItem();
         if ($track && $track->getId()) {
             $account = Mage::getModel('affiliateplus/account')->setStoreId(Mage::app()->getStore()->getId())->load($track->getAccountId());
             if ($account && $account->getStatus() == 1) {
                 $info[$account->getIdentifyCode()] = array('index' => 1, 'code' => $account->getIdentifyCode(), 'account' => $account);
                 $this->_affiliateInfo = $info;
                 return $this->_affiliateInfo;
             }
         }
     }
     $cookie = Mage::getSingleton('core/cookie');
     $map_index = $cookie->get('affiliateplus_map_index');
     for ($i = $map_index; $i > 0; $i--) {
         $accountCode = $cookie->get("affiliateplus_account_code_{$i}");
         $account = Mage::getModel('affiliateplus/account')->setStoreId(Mage::app()->getStore()->getId())->loadByIdentifyCode($accountCode);
         if ($account && $account->getStatus() == 1 && (Mage::helper('affiliateplus/account')->getAccount() && $account->getId() != Mage::helper('affiliateplus/account')->getAccount()->getId())) {
             $info[$accountCode] = array('index' => $i, 'code' => $accountCode, 'account' => $account);
         }
     }
     $infoObj = new Varien_Object(array('info' => $info));
     Mage::dispatchEvent('affiliateplus_get_affiliate_info', array('cookie' => $cookie, 'info_obj' => $infoObj));
     $this->_affiliateInfo = $infoObj->getInfo();
     return $this->_affiliateInfo;
 }
Example #3
0
 public function getAffiliateInfo()
 {
     $info = array();
     $cookie = Mage::getSingleton('core/cookie');
     $map_index = $cookie->get('affiliateplus_map_index');
     for ($i = $map_index; $i > 0; $i--) {
         $accountCode = $cookie->get("affiliateplus_account_code_{$i}");
         $account = Mage::getModel('affiliateplus/account')->setStoreId(Mage::app()->getStore()->getId())->loadByIdentifyCode($accountCode);
         if ($account->getId() && $account->getStatus() == 1 && $account->getId() != Mage::helper('affiliateplus/account')->getAccount()->getId()) {
             $info[$accountCode] = array('index' => $i, 'code' => $accountCode, 'account' => $account);
         }
     }
     $infoObj = new Varien_Object(array('info' => $info));
     Mage::dispatchEvent('affiliateplus_get_affiliate_info', array('cookie' => $cookie, 'info_obj' => $infoObj));
     return $infoObj->getInfo();
 }