/** * Retrieve coupon/rule uses for specified customer * * @param Mage_SalesRule_Model_Rule $rule * @param int $customerId * * @return string */ public function getCustomerUses($rule, $customerId) { $read = $this->_getReadAdapter(); $select = $read->select()->from($this->getTable('rule_customer'), array('cnt' => 'count(*)'))->where('rule_id = :rule_id')->where('customer_id = :customer_id'); return $read->fetchOne($select, array(':rule_id' => $rule->getRuleId(), ':customer_id' => $customerId)); }