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:
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!?
@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>
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?
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:
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
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.