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>
<sales_order_place_before>
<observers>
<class>opc/observer</class>
<method>checkitemsincartv</method>
</observers>
</sales_order_place_before>
<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>
And in the observer i have added this:
public function checkitemsincartv($observer)
{
Mage::getSingleton('core/session')->setItemsInCart("Works");
$data = $observer->getEvent()->getOrder();
Mage::log($data->debug(), null, "order.log", true);
}
But it seems to be not working.
How can i achieve that?