tnw_salesforce_order_send_after
An event is triggered after sending data in Salesforce
TNW_Salesforce_Block_Sales_Order_Status_New_Form
Mage::dispatchEvent('tnw_salesforce_order_send_after', array('data' => $_data, 'result' => $_result, 'field' => 'AcctSeedERP__Opportunity__c'));
How to use this event:
Several steps are involved into utilizing this event:
- config.xml
- a listener should be added for this event
- a listener should point to a Magento Observer module and a method in that observer
- Magento Observer
- holds a method where you can add your custom logic
Example Config
<?xml version="1.0"?> <config> <global> <events> <tnw_salesforce_order_send_after> <observers> <tnw_salesforce_order_send_after> <class>tnw_salesforce/observer</class> <method>orderSendAfter</method> </tnw_salesforce_order_send_after> </observers> </tnw_salesforce_order_send_after> </events> </global> </config>
Example Observer
<?php /** * Class TNW_Salesforce_Model_Observer */ class TNW_Salesforce_Model_Observer { public function orderSendAfter(Varien_Event_Observer $observer) { /** * Array of Salesforce objects * @var array $_data * * Example: * array (size=1) * 100000083 => // 100000083 - Magento Order Number * object(stdClass)[583] * public 'BillToContactId' => string '0032400000M41daAAB' (length=18) * public 'ShipToContactId' => string '0032400000M41daAAB' (length=18) * public 'tnw_mage_basic__BillingCustomer__c' => string '0032400000M41daAAB' (length=18) * public 'Status' => string 'Draft' (length=5) * public 'tnw_mage_basic__Magento_Website__c' => string 'a002400000CSEGD' (length=15) * public 'tnw_mage_basic__Magento_ID__c' => string '100000083' (length=9) * public 'Pricebook2Id' => string '01s24000004r4t6AAA' (length=18) * public 'EffectiveDate' => string '2013-04-22T14:48:29+00:00' (length=25) * public 'AccountId' => string '0012400000Q0YdkAAF' (length=18) * public 'BillingStreet' => string 'Canal Street' (length=12) * public 'BillingCity' => string 'Michigan' (length=8) * public 'BillingState' => string 'Michigan' (length=8) * public 'BillingPostalCode' => string '49036' (length=5) * public 'BillingCountry' => string 'US' (length=2) * public 'ShippingStreet' => string 'Canal Street' (length=12) * public 'ShippingCity' => string 'Michigan' (length=8) * public 'ShippingState' => string 'Michigan' (length=8) * public 'ShippingPostalCode' => string '49036' (length=5) * public 'ShippingCountry' => string 'US' (length=2) * public 'Description' => string 'Items ordered: * ======================================= * SKU, Qty, Name, Price, Tax, Subtotal, Net Total * ======================================= * abl003, 1.00, Broad St. Flapover Briefcase, USD400.00, USD29.00, USD429.00, USD410.82 * abl004, 1.00, Houston Travel Wallet, USD150.00, USD10.88, USD160.88, USD154.06 * ======================================= * Sub Total: USD550.00 * Tax: USD39.88 * Shipping (United Parcel Service - Ground): USD15.22 * Discount Amount: USD-25.00 * Total: USD580.10 * ' (length=479) * public 'Type' => string 'Magento' (length=7) * public 'Name' => string 'Magento Order #100000083' (length=24) */ $_data = $observer->getData('data'); /** * Array of Results * @var array $_result * * Example: * array (size=1) * 0 => * object(stdClass)[534] * public 'created' => boolean false * public 'id' => string '80124000001479HAAQ' (length=18) * public 'success' => boolean true */ $_result = $observer->getData('result'); /** * @var string $_field */ $_field = $observer->getData('field'); // Your custom code } }
Related articles
Filter by label
There are no items with the selected labels at this time.