php - Magento: Programmatically apply catalog price rule to order -


i have created catalog price rule , working fine when placing orders front end. but, when programmatically create orders through custom code, rules found not working eventhough assigning particular order customer belongs provided customer group. can on ? please see related code below:

.... //setting customer group id       $this->_quote->setcustomergroupid(9);      ... 

............

//$currentproduct - product object //$curquantity - product quantity $this->_quote->addproduct($currentproduct,new varien_object(array('qty'=> $curquantity))); 

.............

thanks! iqbal.

to apply catalog price rule quote object programatically, use

mage::getsingleton('checkout/cart')     ->getquote()     ->setcouponcode(strlen($couponcode) ? $couponcode : '')     ->collecttotals()     ->save(); 

Comments