Shopify自定义电子邮件模块

时间:2016-05-25 08:45:53

标签: email shopify

如何从Shopify表单传递可变数据(我为一个页面制作了模板,其中有一个表格,要求客户选择一个产品,并将名称,电子邮件,地址等)作为电子邮件发送?是否有可能将数据传递给某些第三方应用程序,如Mailchimp,第三方应用程序将通过电子邮件将其发送给包含数据的客户?

为了简短起见,我的问题是: 如何创建自定义表单然后在电子邮件中传递数据以发送给客户?

1 个答案:

答案 0 :(得分:1)

我使用customized ajaxchimp jquery插件将shopify联系表单与mailchimp集成。

{% form 'contact' %} {% comment %} Successful message {% endcomment %} {% if form.posted_successfully? %}
<p class="note form-success">
  {{ 'contact.form.post_success' | t }}
</p>
{% endif %} {{ form.errors | default_errors }}

<div class="grid grid--small">
  <div class="grid__item large--one-half">
    <label for="ContactFormName" class="hidden-label">{{ 'contact.form.name' | t }}</label>
    <input type="text" id="ContactFormName" class="input-full" name="contact[name]" placeholder="{{ 'contact.form.name' | t }}" autocapitalize="words" value="{% if form.name %}{{ form.name }}{% elsif customer %}{{ customer.name }}{% endif %}">
  </div>

  <div class="grid__item large--one-half">
    <label for="ContactFormEmail" class="hidden-label">{{ 'contact.form.email' | t }}</label>
    <input type="email" id="ContactFormEmail" class="input-full" name="contact[email]" placeholder="{{ 'contact.form.email' | t }}" autocorrect="off" autocapitalize="off" value="{% if form.email %}{{ form.email }}{% elsif customer %}{{ customer.email }}{% endif %}">
    <input type="hidden" id="ContactFormHidden" name="contact[email]" value="{% if form.email %}{{ form.email }}{% elsif customer %}{{ customer.email }}{% endif %}">
  </div>
</div>

<label for="ContactFormPhone" class="hidden-label">{{ 'contact.form.phone' | t }}</label>
<input type="tel" id="ContactFormPhone" class="input-full" name="contact[phone]" placeholder="{{ 'contact.form.phone' | t }}" pattern="[0-9\-]*" value="{% if form.phone %}{{ form.phone }}{% elsif customer %}{{ customer.phone }}{% endif %}">

<label for="ContactFormMessage" class="hidden-label">{{ 'contact.form.message' | t }}</label>
<textarea rows="10" id="ContactFormMessage" class="input-full" name="contact[body]" placeholder="{{ 'contact.form.message' | t }}">{% if form.body %}{{ form.body }}{% endif %}</textarea>

<input type="submit" class="btn right" value="{{ 'contact.form.send' | t }}">
<label for="mc-email"></label>
{% endform %} 

{{ 'mailchimp.js' | asset_url | script_tag }}

<script>
  $('#ContactFormEmail').change(function() {
    var email = $(this).val();
    $('#ContactFormHidden').val(email);
  });
</script>

<script>
  $('#contact_form').ajaxChimp({
    url: 'https://cyberite.us4.list-manage.com/subscribe/post?u=858232f1e77dc411cb2405b5f&id=502f26188f',
  });
</script>