Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Shopify-mailchimp集成_Php_Shopify_Mailchimp - Fatal编程技术网

Php Shopify-mailchimp集成

Php Shopify-mailchimp集成,php,shopify,mailchimp,Php,Shopify,Mailchimp,在我开始之前,我发现:这似乎是我想要的,但这里有一个警告: 我的表格在Shopify上。这是一个应用程序,允许客户在产品上市时收到通知。我想有一个复选框,允许他们订阅我们的通讯以及。所以最终的结果是,它仍然会发布到应用程序中,但会将它们添加到我们的时事通讯数据库中 上述解决方案可以远程完成吗?i、 我把PHP文件放在我的主网站上,让ajax指向url?有没有更简单的方法 <script type="text/javascript"> $(document).ready(functio

在我开始之前,我发现:这似乎是我想要的,但这里有一个警告:

我的表格在Shopify上。这是一个应用程序,允许客户在产品上市时收到通知。我想有一个复选框,允许他们订阅我们的通讯以及。所以最终的结果是,它仍然会发布到应用程序中,但会将它们添加到我们的时事通讯数据库中

上述解决方案可以远程完成吗?i、 我把PHP文件放在我的主网站上,让ajax指向url?有没有更简单的方法

<script type="text/javascript">
$(document).ready(function() {
      var create_callback = function(data) {
        if (data.status == 'OK') {
        $.fancybox({
            'href': '#inline_message'
            });                                
          //alert(data.message);
        } else {
          //alert("Oops! An error occurred. Please check the email address you entered and try again.");
        $.fancybox({
            'href': '#inline_message'
        });                               
          $("#inline_message").html('<h3>Oops! Looks like an error occurred.</h3> <p>Please check the email address you entered and try again.</p>');
        }
      }
      $('#notify_button').click(function(event) {
        event.preventDefault();
        BISPopover.create($('#notify_email').val(), $('#product-select :selected').val()).then(create_callback);
      });
    $('#BIS_form_submit').submit(function() {
        var isChecked = $('#chkSelect').is(':checked');
        if(isChecked){
            $.ajax({
                url: 'http://www.myURL.com/inc/store-address.php', // proper url to your "store-address.php" file
                data: $('#BIS_form_submit').serialize(),
                success: function(msg) {
                    $('#message').html(msg);
                }
            });
            return false;
        }
    });                       
});      
</script>

 <div id="BIS_form">
    <form id="BIS_form_submit">
    <input type="hidden" name="ajax" value="true" />
    <h3 id="notify-title">Notify me when this is back in stock:</h3>
    <input type="email" id="notify_email" value="Email address" onfocus="value=''"/>
    <button id="notify_button" class="first">Submit</button>
    <input type="checkbox" id="chkSelect" /><span style="font-size:10px;position:relative;top:3px;left:3px;">Add me to the Newsletter</span>
    </form>
</div> 

我认为您无法远程使用MailChimp API:即从客户端的浏览器。 -看


我认为notify_按钮的click事件处理程序需要将数据AJAX到服务器上的处理程序中。这个处理程序将与MailChimp API交互,将客户的电子邮件地址添加到新闻稿中。

我希望回答我自己的问题的形式不错,但我已经成功了。我知道这是一个边缘案件,但也许有人会发现它有帮助

代码:

它在控制台中抛出一个错误,但仍然有效。这可能是因为源服务器位于不同的服务器上。我愿意接受关于如何改进这一点的建议。您可以在此处看到它的功能。您可能需要四处寻找缺货的变体:


我想我的印象是store-address.php就是这么做的。
<script type="text/javascript">
    $(document).ready(function() {
        var create_callback = function(data) {
            if (data.status == 'OK') {
                $.fancybox({'href': '#inline_message'});                                
            } else {
                $.fancybox({'href': '#inline_message'});                               
                $("#inline_message").html('<h3>Oops! Looks like an error occurred.</h3> <p>Please check the email address you entered and try again.</p>');
            }                       
        }

        $('#notify_button').click(function(event) {
        event.preventDefault();
        BISPopover.create($('#mce-EMAIL').val(), $('#product-select :selected').val()).then(function(data) {
            var BISData = data; // keep a reference to the response from the app
            var isChecked = $('#chkSelect').is(':checked');
                if(isChecked) {
                    url = 'http://YourListURL';
                    EMAIL = $("#mc_form input[name=EMAIL]").val();
                    $.ajax({
                      type: "POST",
                      url: url,
                      data: {EMAIL : EMAIL},
                      dataType: 'json',
                      complete: function(){
                        create_callback(BISData);
            if (BISData.status == 'OK') {
                $.fancybox({'href': '#inline_message'});                                
            } else {
                $.fancybox({'href': '#inline_message'});                               
                $("#inline_message").html('<h3>Oops! Looks like an error occurred.</h3> <p>Please check the email address you entered and try again.</p>');
            }                                       
                      }
                    });                                 
                }
                else {
                    create_callback(BISData);
                }
        });
        });

    });                 
</script>                   
<div id="BIS_form">
    <form id="mc_form">
    <h3 id="notify-title">Notify me when this is back in stock:</h3>
    <input type="email" id="mce-EMAIL" name="EMAIL" value="Email address" onfocus="value=''"/>
    <button id="notify_button" class="first">Submit</button>
     <input type="checkbox" id="chkSelect" /><span>Add me to the Newsletter</span>
    </form>
</div>