title: How to apply coupon in the magento product view before adding product to cart
body: <p>I had to replicate coupon functionality in which the user can able to apply the coupon code and see the discount price in product page itself before adding that product to cart.</p>
  
  <p>So i used ajax call to load the coupon code , its rule conditions by like the following way</p>
  
  <pre><code>&lt;?php
  -----
  
      $oCoupon = Mage::getModel('salesrule/coupon')-&gt;load($couponcode, 'code');
      if($oCoupon){
              $oRule     = Mage::getModel('salesrule/rule')-&gt;load($oCoupon-&gt;getRuleId());
              $rule_arr       = unserialize($oRule-&gt;getConditionsSerialized());
              $actions_serialized = unserialize($oRule-&gt;getData("actions_serialized"));
              $conditions = $rule_arr['conditions'];
              foreach($conditions as $condition){
                  $conditions1 = $condition['conditions'];
                  $type        = $condition['type'];
                  foreach($conditions1 as $condition1){
                      $type     = $condition1['type'];
                      $value    = $condition1['value'];
  
                  }
              }
          }
      }
  
  ----
  </code></pre>
  
  <p>Here i validated every possible rule - but still its not validating all defined rules and its not stable. </p>
  
  <p><strong>Is there anyway I can able to validate a product and coupon rules - or is there any extension which does validation against one product and coupon rules</strong>. Please help me</p>