protected function parseInput($input) { if(empty($input['quote']) || !($input['quote'] instanceof ISC_QUOTE)) { return false; } /** @var ISC_QUOTE */ $quote = $input['quote']; $billingAddress = $quote->getBillingAddress(); $billingCustomFields = $billingAddress->getCustomFields(); $billingFormSessionId = 0; if(!empty($billingCustomFields)) { $billingFormSessionId = $GLOBALS['ISC_CLASS_FORM']->saveFormSessionManual($billingCustomFields); } $order = array( 'ordcustid' => $quote->getCustomerId(), 'ordtotalqty' => $quote->getNumItems(), 'ordisdigital' => (int)$quote->isDigital(), 'subtotal_ex_tax' => $quote->getSubTotal(false), 'subtotal_inc_tax' => $quote->getSubTotal(true), 'subtotal_tax' => $quote->getSubTotalTax(), 'total_tax' => $quote->getTaxTotal(), 'base_shipping_cost' => $quote->getBaseShippingCost(), 'shipping_cost_ex_tax' => $quote->getShippingCost(false), 'shipping_cost_inc_tax' => $quote->getShippingCost(true), 'shipping_cost_tax' => $quote->getShippingCostTax(), 'shipping_cost_tax_class_id' => getConfig('taxShippingTaxClass'), 'base_handling_cost' => $quote->getBaseHandlingCost(), 'handling_cost_ex_tax' => $quote->getHandlingCost(false), 'handling_cost_inc_tax' => $quote->getHandlingCost(true), 'handling_cost_tax' => $quote->getHandlingCostTax(), 'handling_cost_tax_class_id' => getConfig('taxShippingTaxClass'), 'base_wrapping_cost' => $quote->getBaseWrappingCost(), 'wrapping_cost_inc_tax' => $quote->getWrappingCost(true), 'wrapping_cost_ex_tax' => $quote->getWrappingCost(false), 'wrapping_cost_tax' => $quote->getWrappingCostTax(), 'wrapping_cost_tax_class_id' => getConfig('taxGiftWrappingTaxClass'), 'total_ex_tax' => $quote->getGrandTotalWithStoreCredit(), 'total_inc_tax' => $quote->getGrandTotalWithStoreCredit(), 'ordbillfirstname' => $billingAddress->getFirstName(), 'ordbilllastname' => $billingAddress->getLastName(), 'ordbillcompany' => $billingAddress->getCompany(), 'ordbillstreet1' => $billingAddress->getAddress1(), 'ordbillstreet2' => $billingAddress->getAddress2(), 'ordbillsuburb' => $billingAddress->getCity(), 'ordbillstate' => $billingAddress->getStateName(), 'ordbillzip' => $billingAddress->getZip(), 'ordbillcountry' => $billingAddress->getCountryName(), 'ordbillcountrycode' => $billingAddress->getCountryIso2(), 'ordbillcountryid' => $billingAddress->getCountryId(), 'ordbillstateid' => $billingAddress->getStateId(), 'ordbillphone' => $billingAddress->getPhone(), 'ordbillemail' => $billingAddress->getEmail(), 'ordformsessionid' => $billingFormSessionId, 'ordgiftcertificateamount' => $quote->getGiftCertificateTotal(), 'ordstorecreditamount' => $quote->getAppliedStoreCredit(), 'orddiscountamount' => $quote->getDiscountAmount(), 'coupon_discount' => $quote->getCouponDiscount(), 'shipping_address_count' => count($quote->getShippingAddresses()), 'ordcustmessage' => $quote->getCustomerMessage(), 'ordnotes' => $quote->getStaffNotes(), ); // Add in any other user supplied variables foreach($input as $k => $v) { if($k == 'quote') { continue; } $order[$k] = $v; } return parent::parseInput($order); }