For certain reason, i have to prevent the users to add the product into the cart.
here is the event in config.xml
<events>
<controller_action_predispatch_checkout_cart_add>
<observers>
<abc_findp>
<type>model</type>
<class>Abc_Findp_Model_Observer</class>
<method>searchStock</method>
</abc_findp>
</observers>
</controller_action_predispatch_checkout_cart_add>
</events>
Observer:
public function searchStock($observer) {
//how to prevent a product be added to a cart?
Mage::getSingleton('core/session')->addNotice('This product can't be added to shopping cart.');
}
Or i need to use checkout_cart_product_add_after event, to remove the quote item after added into a cart?
Thanks.!