示例#1
0
<?php

/**
*
* Template Name: Streams 
*
**/
// $streams = new ldmStreams();
$ws = new ldmwebservices();
// $form = $ws->getForm();
// $form = array_flip($form);
// foreach ($form as $key => &$value) {
// 	$value = 'notused';
// }
//$ws->renderFullForm();
$fields = array();
$fields['customerId'] = '87987987';
$fields['orderReferenceNumber'] = '';
$fields['firstName'] = 'yourname';
$fields['lastName'] = 'lastnamemaman';
$fields['addressLine1'] = 'add_1';
$fields['addressLine2'] = 'nothinghere';
$fields['townCity'] = 'London';
$fields['Email'] = '*****@*****.**';
$fields['postcode'] = 'e16ql';
$fields['telephone'] = '36345643565463';
$fields['password'] = '******';
$fields['occupation'] = 'somestuff';
$fields['dob'] = '1976-09-10';
$fields['forceLead'] = 'false';
// echo $ws->getCustomForm($fields);
示例#2
0
/**
*
* template name: Profile Authorize
*
**/
// if this page is accesses directly just http_redirect
if (empty($_SESSION['section_1']) || empty($_SESSION['section_6'])) {
    echo 'This page cannot be accessed directly';
    return false;
}
get_header();
?>

