tnw_salesforce_order_send_before

An event is triggered before sending data in Salesforce.

TNW_Salesforce_Block_Sales_Order_Status_New_Form
Mage::dispatchEvent('tnw_salesforce_order_send_before', array('data' => $_data, 'field' => 'AcctSeedERP__Opportunity__c'));

 

How to use this event:

Several steps are involved into utilizing this event:

  1. config.xml
    1. a listener should be added for this event
    2. a listener should point to a Magento Observer module and a method in that observer
  2. Magento Observer
    1. holds a method where you can add your custom logic
Example Config
<?xml version="1.0"?>
<config>
    <global>
        <events>
            <tnw_salesforce_order_send_before>
                <observers>
                    <tnw_salesforce_order_send_before>
                        <class>tnw_salesforce/observer</class>
                        <method>orderSendBefore</method>
                    </tnw_salesforce_order_send_before>
                </observers>
            </tnw_salesforce_order_send_before>
        </events>
    </global>
</config>
Example Observer
<?php

/**
 * Class TNW_Salesforce_Model_Observer
 */
class TNW_Salesforce_Model_Observer
{
 
    public function orderSendBefore(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');

		/** 
		 * @var string $_field 
		 */
		$_field = $observer->getData('field');

		// Your custom code
    }
 
}

 

Filter by label

There are no items with the selected labels at this time.