Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
签出时的Magento错误消息_Magento_Message_Payment - Fatal编程技术网

签出时的Magento错误消息

签出时的Magento错误消息,magento,message,payment,Magento,Message,Payment,在我的自定义付款分机上: 是否可以在签出的最后一步显示错误消息?如果我使用addError方法,消息将显示在下一页,用户无法更改地址数据,例如 在所有的验证函数中,Mage::ThroweException消息都会通过Javascript向用户显示,但不会在授权函数中显示。在那里,Mage::ThroweException仅阻止要加载的下一页,但不显示任何消息。对用户不好 public function authorize(Varien_Object $payment, $amount) {

在我的自定义付款分机上:

是否可以在签出的最后一步显示错误消息?如果我使用addError方法,消息将显示在下一页,用户无法更改地址数据,例如

在所有的验证函数中,Mage::ThroweException消息都会通过Javascript向用户显示,但不会在授权函数中显示。在那里,Mage::ThroweException仅阻止要加载的下一页,但不显示任何消息。对用户不好

public function authorize(Varien_Object $payment, $amount)  
{
    $error = $this->api_call($payment, $amount);

    //no error, proceed to success page
    if(strlen($error) == 0)
    {
    return $this;   
    }
    //error
    else
    {
        //this adds an error message
        //which is displayed the next page  
    $session = Mage::getSingleton("checkout/session");
    $session->addError($return);

    session_write_close();

        //throw exception, which is not displayed anywhere
        //if i don't do this, i get success page with addError message,
        //but user has to do checkout again
        Mage::throwException($return);
    }
}

你试过这样做吗

throw new Mage_Payment_Model_Info_Exception(Mage::helper('checkout')->__('An error occured and this is the message'));
未经测试,但查看OnePageController和saveOrder函数此类型的异常处理方式不同,看起来可能会将您跳回支付部分并显示错误消息