How to apply coupon in the magento product view before adding product to cart -
How to apply coupon in the magento product view before adding product to cart -
i had replicate coupon functionality in user can able apply coupon code , see discount cost in product page before adding product cart.
so used ajax phone call load coupon code , rule conditions next way
<?php ----- $ocoupon = mage::getmodel('salesrule/coupon')->load($couponcode, 'code'); if($ocoupon){ $orule = mage::getmodel('salesrule/rule')->load($ocoupon->getruleid()); $rule_arr = unserialize($orule->getconditionsserialized()); $actions_serialized = unserialize($orule->getdata("actions_serialized")); $conditions = $rule_arr['conditions']; foreach($conditions $condition){ $conditions1 = $condition['conditions']; $type = $condition['type']; foreach($conditions1 $condition1){ $type = $condition1['type']; $value = $condition1['value']; } } } } ----
here validated every possible rule - still not validating defined rules , not stable.
is there anyway can able validate product , coupon rules - or there extension validation against 1 product , coupon rules. please help me
since can apply code cart/quote this, suggest looking in these models how validates code on product. (working backwards)
mage::getsingleton('checkout/cart') ->getquote() ->setcouponcode($couponcode) ->collecttotals() ->save();
magento magento-1.7
Comments
Post a Comment