When I look at the event checkout_onepage_controller_success_action
and works, but I can not get the Id of the newly created order.
Anyone have any idea??
Use magento-1.4.1.0
Thanks
When I look at the event checkout_onepage_controller_success_action
and works, but I can not get the Id of the newly created order.
Anyone have any idea??
Use magento-1.4.1.0
Thanks
The event is dispatched like this:
Mage::dispatchEvent( checkout_onepage_controller_success_action , array( order_ids => array($lastOrderId)));
So to get the last orderId, simply make your observer method like this:
public function orderSuccessEvent($observer)
{
$observer->getData( order_ids ));
}
This is an answer provided by Branko Ajzele and I ve just successfully tested:
$order = new Mage_Sales_Model_Order();
$incrementId = Mage::getSingleton( checkout/session )->getLastRealOrderId();
$order->loadByIncrementId($incrementId);
Thanks to him and hope it ll work.
That event probably gets called before the action itself executes. Can you use sales_order_save_after
instead?
EDIT: Here s your ID code. In your observer:
public function setLinkStatus($observer) {
$order = $observer->getEvent()->getOrder();
$id = $order->getId();
// do something useful
}
The Onepage Checkout controller in the Magento version 1.4.1 is not updated to have functions that can obtain the Order ID and thus you cant have the order object and data from the event observer. To have this working in Magento 1.4.1 simply update your OnepageController with the necessary functions.
The best approach would be to create your own module and override the core controller.
Add this in the config xml of your module so that your controller is called before the core OnepageController.
<frontend><routers><checkout><use>standard</use><args><modules><MyCompany_MyModule before="Mage_Checkout">MyCompany_MyModule</MyCompany_MyModule></modules></args></checkout></routers></frontend>
Hope this helps
I have an auction website which let my users place an unlimited amount of autobiddings. To monitor these autobiddings something has to check the database every second. My question is if it is ...
I m trying to expose some events from a private object which is contained inside the object I am creating and it looks like the compiler is happy with this: private WindowUpdateServer ...
In my program, there is a place when I need to access a singleton resolved from a factory and attach to its event: void MyMethod() { myFactory.Resolve<MySingleton>().DoWork += WorkMethod; } ...
由于将javascript DOM方法放在第html页底部(在<有人>之后)远比利用“j Query”准备活动要快得多,因此我们不得不这样做:
I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...
I have a page which displays multiple blocks with results details. Inside each block I have some <a> tags with thickbox jQuery plugin attached: class="thickbox" Here is an example of one kind ...
I have a form, and want to disable/enable its submit button depending on whether the form s input text fields are empty or have had text entered into them. I think this means having an event handler ...
I ve built a shop with tons of JS running. One of the pieces of the cart, is a zip code field which is required to calculate shipping cost. This works fine going through the cart. Now clicking ...