<?php 
$ldm_webservice = new ldmwebservices();
$ldm_sagepay = new ldm_sagepay();
$config = $ldm_sagepay->getConfig();
$config['vendor_name'] = 'EnclothedLtd';
$config['currency'] = 'GBP';
$config['total'] = '500.00';
$config['description'] = 'Enclothed concierge service.';
$config['customer_name'] = $_SESSION['section_1']['name'];
$names = explode(' ', $_SESSION['section_1']['name']);
$last_names = '';
foreach ($names as $k => $value) {
    if ($k == 0) {
        continue;
    }
    //bypass the first name
    $last_names .= $value . ' ';
示例#3
0
 /**
  *
  * Sends a profile to salesforce 
  *
  **/
 public function sendToSalesforce($profile)
 {
     $ws = new ldmwebservices();
     $fields = array();
     $fields['customerId'] = $profile->profile_id;
     $fields['orderReferenceNumber'] = '';
     $fields['firstName'] = $profile->first_name;
     $fields['lastName'] = $profile->last_name;
     $fields['addressLine1'] = $profile->address;
     $fields['addressLine2'] = '';
     $fields['townCity'] = $profile->town;
     $fields['email'] = $profile->email;
     $fields['postcode'] = $profile->post_code;
     $fields['telephone'] = $profile->phone;
     $fields['password'] = '';
     $fields['occupation'] = $profile->occupation;
     $fields['dob'] = $profile->dob;
     $fields['forceLead'] = 'true';
     $fields['howDidYouHearAboutEnclothed'] = $profile->feedback_1;
     $fields['howDidYouHearAboutEnclothedOther'] = '';
     $fields['isBuyingForPerson'] = $profile->other_person;
     $fields['buyingForWho'] = '';
     // section 2 - style
     $fields['styleChoices'] = $profile->styles;
     // section 3 - preferences
     $shirts_type = implode(',', $this->getSelectedOptions('shirt_type', $profile->preferences));
     $shirts_wear = implode(',', $this->getSelectedOptions('shirt_wear', $profile->preferences));
     $trousers_colour = implode(',', $this->getSelectedOptions('trousers_colour', $profile->preferences));
     $trousers_type = implode(',', $this->getSelectedOptions('trouser_type', $profile->preferences));
     $denim_type = implode(',', $this->getSelectedOptions('denim_type', $profile->preferences));
     $denim_colour = implode(',', $this->getSelectedOptions('denim_colours', $profile->preferences));
     $shorts_colour = implode(',', $this->getSelectedOptions('shorts_colours', $profile->preferences));
     $shorts_preferences = implode(',', $this->getSelectedOptions('shorts', $profile->preferences));
     $shoes_colour = implode(',', $this->getSelectedOptions('colour_shoes', $profile->preferences));
     $shoes_type = implode(',', $this->getSelectedOptions('shoe_type', $profile->preferences));
     $brands_preferences = implode(',', $this->getSelectedOptions('brand', $profile->preferences));
     $fields['shirtTypeChoice'] = $shirts_type;
     $fields['whereDoYouWearYourShirtChoices'] = $shirts_wear;
     $fields['trouserTypeChoice'] = $trousers_type;
     $fields['trouserColourChoices'] = $trousers_colour;
     $fields['jeanStyleChoice'] = $denim_type;
     $fields['denimColourChoice'] = $denim_colour;
     $fields['shortStyleChoice'] = $shorts_preferences;
     $fields['shoeStyleChoices'] = $shoes_type;
     $fields['shoeColourChoices'] = $shoes_colour;
     $fields['brandChoices'] = $brands_preferences;
     $fields['favouriteBrands'] = $profile->more_brands;
     // section 4 - sizing
     $fields['tShirtSize'] = $profile->tshirt_size;
     $fields['neckSize'] = $profile->neck_size;
     $fields['sleeveLength'] = $profile->sleeve_lenght;
     $fields['shoeSize'] = $profile->shoe_size;
     $fields['jacketSize'] = $profile->jacket_size;
     $fields['trouserWaist'] = $profile->trouser_size;
     $fields['trouserInsideLeg'] = $profile->trouser_inside_leg_size;
     $fields['additionalSizeInfo'] = $profile->extra_info_size;
     $fields['brandsThatFitYouWell'] = $profile->more_brands_size;
     $replacebles = array('£', '+');
     $fields['shirtPriceMin'] = str_replace($replacebles, '', $profile->shirt_min_price);
     $fields['shirtPriceMax'] = str_replace($replacebles, '', $profile->shirt_max_price);
     $fields['trouserPriceMin'] = str_replace($replacebles, '', $profile->trouser_min_price);
     $fields['trouserPriceMax'] = str_replace($replacebles, '', $profile->trouser_max_price);
     $fields['coatPriceMin'] = str_replace($replacebles, '', $profile->coat_min_price);
     $fields['coatPriceMax'] = str_replace($replacebles, '', $profile->coat_max_price);
     $fields['shoePriceMin'] = str_replace($replacebles, '', $profile->shoes_min_price);
     $fields['shoePriceMax'] = str_replace($replacebles, '', $profile->shoes_max_price);
     $fields['additionalInfo'] = $profile->extra_price;
     // section 5 - delivery
     $fields['customerAddressLine1'] = $profile->delivery_add_1;
     $fields['customerAddressLine2'] = $profile->delivery_add_2 ? $profile->delivery_add_2 : '';
     $fields['customerTownCity'] = $profile->delivery_town;
     $fields['customerPostCode'] = $profile->delivery_post_code;
     $fields['customerAddressName'] = $profile->delivery_add_name ? $profile->delivery_add_name : '';
     $fields['alternativeAddressLine1'] = '';
     $fields['alternativeAddressLine2'] = '';
     $fields['alternativeTownCity'] = '';
     $fields['alternativePostCode'] = '';
     $fields['alternativeAddressName'] = '';
     $fields['billingAddressSameAsCustomerAddress'] = '';
     $fields['billingAddressLine1'] = $profile->bill_add_1;
     $fields['billingAddressLine2'] = $profile->bill_add_2 ? $profile->bill_add_2 : '';
     $fields['billingTownCity'] = $profile->bill_town;
     $fields['billingPostCode'] = $profile->bill_post_code;
     $fields['billingAddressName'] = $profile->bill_add_name ? $profile->bill_add_name : '';
     $fields['deliveryInstructions'] = $profile->extra_delivery ? $profile->extra_delivery : '';
     $fields['collectionNotes'] = $profile->extra_collection ? $profile->extra_collection : '';
     //drop off time
     $fields['pageNumber'] = $profile->stage;
     //drop off stage
     $fields['websiteRef'] = $profile->customer_id;
     //unique user
     //fields that we dont have
     $fields['contactMeAboutSizing'] = '';
     $fields['commentsToStylist'] = '';
     $fields['termsAndConditionsChecked'] = '';
     $fields['promotionalCode'] = '';
     $fields['giftCardNumber'] = '';
     $fields['jacketTypeChoices'] = '';
     $fields['whereDoYouWhereYourJacketChoices'] = '';
     $fields['underwearStyleChoices'] = '';
     $fields['styleDislikeDescription'] = '';
     //fill all fields with something not null
     foreach ($fields as &$value) {
         if (empty($value)) {
             $value = '';
         }
     }
     //send it
     $ws_res = $ws->sendForm($fields);
     // if it does not say sagepay or its empty its wrong
     $patt = '/\\<title\\>Sage\\sPay/';
     preg_match($patt, $ws_res, $match);
     if (empty($match[0]) || empty($ws_res)) {
         $this->log_it("Something went wrong on the webservices.");
     } else {
         $this->log_it("Just sent {$profile->email}");
     }
     //mark it as sent in db
     //querying instead of using bespoke update method because that will update the modified field
     $this->wpdb->query("UPDATE {$this->table} SET salesforce = 1, ws_sent_date = now() WHERE profile_id = {$profile->profile_id}");
 }