문제

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 :)

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top