2013-09-29 35 views
0

我正在嘗試將wordpress CF7與第三方CRM整合。 我設法使用下面的過濾器將數據發送到CRM:Wordpress聯繫表格7和第三​​方整合

add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url'); 
function wpcf7_custom_form_action_url() 
{ 
    return 'https://www.myapps-systems.com/api/WebToLeed.asp'; 
} 

基本上我所做的是改變「形式行動」從常規CF7到WebtoLead行動。 我也映射具有以下屬性的CF7形式(從CRM樣品形式服用):

[hidden mbp1 "222626"] 
[hidden URLToReturn "http://thankyoupage.com/thankyou"] 
[hidden Companies_Account_Status_Code "546"] 
[hidden Companies_Company id:Companies_Company "Website Enquiry"] 
<div> 
[text* Contacts_Contact id:Contacts_Contact class:name]<label>name*:</label> 
[tel* Companies_PhoneNumber id:Companies_PhoneNumber class:telelabelhone] 
<label>phone*: </label> 
[email Companies_Email id:Companies_Email class:email]<label> mail:‬</label> 

[textarea Companies_Note 50x8 id:Companies_Note]<label>message:</label> 
</div> 
[submit onclick="return OnButton1(); id:send_contact class:submit] 

所以這沒有工作對我來說,我設法收到關於CRM的數據,但我需要的數據也可以存儲在wordpress數據庫中,我希望它既可以發送到CRM,也可以保持正常的wordpress功能。而且,我不能使用1種形式的2個「動作」,我必須使用一些不同的方式。

我試着使用一些方法,如使用「wpcf7_before_send_mail」鉤或「wpcf7_after_send_mail」,甚至使用3'rd第三方集成插件CF7(http://wordpress.org/plugins/contact-form-7-3rd-party-integration/screenshots/) ,但不幸的是與OT大的成功來實現這一點。

我將不勝感激您對此事的幫助。

這裏是樣本CRM集成

<!-- 
URL is in action attribute. 
For all inputs the name attribute is used by the back-end system so don't change them 
--> 
<form id="big_contact_form" name="Web2LeedForm" action="https://www.myapps-systems.com/api/WebToLeed.asp" method="POST" onsubmit="return submitForm();"> 

    <input type="hidden" name="mbp1" value="222626"/> 
    <input type="hidden" name="URLToReturn" value="http://test.co.il/contact/thankyou"/> 
    <input type="hidden" name="Companies_Account_Status_Code" value="546" /> <!-- must be exactly this name and value --> 
    <input type="hidden" id="Companies_Company" name="Companies_Company" value="website enquiry"/> <!-- the Companies_Company field is mandatory, we don't use it so we just fill it with a value --> 
    <table> 

     <tr> 
      <td>*</td> 
      <th class="form_label"><label for="Contacts_Contact">name: </label></th> 
      <td><input class="input" type="text" id="Contacts_Contact" name="Contacts_Contact"/></td> 
     </tr>       
     <tr> 
      <td>*</td> 
      <th class="form_label"><label for="Companies_PhoneNumber">phone: </label></th> 
      <td><input class="input" type="text" id="Companies_PhoneNumber" name="Companies_PhoneNumber"/></td>         
     </tr>                
     <tr> 
      <td></td> 
      <th class="form_label"><label for="Companies_Email">mail: </label></th> 
      <td><input class="input" type="text" id="Companies_Email" name="Companies_Email"/></td>         
     </tr>        
     <tr> 
      <td></td> 
      <th class="form_label"><label for="Companies_Note">message:</label></th> 
      <td><textarea id="Companies_Note" name="Companies_Note" rows="8" cols="50"></textarea></td>         
     </tr>        

     <tr> 
      <td></td> 
      <td><input id="send_contact" name="submit" type="submit" value="שלח" /></td>      
     </tr>        

    </table> 
</form>   

謝謝

+1

也許你應該使用過濾器「wpcf7_posted_data」,並通過'CURL'將數據發佈到你的CRM。你可以在這裏得到一個CURL例子:http://stackoverflow.com/questions/3080146/post-data-to-url-php – Peter

回答