我正在观察将产品添加到购物车时触发的事件。这是我使用的教程:http: //inchoo.net/ecommerce/magento/dispatching-before-and-after-events-to-magento-core-actions/
现在在某些情况下,我想停止将产品添加到购物车的过程。我尝试抛出异常,但这给了我处理您的请求错误消息时出现错误。检查由 Magento 创建的报告并没有告诉我任何信息。我还能如何停止添加过程?
这是我的代码:
public function hookToAddToCartBefore($observer) {
...
if(somecondition) {
Mage::throwException('some message');
}
}