Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Event dispatch requests
 
lbourrel
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2008-06-09
Ayaline - Poitiers
 

lostbens,

The parameter depends of the event.

For example, in core/Mage/Checkout/Model/Cart.php you can find :
Mage::dispatchEvent(’checkout_cart_product_add_after’, array(’quote_item’=>$result, ‘product’=>$product));
This means that the event ‘checkout_cart_product_add_after’ is called with two params : quote_item and product. You can call them in your event with :
$observer->getEvent()->getQuoteItem() and $observer->getEvent()->getProduct()

An other example when you save a model :
In app\code\core\Mage\Core\Model\Abstract.php you can find :
Mage::dispatchEvent($this->_eventPrefix.’_save_before’, array($this->_eventObject=>$this));
So, the parameter depends of your model. You must look the _eventPrefix of your model.
If it’s a catalog/product, your call will be :
$observer->getEvent()->getProduct()

HTH…

 
Magento Community Magento Community
Magento Community
Magento Community
 
lostbens
Member
 
Total Posts:  31
Joined:  2008-09-04
 

Hey Vinai

from Mage/checkout/controllers/OnepageController.php (line 166):

Mage::dispatchEvent(’checkout_onepage_controller_success_action’);

what’s being passed???!

B.

ps I played around with the $observer object to see what I could grab, but I was fumbling in the dark, in the end I retrieved the order using:
$orderId = Mage::getSingleton(’checkout/session’)->getLastRealOrderId();
$order = Mage::getModel(’sales/order’)->loadByIncrementId($orderId);
but to be honest I have no idea if this is the best way of retrieving the order - it just seems to do the trick in the few cases I’ve tested so far.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lostbens
Member
 
Total Posts:  31
Joined:  2008-09-04
 

Laurent thanks

looks like for the example I was using there is nothing passed - maybe not the best event to get started with… wink

B.

 
Magento Community Magento Community
Magento Community
Magento Community
 
skippybosco
Enthusiast
 
Avatar
Total Posts:  796
Joined:  2008-10-03
 

Can anyone point me in the right direction of what is the best events for when a new user is created.

(bonus points if you know the event for when they login and logout as I’m trying to populate a cookie for a 3rd party app)

Thanks!

S

 
Magento Community Magento Community
Magento Community
Magento Community
 
lbourrel
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2008-06-09
Ayaline - Poitiers
 

Skippy,

Do you talk about “admin user” or “customer” ?

If customer, then you can use :
customer_login
customer_logout
customer_save_after

If admin user, then you can use…
well… there’s not !

So first way :
for login/logout : override Mage_Adminhtml_IndexController and add a dispatchEvent of your own.
for save : same but with Mage_Adminhtml_Permissions_UserController.
Another way :
perhaps you can use the event controller_action_postdispatch_{action_name}, but i’m not sure you will have all informations that you need.

Hope this helps and i will have extra points… grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
skippybosco
Enthusiast
 
Avatar
Total Posts:  796
Joined:  2008-10-03
 

Thanks so much Laurent, I’ll code this up now in my 1.2 sandbox and see how it goes!

Regardless of the outcome, extra points for the response time alone.

Cheers!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Vinai
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-04-04
Heidelberg, Germany
 

Back OT: another event request:

Mage::dispatchEvent('groupscatalog_layer_fiter_items_init_after', array('filter' => $this'items' => &$this->_items));
in Mage_Catalog_Model_Layer_Filter_Abstract::_initItems() would be quite helpful.

Thanks,
Vinai

EDIT: stupid idea, would not work the way I posted. but something along these lines to work on the filter items would be nice.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Vinai
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-04-04
Heidelberg, Germany
 

I’m wondering, will there be an update on when or which of these events will be implemented in the core?
It’s been a couple of releases for some of the requests..

Vinai

 
Magento Community Magento Community
Magento Community
Magento Community
 
Vinai
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-04-04
Heidelberg, Germany
 

I’m Back!  grin
I’m getting lots of conflicts between modules overriding Blocks.
So, how about changing the core_block_abstract_to_html_after event in Mage_Core_Block_Abstract::toHtml() to something where actual html could be injected / filtered / converted?

$html $this->_afterToHtml($html);
$this->setHtml($html);
Mage::dispatchEvent('core_block_abstract_to_html_after', array('block' => $this));
return 
$this->getHtml();

I suggest adding a block specific event, too.

if ($this->_eventPrefixMage::dispatchEvent($this->_eventPrefix'_to_html_after', array('block' => $this));

Thanks,

Vinai

 
Magento Community Magento Community
Magento Community
Magento Community
 
retif
Sr. Member
 
Total Posts:  171
Joined:  2008-08-16
Odessa, Ukraine
 

requesting events to implement proper integration of firephp

1.
file: \app\code\core\Mage\Core\Controller\Varien\Front.php

function: public function dispatch()

before: $this->getResponse()->sendResponse();

event: Mage::dispatchEvent(’controller_front_before_sendresponse’, array(’front’=>$this));

i need this to flush firephp headers to response object

2.
file: /app/Mage.php

function: public static function log($message, $level=null, $file = ‘’)

after:
if (!Mage::getStoreConfig(’dev/log/active’)) {
return;
}

event: Mage::dispatchEvent(’mage_log’, array(’message’=>$message, ‘leve’=>$level, ‘file’=>$file));

i need that to intercept all logs and serve them with firephp

that two events will make possible using firephp logging features, but without firephp db queries profiler.

i maked firephp query profiler to work by adding one line to getConnection function of Mage_Core_Model_Resource_Type_Db_Pdo_Mysql
becouse firephp need array type of profiler key
$configArr[’profiler’] = (array)$configArr[’profiler’];

 
Magento Community Magento Community
Magento Community
Magento Community
 
lbourrel
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2008-06-09
Ayaline - Poitiers
 

Hi,

You can find the list of events for the v1.2.0.2 :

http://www.magentocommerce.com/wiki/customizing_magento_using_event-observer_method#events

 
Magento Community Magento Community
Magento Community
Magento Community
 
Vinai
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-04-04
Heidelberg, Germany
 

Please add the following event, analog to the existing checkout_onepage_controller_success_action:

Mage::dispatchEvent('checkout_multishipping_controller_success_action')

Thanks,
Vinai

 
Magento Community Magento Community
Magento Community
Magento Community
 
Fullestop
Jr. Member
 
Avatar
Total Posts:  18
Joined:  2008-12-09
 
massi - 05 October 2008 04:58 AM

* Right before a new registration is saved

Hi,

has this already been implemented? I couldn’t find this event in the Mage core code..

Best regards

yes

 
Magento Community Magento Community
Magento Community
Magento Community
 
Auriferous
Jr. Member
 
Total Posts:  26
Joined:  2008-05-22
 

I am trying to create a mod that will allow me to draw the price from a a custom attribute field based on the user group id. I was trying to do this with the getFinalPrice() event but can seem to get things working properly. I posted a thread yesterday on this here:

http://www.magentocommerce.com/boards/viewthread/35196/

Can anyone help?

Thanks,

Bryan

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gregersen
Member
 
Total Posts:  57
Joined:  2008-06-15
 

I need an event dispatch to observe when an order is set to complete, the invoice is created, or when the shipment has been made…
Is there already one to use? Please help!?

Thanks,
Mr.Gregersen

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top