久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Magento - customer_save_after 總是觸發(fā)兩次

Magento - customer_save_after always fired twice(Magento - customer_save_after 總是觸發(fā)兩次)
本文介紹了Magento - customer_save_after 總是觸發(fā)兩次的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我在 magento 中使用 customer_save_after 事件,除了 1 件煩人的事情之外,一切正常 - 它總是被觸發(fā)兩次.

I am using the customer_save_after event in magento, and all is working fine apart from 1 annoying thing - it is always fired twice.

沒有其他模塊重寫這個(gè),我找不到其他原因?qū)е逻@種情況發(fā)生.當(dāng)我查看此時(shí)被觸發(fā)的所有事件時(shí),該事件肯定會被觸發(fā)兩次.

There are no other modules rewriting this and I can find no other reason for this happening. When I look through all of the events getting fired at this time and this event is definately getting fired twice.

有人解釋一下嗎?

我正在編寫一個(gè)與此掛鉤的 Web 服務(wù),但結(jié)果證明復(fù)制內(nèi)容非常低效.

I am writing a web service that hooks into this and its turning out to be quite inefficient to duplicate things.

推薦答案

我也注意到了這種雙重保存行為.防止觀察者出現(xiàn)問題的方法是在請求中設(shè)置一個(gè)可以檢查的標(biāo)志,例如

I've noticed this double-save behaviour too. The way to prevent issue with your observer is to set a flag in the request that can be checked e.g.

    if(Mage::registry('customer_save_observer_executed')){
        return $this; //this method has already been executed once in this request (see comment below)
    }

    ...execute arbitrary code here....

    /* Customer Addresses seem to call the before_save event twice, 
    * so we need to set a variable so we only process it once, otherwise we get duplicates
    */
    Mage::register('customer_save_observer_executed',true); 

這篇關(guān)于Magento - customer_save_after 總是觸發(fā)兩次的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Override Magento Config(覆蓋 Magento 配置)
What would cause a print_r and/or a var_dump to fail debugging a variable?(什么會導(dǎo)致 print_r 和/或 var_dump 調(diào)試變量失敗?)
How to update custom options programatically in magento?(如何在 magento 中以編程方式更新自定義選項(xiàng)?)
Magento 404 on Admin Page(管理頁面上的 Magento 404)
Magento - get price rules from order(Magento - 從訂單中獲取價(jià)格規(guī)則)
Magento Change Product Page Titles to Include Attributes(Magento 更改產(chǎn)品頁面標(biāo)題以包含屬性)
主站蜘蛛池模板: 国产欧美一区二区三区日本久久久 | 免费在线精品视频 | 99久久久久 | 免费久久网 | 激情福利视频 | 超碰人人插 | 日韩影院一区 | 黄色在线免费观看视频网站 | 久久中文视频 | 一区二区三区视频 | 91免费视频 | 亚洲精品一区二区二区 | 成人欧美一区二区三区在线播放 | 97人人干 | 国产亚洲精品精品国产亚洲综合 | 中文字幕三区 | 日本免费一区二区三区视频 | 农夫在线精品视频免费观看 | 日韩成人一区 | 日本一二区视频 | 国产这里只有精品 | 国产精品久久久久久久久免费相片 | 日韩电影在线 | 国产综合区 | 天天插天天射天天干 | 欧美一区二区三区在线观看视频 | 狠狠操操| 午夜激情国产 | 婷婷成人在线 | 99视频免费在线 | 人人做人人澡人人爽欧美 | 最近中文字幕第一页 | 五月婷婷 六月丁香 | 免费性视频 | 亚洲成人精品一区 | 亚洲瑟瑟 | 一区二区三区精品在线视频 | 欧美日韩国产不卡 | 91黄色片免费看 | 午夜一区 | 福利视频日韩 |