I want to save the successful order for another db
-
07-10-2020 - |
Question
Please help me to sort out this.
I want to save all the successfull order details from magento 1.9.3 website to another database.From where i can break the checkout process and get all the details>?
Solution
You can create a new custom module.
In the event observer capture the even checkout_onepage_controller_success_action
and create a method in the observer and complete your logic in the method.
Hope you know how to create a new module.
1 ) here is custom config.xml for call observer file
<?xml version="1.0"?>
<config>
<modules>
<Namespace_Modulename>
<version>0.1.0</version>
</Namespace_Modulename>
</modules>
<frontend>
<events>
<checkout_onepage_controller_success_action>
<observers>
<Namespace_Modulename_Customevent>
<type>singleton</type>
<class>Namespace_Modulename_Model_Observer</class>
<method>customFunction</method>
</Namespace_Modulename_Customevent>
</observers>
</checkout_onepage_controller_success_action>
</events>
</frontend>
2 ) create observer.php file inside your module/Model directory and paste this code
<?php
class Namespace_Modulename_Model_Observer
{
public function customFunction(Varien_Event_Observer $observer)
{
$order = $observer->getEvent()->getOrder();
//here you can add your custom code
}
}
Do not forget active your module before check.To activate your module upload this file(Namespace_Modulename.xml) to your Path(app\etc\modules)
<?xml version="1.0" encoding="utf-8"?>
<config>
<modules>
<Namespace_Modulename>
<active>true</active>
<codePool>local</codePool>
</Namespace_Modulename>
</modules>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange