Magento Forum

Event dispatch requests
 
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
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

I need an event when the user removes an item from the cart.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

@Classy Llama Studios

Thanks for the tip, I’ve been looking for that for a few days, I guess I didn’t search hard enough.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tman_f
Sr. Member
 
Total Posts:  85
Joined:  2008-02-12
 

Events are great.

What I need to do is create my very own event. This becomes quite necessary as systems become complex and stretch above the “out-of-the-box” features.

This is what I need to do:

Mage::dispatchEvent(’my_very_own_event’);

I have registered observers for this event, but nothing seems to happen when I dispatch my own event. Am I missing something?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
tman_f
Sr. Member
 
Total Posts:  85
Joined:  2008-02-12
 

Here is the event I am firing:

Mage::dispatchEvent(’reset_checkout’);

And here is my config.xml entry:

<global>
<events>
<reset_checkout>
<observers>
<rollback_giftcard_redemption>
<type>singleton</type>
<class>giftcard/sales_quote_reset</class>
<method>rollbackGiftcardRedemption</method>
</rollback_giftcard_redemption>
</observers>
</reset_checkout>
</events>
</global>

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

@class Llama Studios
Actually, that is incorrect. He had it correct by specifying the {shortname}/{relative class name} in his XML config

@tman_f
As for why your event handler is not working, try putting it in the <frontend><events> section and see if that changes anything.

 
Magento Community Magento Community
Magento Community
Magento Community
 
boomography
Jr. Member
 
Avatar
Total Posts:  14
Joined:  2009-04-15
Madeira Beach, FL
 

I am having trouble getting an event observer to trigger.  Here’s the code…

app/etc/modules/Boom.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <
modules>
        <
Boom_Order>
            <
codepool>local</codepool>
            <
active>true</active>
        </
Boom_Order>
    </
modules>
</
config>

app/code/core/local/Boom/Order/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <global>
        <
models>
            <
boomorder>
                <class>
Boom_Order_Model</class>
            </
boomorder>
        </
models>
    </global>
    <
frontend>
        <
events>
            <
checkout_onepage_controller_success_action>
                <
observers>
                    <
boom_order_observer>
                        <
type>singleton</type>
                        <class>
boomorder/observer</class>
                        <
method>myOrderProcess</method>
                    </
boom_order_observer>
                </
observers>
            </
checkout_onepage_controller_success_action>
        </
events>
    </
frontend>
</
config>

app/code/core/local/Boom/Order/Model/Observer.php

<?php

class Boom_Order_Model_Observer
{
    
/**
     * Event Hook: checkout_onepage_controller_success_action
     * @param $observer Varien_Event_Observer
     */

    
public function myOrderProcess($observer)
    
{
        Mage
::log("Enter myOrderProcess");

        
$order = new Mage_Sales_Model_Order();
        
$incrementId Mage::getSingleton('checkout/session')->getLastRealOrderId();

        
$order->loadByIncrementId($incrementId);

        
Mage::log("Exit myOrderProcess");
        
}
}
I’m sure it is something silly but I have been beating my forehead flat on this.
 
Magento Community Magento Community
Magento Community
Magento Community
 
SebboKleine
Jr. Member
 
Total Posts:  23
Joined:  2008-07-10
 

@boom
Can you call your observer directly (Mage::getSingleton(’boomorder/observer’);)? Because you named it boomorder instead of order in your config.xml, Magento might not be able to find it.

<global>
<models>
<boomorder> (should be order)
<class>Boom_Order_Model</class>
</boomorder>
</models>
</global>

 
Magento Community Magento Community
Magento Community
Magento Community
 
rainman127
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-06-30
 

Hi
in: app/code/core/local/Boom/Order/etc/config.xml

try changing

<class>boomorder/observer</class>

to

<class>boom_order_model_observer</class>

 
Magento Community Magento Community
Magento Community
Magento Community
 
SBC Fulfillment
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2009-07-06
 

Hey all, I’m a bit new to all this but so far Magento is rocking!

I’m in the process of writing a module and I’m using the “sales_order_place_after” event to trigger my code.  Everything seems fine except I’m having trouble getting an order ID out of the event object.

$order$observer->getEvent()->getOrder();

is giving me the Mage_Sales_Model_Order Object when I print_r it out to a file and I can see the order number in there but

$id$observer->getEvent()->getOrder()->getId();

gives me nothing and no errors in the browser or server logs :(
Am I missing something simple here?

Thanks in advance

 
Magento Community Magento Community
Magento Community
Magento Community
 
SBC Fulfillment
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2009-07-06
 

When I dumped the order object and did a quick search for the order number I had just created I found it in the file, but unfortunately it’s buried amongst so much other stuff I gave up on trying to figure out the hierarchy it was under.

I still don’t know the reason getId() didn’t work, but I was able to extract the order number like:

$order$observer->getEvent()->getOrder()->increment_id;

If you have any recommendations for a good book or two that would help with this kind of stuff I’m all ears smile

Thanks again!

 
Magento Community Magento Community
Magento Community
Magento Community
 
SBC Fulfillment
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2009-07-06
 

Yeah, now that I’m getting into this kind of thing more and more often I think it’s time to step it up a notch and bust out some new tools.  I was mainly after something related to Magento programming, although so far these forums seem to be the best resource.  Well, back to the trenches for me

 
Magento Community Magento Community
Magento Community
Magento Community
 
inertia1024
Jr. Member
 
Total Posts:  14
Joined:  2009-06-15
 
xerxes2695 - 07 August 2009 04:50 AM

I still don’t know the reason getId() didn’t work, but I was able to extract the order number like:

$order$observer->getEvent()->getOrder()->increment_id;

I was having exactly the same issue with the sales_order_place_after event.  Incidentally, I noticed that $order->getCustomerId() also returns null if the order is placed by a new customer.  My only guess is that this event fires somewhere before the order is committed.

I’ve switched to using the sales_order_invoice_pay event for my module… I can get the order through the $invoice->getOrder, and everything seems to be working now.

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