我正在尝试将 wordpress CF7 与第三方 CRM 集成。我设法使用以下过滤器将数据发送到 CRM:
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”,甚至使用 CF7 的 3'rd 方集成插件(http://wordpress.org/plugins/contact-form- 7-3rd-party-integration/screenshots/)但不幸的是并没有取得太大的成功。
我将非常感谢您对此事的帮助。
这是示例 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>
谢谢