<events>
<checkout_onepage_controller_success_action>
<observers>
<sendmail>
<type>singleton</type>
<class>Xkey_Redegrupo_Model_Observer</class>
<method>sendMailRGroup</method>
</sendmail>
</observers>
</checkout_onepage_controller_success_action>
</events>
If I change the checkout_onepage_controller_success_action to sales_order_after_save, work but send 2 times the e-mail, when I use this, the e-mail sends succefull but the layout of /onepage/checkout/success/ lost style ? Why? ! help me Ç.Ç
Kin checkout_onepage_controller_success_action is an event is occur after order has successfully place and redirected to checkout/onepage/success pages.it an fronted event.sales_order_after_save is global event and it is run when you save order. several time are occurs during order procedure....
Exmple of event
<checkout_onepage_controller_success_action>
<observers>
<create_invoice_for_zero_payment>
<class>zerosubtotalpaymentmethod/createinvoice</class>
<method>automaticinovoice</method>
</create_invoice_for_zero_payment>
</observers>
</checkout_onepage_controller_success_action>
Related
I have to fire an observer method when the admin assign customer(s) to group on adminhtml. Can you help me which event is it?
I tried adminhtml_customer_save_after but it didn't worked.
You can use any one event below
customer_save_before,
customer_save_after
<global>
<events>
<customer_save_after>
<observers>
<change_customer_group>
<type>singleton</type>
<class>modulename/observer</class>
<method>ChangeCustomerGroup</method>
</change_customer_group>
</observers>
</customer_save_after>
</events>
</global>
I am using Magento 1.9.2 and i am working on a custom extension.
My question is:
How can i run custom php function when the checkout page is opened?
I know i have to mess around with the events of the extension config file but i am not exactly sure how i can point the function in the observer which i want to run when the checkout page is opened.
Here is events part of my config:
<events>
<controller_action_postdispatch_opc_json_saveOrder>
<observers>
<hss_save_order_onepage>
<class>paypal/observer</class>
<method>setResponseAfterSaveOrder</method>
</hss_save_order_onepage>
</observers>
</controller_action_postdispatch_opc_json_saveOrder>
<sales_order_place_before>
<observers>
<custom_ads>
<class>opc/observer</class>
<method>checkitemsincartv</method>
</custom_ads>
</observers>
</sales_order_place_before>
<sales_order_place_after>
<observers>
<newsletter_order_place_after>
<class>opc/observer</class>
<method>newsletter</method>
</newsletter_order_place_after>
</observers>
</sales_order_place_after>
<checkout_submit_all_after>
<observers>
<opc_checkout_submit_all_after>
<class>opc/observer</class>
<method>applyComment</method>
</opc_checkout_submit_all_after>
</observers>
</checkout_submit_all_after>
</events>
Here is the function that i want to run:
public function checkitemsincartv($observer)
{
Mage::getSingleton('core/session')->setItemsInCart("Works");
$data = $observer->getEvent()->getOrder();
Mage::log($data->debug(), null, "order.log", true);
}
How can i achieve that?
Thanks in advance!
You need to use the event - controller_action_predispatch_checkout_onepage_index or controller_action_postdispatch_checkout_onepage_index All controllers inherit the preDispatch or postDispatch method which fires a generic event for predispatch/postdispatch, and a specific event based on the requested action path.
The controller you need is in the checkout module and is called onepage with a default action of index.
Checkout Mage_Core_Controller_Varien_Action::preDispatch() or Mage_Core_Controller_Varien_Action::postDispatch() to see the relevant code
I am using Magento 1.7.0.2 (old but this isn't a post about telling me to upgrade please, its not practical right now).
I have an observer which works as expected for every event I am interested in however for some reason attempting to respond to customer_logout doesn't work.
I have the following set up:
<!--LOGOUT (doesnt)-->
<customer_logout>
<observers>
<analytics_logout>
<class>analytics/observer</class>
<method>logCustomerLogout</method>
<type>singleton</type>
</analytics_logout>
</observers>
</customer_logout>
<!--LOGIN (Works)-->
<customer_login>
<observers>
<analytics_login>
<class>analytics/observer</class>
<method>logCustomerLogin</method>
<type>singleton</type>
</analytics_login>
</observers>
</customer_login>
Where the logCustomerLogout function is:
public function logCustomerLogout(Varien_Event_Observer $observer)
{
Mage::getSingleton('core/session')->setData('someTagType', 'CustomerLogout');
}
I added logging to app/Mage.php to log to the console each event on DispatchEvent and the console shows the event is coming through as customer_logout so I don't understand what is going on.
Any ideas?
Since you have logged the output, it does fire. The only logical conclusion would be that some other event that is listening to it prevents it from reaching yours. I would suggest to find those events and log their call - see what is the last one it calls and obviously that is where it stops.
I am using sales_order_place_after event in observer event
<sales_order_place_after>
<observers>
<Test_Check_Model_Observer>
<type>singleton</type>
<class>Test_Check_Model_Observer</class>
<method>SubscribePlan</method>
</Test_Check_Model_Observer>
</observers>
</sales_order_place_after>
Then My Observer.php's Method SubscribePlan Contains
public function SubscribePlan($observer) {
die('getting called');
}
This event is Working but when i Place Order for Recurring Profile this event doesn't work, Can some one please Tell me any alternate event which also works for recurring profile after placing order
Here the code
<global>
<models>
<test>
<class>Test_Check_Model</class>
</test>
</models>
<events>
<events>
<sales_order_place_after>
<observers>
<mysales_order_observer>
<type>singleton</type>
<class>test/observer</class>
<method>SubscribePlan</method>
</mysales_order_observer>
</observers>
</sales_order_place_after>
</events>
</global>
I'm looking for something similar recently and my solution is
override model Mage_Sales_Model_Recurring_Profile with your own model
Inside your own model, set property $_eventPrefix to for example "recurring_profile"
create observer for event recurring_profile_save_commit_after.
If you need exactly the event when profile is created, you may need to override submit method and either dispatch a customized event or just put all code there without using event/observer at all.
P.S. I used Magento 1.9.3.2
i have a small problem. I have register two events, but only the last was alwas called,
can someone help me
<!-- Events -->
<events>
<checkout_type_onepage_save_order_after>
<observers>
<save_after>
<type>singleton</type>
<class>XXX_testr_Model_Observer_OrderObserver</class>
<method>orderSubmitEvent</method>
</save_after>
</observers>
</checkout_type_onepage_save_order_after>
<customer_save_after>
<observers>
<XXX_testr_observer_observer>
<type>singleton</type>
<class>XXX_testr_Model_Observer_Observer</class>
<method>customerSaveEvent</method>
</XXX_testr_observer_observer>
</observers>
</customer_save_after>
</events>
At first glance it could possibly be an observer name clash, try namespacing it to be unique
try changing:
save_after
to:
sdz_wawiconnector_observer_save_after
Depending on your usage, you might have more luck working with the controller thrown event checkout_onepage_controller_success_action.
Firstly, I can tell that your xml is valid.
Check such things:
duplicates of observer names (may be save_after or XXX_testr_observer_observer have already exist)
Look to the section, where you put these observers and there you want them to be executed. For example, you put them into frontend section, so customer_save_after will not run in admin.
Make a check if some other observer (from 3rd party extensions) do not crashes before. Or, for example, it can use 'die' in its code.
Check if some other extension rewrites core model/controller (or your store have such rewrite in app/code/local/Mage/.. section) and doesn't have event dispatcher in its code