Exemplo n.º 1
0
 public function loadCouponSavingByOrderId($brand, $orderId, $customerId)
 {
     $query = "SELECT * FROM coupon_saving cs, coupon co\n         WHERE order_id= {$orderId} \n         AND customer ={$customerId}\n         AND co.coupon_id= cs.coupon_id\n       \t AND brand='{$brand}'";
     Mage::log("loadCouponSaving select  query {$query}", null, 'custom.log');
     $results = $this->readConnection->fetchAll($query);
     $savingCoupon = null;
     if (sizeof($results) == 0) {
         return null;
     } else {
         Mage::log("in else ", null, 'custom.log');
         foreach ($results as $savingCouponData) {
             Mage::log("in for loop", null, 'custom.log');
             $savingCoupon = CouponSaving::fillWithData($savingCouponData);
             Mage::log($savingCoupon, null, 'custom.log');
             break;
         }
         return $savingCoupon;
     }
 }