Magento - set discount on a product before the cart
Question
i'm new on magento and i'm working on a module that permt a user to choose and to have the gfit with the product that he purchase. my question is, how can i set a discount on specific product in the checkout ? i've used : i make the modification in the observer on the event
checkout_cart_add_product_complete
.
$_cart_products = Mage::getModel("checkout/cart") -> getItems();
//foreache...
//if ...
$_cart_product->setDiscountAmount($realPrice-$giftPrice);
$_cart_product->setBaseDiscountAmount($realPrice-$giftPrice);
$_cart_product->save();
But it dosen't work thank you for your help :)
Solution
you don't need to code for doing this,just go to admin and you will see promotion tab,just select this, from here you can define promotion rules for products
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow