<?php include '../infusionsoft.php'; include 'testUtils.php'; ?> <h1>Testing Add</h1> <?php $contact = new Infusionsoft_Contact(); $contact->FirstName = 'Joey'; $out = $contact->save(); ?> <pre><?php didItWorkInt($out); ?> </pre> <h1>Testing Update</h1> <?php $contact->LastName = 'Novak'; $out = $contact->save(); ?> <pre><?php didItWorkInt($out); ?> </pre> <h1>Testing Loading of an object by FirstName (findByField)</h1><?php $out = Infusionsoft_DataService::findByField(new Infusionsoft_Contact(), 'FirstName', 'Joey', 1, 0); ?>
<form> ContactId: <input type="text" name="ContactId" value="<?php if (isset($_REQUEST['ContactId'])) { echo $_REQUEST['ContactId']; } ?> " /> <input type="submit"/> </form><br/> <?php include '../infusionsoft.php'; if (isset($_REQUEST['ContactId'])) { Infusionsoft_Contact::addCustomField('_LeadScore'); $contact = new Infusionsoft_Contact($_REQUEST['ContactId']); $contact->_LeadScore = $contact->_LeadScore + 1; $contact->save(); echo 'Lead Score for Contact: ' . $contact->FirstName . ' ' . $contact->LastName . ' is now: ' . $contact->_LeadScore; }
* 25=ShippingAddress1 * 26=ShippingAddress2 * 27=ShippingTown * 28=ShippingCounty * 29=ShippingCountry * 30=ShippingPostalCode * 31=ShippingTelephone */ for ($x = 0; $x <= $concount; $x++) { if ($ekmcons[$x] == $order[0]) { $found = true; } } if ($found != true) { // re-create the contact object otherwise we are just editing the same record $contact = new Infusionsoft_Contact(); $contact->addCustomField('_County'); $contact->addCustomField('_County2'); $contact->AccountId = $order[0]; $contact->Email = $order[9]; $contact->FirstName = $order[10]; $contact->LastName = $order[11]; $contact->Company = $order[12]; $contact->StreetAddress1 = $order[13]; $contact->StreetAddress2 = $order[14]; $contact->City = $order[15]; $contact->_County = $order[16]; $contact->Country = $order[17]; $contact->PostalCode = $order[18]; $contact->Phone1 = $order[19]; $contact->Address2Street1 = $order[21];
$order = fgetcsv($file); /*we use index 0 (ekm account id) to test if the line is an actual contact. * if index 0 is not blank then it is account/contact information and the contact * details will be found in successive lines.*/ if ($order[0] != '') { // now we run a cursive check with existing ekm account id's to prevent duplicates for ($x = 0; $x <= $concount; $x++) { if ($ekmids[$x] == $order[0]) { $found = true; $sel = $x; } } if ($found != true) { if ($order[9] != '' && strpos('EKMUNIQUE', $order[9]) == 0 && $order[36] == 'COMPLETE') { //echo 'updating for email address '.$order[9].'<br>'; $contact = new Infusionsoft_Contact(); $eml = new Infusionsoft_EmailService(); $grp = new Infusionsoft_ContactGroupAssign(); $data = new Infusionsoft_DataService(); $contact->addCustomField('_County'); $contact->addCustomField('_County2'); $contact->addCustomField('_ShippingCompany'); $contact->addCustomField('_ShippingFirstName'); $contact->addCustomField('_ShippingLastName'); $contact->AccountId = $order[0]; $contact->Email = $order[9]; $contact->FirstName = $order[10]; $contact->LastName = $order[11]; $contact->Company = $order[12]; $contact->StreetAddress1 = $order[13]; $contact->StreetAddress2 = $order[14];
<?php /****************************************************************************** * * Program focus : To import information from EKM Powershop using a .csv file * export as input. Contact information, product information, * invoice information and payment information is imported * using the infusionsoft api. * * Author : John W. Borelli with The Plan B Club, LLC for Rob Drummond and his * client, Ian Ashland of Ashland Chemicals. * * Inputs : All input is extracted via .csv file reads * * Outputs: All output will be found in the form of resulting data being * imported into the appropriate Infusionsoft app. * ******************************************************************************/ // Include required support files include_once 'EKMConfig.php'; require_once 'Infusionsoft/infusionsoft.php'; require_once 'src/isdk.php'; // Instantiate all required objects $app = new iSDK(); $app->cfgCon($appname, $appkey); $con = new Infusionsoft_Contact(); $con->load(52549); var_dump($con);
<?php include '../infusionsoft.php'; include 'object_editor_all_tables.php'; include '../tests/testUtils.php'; Infusionsoft_SdkEventManager::attach('loaded', "DataObject.Loaded"); Infusionsoft_SdkEventManager::attach('deleted', "DataObject.Deleted"); Infusionsoft_SdkEventManager::attach('saved', "DataObject.Saved"); Infusionsoft_SdkEventManager::attach('saved2', "DataObject.Saved"); $contact = new Infusionsoft_Contact(); $contact->FirstName = 'TEST'; $contact->save(); $contact2 = new Infusionsoft_Contact($contact->Id); $contact2->delete(); function loaded($event) { echo 'Loaded!<br/>'; } function deleted(Infusionsoft_SdkEvent $event) { echo 'Deleted!<br/>'; } function saved(Infusionsoft_SdkEvent $event) { echo 'Saved!<br/>'; } function saved2(Infusionsoft_SdkEvent $event) { echo 'Saved2!<br/>'; }
<?php include '../infusionsoft.php'; $contact = new Infusionsoft_Contact(); $customFields = Infusionsoft_CustomFieldService::getCustomFields(new Infusionsoft_Contact()); /** @var Infusionsoft_DataFormField $customField */ $customFieldsAsArray = array(); foreach ($customFields as $customField) { $customFieldsAsArray[] = '_' . $customField->Name; } $contact->addCustomFields($customFieldsAsArray); $contacts = Infusionsoft_DataService::queryWithOrderBy(new Infusionsoft_Contact(), array('Id' => '%'), 'LastUpdated', 1, 1, array('Id')); var_dump($contacts);