/** * Load customer balance data by specified customer id and website id * * @param Enterprise_CustomerBalance_Model_Balance $object * @param int $customerId * @param int $websiteId */ public function loadByCustomerAndWebsiteIds($object, $customerId, $websiteId) { $read = $this->getReadConnection(); if ($data = $read->fetchRow($read->select()->from($this->getMainTable())->where('customer_id = ?', $customerId)->where('website_id = ?', $websiteId)->limit(1))) { $object->addData($data); } }
/** * Get balance instance * * @return Enterprise_CustomerBalance_Model_Balance */ protected function _getBalanceModel() { if (is_null($this->_balanceModel)) { $this->_balanceModel = Mage::getModel('enterprise_customerbalance/balance')->setCustomer($this->_getCustomer())->setWebsiteId(Mage::app()->getStore()->getWebsiteId()); //load customer balance for customer in case we have //registered customer and this is not guest checkout if ($this->_getCustomer()->getId()) { $this->_balanceModel->loadByCustomer(); } } return $this->_balanceModel; }