gpt4 book ai didi

magento - 如何在 Magento 中检索成功消息?

转载 作者:行者123 更新时间:2023-12-04 13:00:47 25 4
gpt4 key购买 nike

如何在 Magento 中检索成功消息?

Array
(
[core] => Array
(
[_session_validator_data] => Array
(
[remote_addr] => 192.168.151.102
[http_via] =>
[http_x_forwarded_for] =>
[http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.70 Safari/533.4
)

[session_hosts] => Array
(
[technova2] => 1
)

[messages] => Mage_Core_Model_Message_Collection Object
(
[_messages:protected] => Array
(
)

[_lastAddedMessage:protected] => Mage_Core_Model_Message_Success Object
(
[_type:protected] => success
[_code:protected] => Your review has been accepted for moderation
[_class:protected] =>
[_method:protected] =>
[_identifier:protected] =>
[_isSticky:protected] =>
)

)

[just_voted_poll] =>
[visitor_data] => Array
(
[] =>
[server_addr] => -1062692990
[remote_addr] => -1062693018
[http_secure] =>
[http_host] => technova2
[http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.70 Safari/533.4
[http_accept_language] => en-US,en;q=0.8
[http_accept_charset] => ISO-8859-1,utf-8;q=0.7,*;q=0.3
[request_uri] => /~rahuls/sextoys/index.php/review/product/list/id/169/
[session_id] => 21bq2vtkup5m1gtghknlu1tit42c6dup
[http_referer] => http://technova2/~rahuls/sextoys/index.php/review/product/list/id/169/
[first_visit_at] => 2010-06-16 05:49:56
[is_new_visitor] =>
[last_visit_at] => 2010-06-16 06:00:00
[visitor_id] => 935
[last_url_id] => 23558
)

[last_url] => http://technova2/~rahuls/sextoys/index.php/review/product/list/id/169/
)
)

发表评论后,我想显示以下消息:“您的评论已被审核接受”。它出现在 $_SESSION 数组中,但我如何获取它?请帮忙。提前致谢。

最佳答案

它是您所有答案的组合。这几乎适用于任何块:

    //A Success Message
Mage::getSingleton('checkout/session')->addSuccess("Your cart has been updated successfully!");

//A Error Message
Mage::getSingleton('checkout/session')->addError("Your cart has been updated successfully!");

//A Info Message (See link below)
Mage::getSingleton('checkout/session')->addNotice("This is just a FYI message...");

//These two lines are required to get it to work
session_write_close(); //THIS LINE IS VERY IMPORTANT!
$this->_redirect('checkout/cart');

归功于:

http://www.magentocommerce.com/boards/viewthread/40324/ (我发布答案的地方)



http://www.deepcodeonline.com/blog/magento/how-to-display-error-success-and-notice-messages-in-magento/

关于magento - 如何在 Magento 中检索成功消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3051289/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com