The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October 16th, 2020 at 11:59 PM EST.

php Wrapper and removed customers

Highlighted
Occasional Contributor

php Wrapper and removed customers

I am updating some contact info using phpWrapper, but I don't want to update the info for contacts that are "removed", yet I can't find a way to distinguish between active contacts and removed contacts in listContactDetails().

3 REPLIES 3
Highlighted
Employee

Re: php Wrapper and removed customers

Hey Erin,

 

I looked into your issue and actually revised the wrapper a little bit in order to get this to work the way I believe you need it to.

 

Please open the ctctWrapper.php file and goto line 1234 and modify it so it looks like this:

$utility = new Utility();
			if ($params['status'] == 'Do Not Mail')
			{
				$utility->setActionBy('ACTION_BY_CONTACT');
				$this->setStatus($params['status']);
			}
			else
			{
				$this->setStatus($params['status']);
			}

 This will allow you to now use the getStatus method located under the contact class.  Here is an example of how this would work

<?php
include_once('ctctwrapper.php');

// Istantiate Utility 
$ConstantContact = new Utility();

// Istantiate Contacts as part of the Contacts Collection
$Contacts = new ContactsCollection();

// Get all the contacts and put into the $Contact Variable
$Contact = $Contacts->listContacts();

// This will put the specific object data into the $OneContact Variable
$OneContact = $Contacts->listContactDetails($Contact[0][0]);

// myContact will now hold the status of the Object data of $OneContact
$myContact = $OneContact->getStatus();

// output data
print_r($myContact);

?>

 Please let me know if this helps,

Ryan Davis
Quality Engineer
Highlighted
Occasional Contributor

Re: php Wrapper and removed customers

thank you...can you explain why you put this in the if and the else statement?

 

I just did this:

 

$utility = new Utility();
			if ($params['status'] == 'Do Not Mail')
			{
				$utility->setActionBy('ACTION_BY_CONTACT');
			}
			$this->setStatus($params['status']);

 since I am doing the same thing no matter what, whay am I creating an else? It seems to work fine the way I did it, but I am happy to change it.

Highlighted
Employee

Re: php Wrapper and removed customers

Hey Erin,


That will work fine, I put it in the statement as I was testing something out with it and that appears to work with out creating any errors in the wrapper. 

 

Let me know if you need any more help.

Ryan Davis
Quality Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured