/** * * @return void */ protected function addReceiver() { $soap = new SoapClient($this->settings['wsdlUrl']); $userdata = array(); $userdata['source'] = $this->settings['source']; $userdata['registered'] = time(); $attributes = array_merge($this->parseFields('fields.'), $this->parseFields('additionalfields.')); $userdata['email'] = $attributes['email']; $userdata['attributes'] = $this->convertAttributes($attributes); $this->utilityFuncs->debugMessage("Attributes: \"" . print_r($userdata['attributes'], true) . "\""); // überprüfen, ob schon im System ist $return = $soap->receiverGetByEmail($this->settings['apiKey'], $this->settings['listId'], $userdata['email'], 0); $subscriber_found = !($return->statuscode == 20); if (!$subscriber_found) { $return = $soap->receiverAdd($this->settings['apiKey'], $this->settings['listId'], $userdata); if ($return->status == Tx_Formhandler_Finisher_CleverReach::STATUS_SUCCESS) { $this->utilityFuncs->debugMessage("Subscriber \"" . $userdata['email'] . "\" accepted"); } else { $this->utilityFuncs->debugMessage("A problem with the new subscriber: " . (string) $return->message); } } if ($this->settings['directSubscription'] == "1") { // sofort aktivieren $return = $soap->receiverSetActive($this->settings['apiKey'], $this->settings['listId'], $userdata['email']); } else { $return = $soap->formsActivationMail($this->settings['apiKey'], $this->settings['formId'], $userdata['email']); if ($return->status == Tx_Formhandler_Finisher_CleverReach::STATUS_SUCCESS) { $this->utilityFuncs->debugMessage("Activation mail sent"); } else { $this->utilityFuncs->debugMessage("Activation mail error for \"" . $userdata['email'] . "\": " . $return->message); } } }
$messageStack->add('account_edit', ENTRY_TELEPHONE_NUMBER_ERROR); } if ($error == false) { //----------------------------- CleverReach Starts -------------------------------------- if (CR_ENABLED == 'true') { $client = new SoapClient('http://api.cleverreach.com/soap/interface_v5.1.php?wsdl'); // Check if email was changed and if so, delete old CleverReach record and create a new one. $query = 'SELECT customers_email_address FROM ' . TABLE_CUSTOMERS . ' WHERE customers_id = ' . (int) $customer_id; $res = mysql_query($query); if ($res && mysql_num_rows($res)) { $old_email_address = mysql_result($res, 0, 0); } if ($old_email_address != $email_address) { $client->receiverDelete(CR_API_KEY, CR_LIST_ID, $old_email_address); $crReceiver = array('email' => utf8_encode($email_address), 'source' => utf8_encode('SwissCart'), 'attributes' => array(0 => array('key' => 'firstname', 'value' => utf8_encode($firstname)), 1 => array('key' => 'lastname', 'value' => utf8_encode($lastname)))); $client->receiverAdd(CR_API_KEY, CR_LIST_ID, $crReceiver); } else { $crReceiver = array('email' => utf8_encode($email_address), 'source' => utf8_encode('SwissCart'), 'attributes' => array(0 => array('key' => 'firstname', 'value' => utf8_encode($firstname)), 1 => array('key' => 'lastname', 'value' => utf8_encode($lastname)))); $ret = $client->receiverUpdate(CR_API_KEY, CR_LIST_ID, $crReceiver); } } //------------------------------ CleverReach Ends -------------------------------------- $sql_data_array = array('customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_email_address' => $email_address, 'customers_telephone' => $telephone, 'customers_fax' => $fax); if (ACCOUNT_GENDER == 'true') { $sql_data_array['customers_gender'] = $gender; } if (ACCOUNT_DOB == 'true') { $sql_data_array['customers_dob'] = tep_date_raw($dob); } tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int) $customer_id . "'"); tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int) $customer_id . "'");