Model/Connector/Order.php
public function setOrderData($orderData)
    {
        $this->id = $orderData->getIncrementId();
        $this->email = $orderData->getCustomerEmail();
        $this->quoteId = $orderData->getQuoteId();
        $this->storeName = $orderData->getStoreName();
        $this->purchaseDate = $orderData->getCreatedAt();
        $this->deliveryMethod = $orderData->getShippingDescription();
        $this->deliveryTotal = (float)number_format(
            $orderData->getShippingAmount(),
            2,
            '.',
            ''
        );
        $this->currency = $orderData->getStoreCurrencyCode();
        $payment = $orderData->getPayment();

        if ($payment) {
            if ($payment->getMethod()) {
                $methodInstance = $payment->getMethodInstance($payment->getMethod());
                if ($methodInstance) {
                    $this->payment = $methodInstance->getTitle();
                }
            }
        }

        $this->couponCode = $orderData->getCouponCode();

        /*
         * custom order attributes
         */
        $website = $this->_storeManager->getStore($orderData->getStore())->getWebsite();

        $customAttributes
            = $this->helper->getConfigSelectedCustomOrderAttributes(
                $website
            );

        if ($customAttributes) {
            $fields = $this->helper->getOrderTableDescription();
            $this->custom = [];
            foreach ($customAttributes as $customAttribute) {
                if (isset($fields[$customAttribute])) {
                    $field = $fields[$customAttribute];
                    $value = $this->_getCustomAttributeValue(
                        $field,
                        $orderData
                    );
                    if ($value) {
                        $this->_assignCustom($field, $value);
                    }
                }
            }
        }

        /*
         * Billing address.
         */
        $this->processBillingAddress($orderData);

        /*
         * Shipping address.
         */
        $this->processShippingAddress($orderData);

        $syncCustomOption = $this->helper->getWebsiteConfig(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_PRODUCT_CUSTOM_OPTIONS,
            $website
        );

        /*
         * Order items.
         */
        $this->processOrderItems($orderData, $syncCustomOption);

        $this->orderSubtotal = (float)number_format(
            $orderData->getData('subtotal'),
            2,
            '.',
            ''
        );
        $this->discountAmount = (float)number_format(
            $orderData->getData('discount_amount'),
            2,
            '.',
            ''
        );
        $orderTotal = abs(
            $orderData->getData('grand_total') - $orderData->getTotalRefunded()
        );
        $this->orderTotal = (float)number_format($orderTotal, 2, '.', '');
        $this->orderStatus = $orderData->getStatus();

        unset($this->_storeManager);

        return $this;
    }
public function setOrderData($orderData)
    {
        $this->id = $orderData->getIncrementId();
        $this->email = $orderData->getCustomerEmail();
        $this->quoteId = $orderData->getQuoteId();
        $this->storeName = $orderData->getStoreName();
        $this->purchaseDate = $orderData->getCreatedAt();
        $this->deliveryMethod = $orderData->getShippingDescription();
        $this->deliveryTotal = (float)number_format(
            $orderData->getShippingAmount(),
            2,
            '.',
            ''
        );
        $this->currency = $orderData->getStoreCurrencyCode();
        $payment = $orderData->getPayment();

        if ($payment) {
            if ($payment->getMethod()) {
                $methodInstance = $payment->getMethodInstance($payment->getMethod());
                if ($methodInstance) {
                    $this->payment = $methodInstance->getTitle();
                }
            }
        }

        $this->couponCode = $orderData->getCouponCode();

        /*
         * custom order attributes
         */
        $website = $this->_storeManager->getStore($orderData->getStore())->getWebsite();

        $customAttributes
            = $this->helper->getConfigSelectedCustomOrderAttributes(
                $website
            );

        if ($customAttributes) {
            $fields = $this->helper->getOrderTableDescription();
            $this->custom = [];
            foreach ($customAttributes as $customAttribute) {
                if (isset($fields[$customAttribute])) {
                    $field = $fields[$customAttribute];
                    $value = $this->_getCustomAttributeValue(
                        $field,
                        $orderData
                    );
                    if ($value) {
                        $this->_assignCustom($field, $value);
                    }
                }
            }
        }

        /*
         * Billing address.
         */
        $this->processBillingAddress($orderData);

        /*
         * Shipping address.
         */
        $this->processShippingAddress($orderData);

        $syncCustomOption = $this->helper->getWebsiteConfig(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_PRODUCT_CUSTOM_OPTIONS,
            $website
        );

        /*
         * Order items.
         */
        $this->processOrderItems($orderData, $syncCustomOption);

        $this->orderSubtotal = (float)number_format(
            $orderData->getData('subtotal'),
            2,
            '.',
            ''
        );
        $this->discountAmount = (float)number_format(
            $orderData->getData('discount_amount'),
            2,
            '.',
            ''
        );
        $orderTotal = abs(
            $orderData->getData('grand_total') - $orderData->getTotalRefunded()
        );
        $this->orderTotal = (float)number_format($orderTotal, 2, '.', '');
        $this->orderStatus = $orderData->getStatus();

        unset($this->_storeManager);

        return $this;
    }
