php - Magento - customer_save_after always fired twice -
i using customer_save_after
event in magento, , working fine apart 1 annoying thing - fired twice.
there no other modules rewriting , can find no other reason happening. when through of events getting fired @ time , event definately getting fired twice.
anyone explain this?
i writing web service hooks , turning out quite inefficient duplicate things.
i've noticed double-save behaviour too. way prevent issue observer set flag in request can checked e.g.
if(mage::registry('customer_save_observer_executed')){ return $this; //this method has been executed once in request (see comment below) } ...execute arbitrary code here.... /* customer addresses seem call before_save event twice, * need set variable process once, otherwise duplicates */ mage::register('customer_save_observer_executed',true);
Comments
Post a Comment