Jump to content


Photo

data not displayed in Web Lead


  • Please log in to reply
No replies to this topic

#1 Member

Member

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 03 May 2017 - 07:00 AM

Hi All,

 

I'm a New to this X2CRM.

 

i have a wordpress and X2CRM installed in one Instance. i want to post the data in X2CRM whenever a customer submit a contact us form from WP.

 

For Reference i used : http://wiki.x2crm.co...acker_Front_End

 

Below are works i done so far.

 

1)  i had created a sample template (First name,Last Name,phone,background info). then i took the embedded script and applied in a new page called testing in WP. it was successful.

 

2) As per the legacy guide, in order to capture the lead form i had created contactform.php and modified the script as per our Instances. PFA

  i have placed APIModel.php file in the same location.

 

3) when i try to submit the form in WP(contact us) i'm getting a message saying "Message received". when i login to X2CRM back end i could see a test.txt file holding the values which got posted from WP.

 

After that when i check the database/X2CRM application i couldn't find that record. is there anything i missed?

 

any additional steps i need to perform? Help here would be really appreciated!

 

Thanks in advance,

 

***************************************************************************************

This is the script file

 

<?php
require 'APIModel.php';
 
$attributes = $_POST;
$contact = new APIModel('admin','API KEY given','https://mydomain/dummy1/index.php');
 
$fieldMap = array( // This map should be of the format 'your_fieldname'=>'x2_fieldname',
    'first_name'=>'firstName',
    'last_name'=>'lastName',
    'mobile'=>'phone2',
    'information'=>'backgroundInfo',
);
#$contact->attributes = $attributes;
foreach($attributes as $key=>$value){
   if(isset($fieldMap[$key])){
        $contact->{$fieldMap[$key]}=$value; // Found in field map, used mapped attribute
    }else{
        $contact->$key=$value; // No match anywhere, assume it's a Contact attribute
    }
}
file_put_contents('test.txt', json_encode($_REQUEST) );
if(isset($_POST['x2_key'])){
    $contact->trackingKey=$_POST['x2_key'];
 
}
$contact->actionCreate();
// Call API to create contact
Header('Location: https://mydomain/wp-admin');// Redirect to homepage
 
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users