public function setOrderData ( $ orderData ) { $ this -> id = $ orderData -> getIncrementId ( ) ; $ this -> email = $ orderData -> getCustomerEmail ( ) ; $ this -> quoteId = $ orderData -> getQuoteId ( ) ; $ this -> storeName = $ orderData -> getStoreName ( ) ; $ this -> purchaseDate = $ orderData -> getCreatedAt ( ) ; $ this -> deliveryMethod = $ orderData -> getShippingDescription ( ) ; $ this -> deliveryTotal = ( float ) number_format ( $ orderData -> getShippingAmount ( ) , 2 , '.' , '' ) ; $ this -> currency = $ orderData -> getStoreCurrencyCode ( ) ; $ payment = $ orderData -> getPayment ( ) ; if ( $ payment ) { if ( $ payment -> getMethod ( ) ) { $ methodInstance = $ payment -> getMethodInstance ( $ payment -> getMethod ( ) ) ; if ( $ methodInstance ) { $ this -> payment = $ methodInstance -> getTitle ( ) ; } } } $ this -> couponCode = $ orderData -> getCouponCode ( ) ; /*
         * custom order attributes
         */ $ website = $ this -> _storeManager -> getStore ( $ orderData -> getStore ( ) ) -> getWebsite ( ) ; $ customAttributes = $ this -> helper -> getConfigSelectedCustomOrderAttributes ( $ website ) ; if ( $ customAttributes ) { $ fields = $ this -> helper -> getOrderTableDescription ( ) ; $ this -> custom = [ ] ; foreach ( $ customAttributes as $ customAttribute ) { if ( isset ( $ fields [ $ customAttribute ] ) ) { $ field = $ fields [ $ customAttribute ] ; $ value = $ this -> _getCustomAttributeValue ( $ field , $ orderData ) ; if ( $ value ) { $ this -> _assignCustom ( $ field , $ value ) ; } } } } /*
         * Billing address.
         */ $ this -> processBillingAddress ( $ orderData ) ; /*
         * Shipping address.
         */ $ this -> processShippingAddress ( $ orderData ) ; $ syncCustomOption = $ this -> helper -> getWebsiteConfig ( \ Dotdigitalgroup \ Email \ Helper \ Config :: XML_PATH_CONNECTOR_SYNC_ORDER_PRODUCT_CUSTOM_OPTIONS , $ website ) ; /*
         * Order items.
         */ $ this -> processOrderItems ( $ orderData , $ syncCustomOption ) ; $ this -> orderSubtotal = ( float ) number_format ( $ orderData -> getData ( 'subtotal' ) , 2 , '.' , '' ) ; $ this -> discountAmount = ( float ) number_format ( $ orderData -> getData ( 'discount_amount' ) , 2 , '.' , '' ) ; $ orderTotal = abs ( $ orderData -> getData ( 'grand_total' ) - $ orderData -> getTotalRefunded ( ) ) ; $ this -> orderTotal = ( float ) number_format ( $ orderTotal , 2 , '.' , '' ) ; $ this -> orderStatus = $ orderData -> getStatus ( ) ; unset ( $ this -> _storeManager ) ; return $ this ; }
Set the order data information.

@param \Magento\Sales\Model\Order $orderData

@return $this
Set the order data information .