Jump to content
Latest News: (loading..)
ecommunlimited

Mailchimp newsletter Everywhere add on

Recommended Posts

Sorry Loïc @@Gyakutsuki,
 
But I'm also almost giving up :-
 
The latest version 1.83 has errors which were already corrected in the modified files I sent you and has other errors.
 
The html styling messes up the footer and the module doesn't show the same like other footer modules.

<div class="clearfix"></div>
<div class="col-sm-<?php echo $content_width; ?>">
  <div class="footer_mailchimp">
    <div class="col-md-12"><h2><?php echo MODULE_FOOTER_MAILCHIMP_TEXT; ?></h2></div>
    <div class="col-md-12">

should be:

<div class="col-sm-<?php echo $content_width; ?>">
  <div class="footerbox mailchimp">
    <h2><?php echo MODULE_FOOTER_MAILCHIMP_TEXT; ?></h2>

The button coding is wrong again and throws error and the button is completely missing if the show name setting is enabled:

  if (!empty(MODULES_HEADER_TAGS_MAILCHIMP_LIST_CUSTOMERS) && (MODULE_FOOTER_MAILCHIMP_DISPLAY_NAME == 'True')) {
    echo tep_draw_input_field('lastname', NULL, 'class="form-control" required aria-required="true" required="" id="lname" placeholder="' . ENTRY_LAST_NAME . '"') . ' ';
    echo tep_draw_input_field('firstname', NULL, 'class="form-control" required aria-required="true" required="" id="fname" placeholder="' . ENTRY_FIRST_NAME . '"') . ' ';
    echo tep_draw_input_field('email', NULL, 'required  id="email" placeholder="' . ENTRY_EMAIL_ADDRESS . '"', 'email') . ' ';
  } elseif (!empty(MODULES_HEADER_TAGS_MAILCHIMP_LIST_ANONYMOUS)) {
    echo tep_draw_input_field('email', NULL, 'required aria-required="true" id="email" placeholder="' . ENTRY_EMAIL_ADDRESS . '"', 'email') . ' ';
    echo tep_draw_button(MODULE_FOOTER_MAILCHIMP_SUBMIT, null, null, null, ''id="SendButton", 'btn-success btn-xs') . tep_draw_hidden_field('anonymous', 'anonymous');
  }

should be:

    if (!empty(MODULES_HEADER_TAGS_MAILCHIMP_LIST_CUSTOMERS) && (MODULE_FOOTER_MAILCHIMP_DISPLAY_NAME == 'True')) {
      echo tep_draw_input_field('lastname', NULL, 'class="form-control" aria-required="true" id="lname" placeholder="' . ENTRY_LAST_NAME . '"') . ' ';
      echo tep_draw_input_field('firstname', NULL, 'class="form-control" aria-required="true" id="fname" placeholder="' . ENTRY_FIRST_NAME . '"') . ' ';
      echo tep_draw_input_field('email', NULL, 'aria-required="true"  id="email" placeholder="' . ENTRY_EMAIL_ADDRESS . '"', 'email') . ' ';
      echo tep_draw_button(MODULE_FOOTER_MAILCHIMP_SUBMIT, null, null, null, array('params' => 'id="SendButton"'), 'btn-success btn-xs') . tep_draw_hidden_field('anonymous', 'anonymous');
    } elseif (!empty(MODULES_HEADER_TAGS_MAILCHIMP_LIST_ANONYMOUS)) {
      echo tep_draw_input_field('email', NULL, 'aria-required="true" id="email" placeholder="' . ENTRY_EMAIL_ADDRESS . '"', 'email') . ' ';
      echo tep_draw_button(MODULE_FOOTER_MAILCHIMP_SUBMIT, null, null, null, array('params' => 'id="SendButton"'), 'btn-success btn-xs') . tep_draw_hidden_field('anonymous', 'anonymous');
    }

required is not needed and produces html validation error, it must be replaced by 'aria-required="true"', not added.

 

The message end tag is wrong: <span> instead of </span>

 

The endform tag is outputted twice.

This line must be removed in cm_footer_mailchimp.php:

      $data .= '</form>';

The message could be bootstrap formatted:

In ext/api/mailchimp_v3/mailchimp_v3.js:

$(document).ready(function() {
  $('#signup').submit(function() {
    $("#message").html("<br><div class=\"alert alert-info\" role=\"alert\">Adding your email address...</div>");
    $.ajax({
      url: 'ext/api/mailchimp_v3/subscribe.php', // proper url to your "store-address.php" file
      type: 'POST', // <- IMPORTANT
      data: $('#signup').serialize() + '&ajax=true',
      success: function(msg) {
        var message = $.parseJSON(msg),
            result = '';
        if (message.status === 'pending') { // success
          result = '<br><div class=\"alert alert-success\" role=\"alert\">Success!  Please click the confirmation link that will be emailed to you shortly.</div>';
        } else { // error
          result = '<br><div class=\"alert alert-danger\" role=\"alert\">Error: ' + message.detail + '</div>';
        }
        $('#message').html(result); // display the message
      }
    });
    return false;
  });
});

Did only check the first message output, I'm still testing locally.

 

I know that the styling issues may not be so important, but that the module throws just errors after 6 uploaded versions has no excuse in downgrading from 2.4.

I do not understand how you can publish an add-on without doing the most basic checks.

"Honi soit qui mal y pense"

 

Sorry and kind regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

Yes you have right.

I am too fast maybe too speed good lesson.

2.3 does nt work on my server and don t take for a manual installation. Code from scrash just by editor no good to see result and error.

It will be my last addon on 2.3

Sorry guy.



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

· Integrated the js into the header tag module for easier language localization.
· Changed hardcoded messages to language constants
· Added language definitions for messages
· Added spanish and German translations
· Moved “firstname” before “last name” following osc standards

 

Tk raiwa to your sugestions.



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

@@Gyakutsuki

 

I works almost perfect. Now you're cooking with fire. Great come back sir. Only one change needed to be made in public_html/includes/modules/content/footer/templates/footer_mailchimp.php.

 

Change this:

 

echo tep_draw_button(MODULE_FOOTER_MAILCHIMP_SUBMIT, null, null, null, array('params' => 'id="SendButton"'), 'btn-success btn-sm') . tep_draw_hidden_field('anonymous', 'anonymous');
 

To this, just above the } elseif.

 

echo tep_draw_button(MODULE_FOOTER_MAILCHIMP_SUBMIT, null, null, null, array('params' => 'id="SendButton"'), 'btn-success btn-sm');

 

If not, all subscribers are anonymous. With the change, the names show at Mailchimp.

 

Take care

Bill

Share this post


Link to post
Share on other sites

@@raiwa @@Gyakutsuki

 

You two gentlemen put your heads together and made a very useful mod. I appreciate both of you very much! One question though. Can it be made to clear the fields or refresh the page after a person clicks the subscribe button? The way it is now, even though it works, the name and email address stay in the fields even after you click the button and the info goes to Mailchimp.

 

Take care

Bill

Share this post


Link to post
Share on other sites

The system use an ajax and you will have a message after clic on the button. No page refresh with this integration.



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

@@Gyakutsuki

 

I seen the message. Although it seems that if it does not remove the name and especially the email once clicked, that it could be considered a privacy or security issue. Anyone that sat down on the computer after that person (if that person did not go to another page first) can see their email address. Things like email addresses are kept private by most people. They might share it with some but not all. You see what I'm getting at?

Share this post


Link to post
Share on other sites

if there is an ajax specialist  on the forum it can answer you.

But I think there is a specific pb.

The message appear only when you click on the button and diseappear after the page is refresh.

Also if you click too many time with the email address, mailchimp block the email.

Don't use the debug tool in production because it's possible to see all your informations mailchimp.

Edited by Gyakutsuki


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

@@Gyakutsuki, @@ecommunlimited,

 

Workaround to improve the messages:

NOTE: The success message is not a real feedback from mailchimp. No error will be reported neither.

But it looks at least much better for the client

 

- input fields are cleared on submit

- first the old "Adding..." message is shown

- on submit finish "success..." message is shown

- dismiss button added to success message

 

just update the ht module:

ht_mailchimp.php

 

I'll continue researching when I have a time to see if I can get the real feedback data to display.

 

rgds

Rainer

Share this post


Link to post
Share on other sites

@@ecommunlimited,

 

finally I recovered part of the old version 1.6 script which neither used the response data for the messages:

<script>
$(document).ready(function() {
  $(\'#signup\').submit(function() {
    $("#message").html("<div class=\"alert alert-info\" style=\"padding:05px; margin-top:5px;\" role=\"alert\">' . MODULES_HEADER_TAGS_MAILCHIMP_SUBMIT_MESSAGE . '</div>");
    $.ajax({
      url: \'ext/api/mailchimp_v3/subscribe.php\', // proper url to your "store-address.php" file
      type: \'POST\', // <- IMPORTANT
      data: $(\'#signup\').serialize() + \'&ajax=true\',
      success: function(msg) {
        $(\'#fname\').val(""); // reset input field
        $(\'#lname\').val(""); // reset input field
        $(\'#email\').val(""); // reset input field
        $(\'#message\').html(\'<div class=\"alert alert-success alert-dismissible\" role=\"alert\"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' . MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE . '</div>\'); // display the message
      }
    });
    return false;
  });
});
</script>';

@@Gyakutsuki,

 

seems the line:

        var message = $.parseJSON(msg),

breaks the script, the message is not displayed any more.

Even not sure if the coma at the end is correct, but changing to semicolon doesn't help.

 

I give up at this point, ajax is not my piece of cake.

 

rgds

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

 I am looking also, the status is always at 200 same if there is an error, must be 400.



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

@@raiwa

 

@@ecommunlimited,

 

finally I recovered part of the old version 1.6 script which neither used the response data for the messages:

<script>
$(document).ready(function() {
  $(\'#signup\').submit(function() {
    $("#message").html("<div class=\"alert alert-info\" style=\"padding:05px; margin-top:5px;\" role=\"alert\">' . MODULES_HEADER_TAGS_MAILCHIMP_SUBMIT_MESSAGE . '</div>");
    $.ajax({
      url: \'ext/api/mailchimp_v3/subscribe.php\', // proper url to your "store-address.php" file
      type: \'POST\', // <- IMPORTANT
      data: $(\'#signup\').serialize() + \'&ajax=true\',
      success: function(msg) {
        $(\'#fname\').val(""); // reset input field
        $(\'#lname\').val(""); // reset input field
        $(\'#email\').val(""); // reset input field
        $(\'#message\').html(\'<div class=\"alert alert-success alert-dismissible\" role=\"alert\"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' . MODULES_HEADER_TAGS_MAILCHIMP_SUCCESS_MESSAGE . '</div>\'); // display the message
      }
    });
    return false;
  });
});
</script>';

 

This works great for me It shows the success message for a split second and then clears the fields as it should. And the info shows up at Mailchimp as well

 

Well done Rainer!!! Thank you and take care sir.

 

Bill

Share this post


Link to post
Share on other sites

New version 2.0 uploaded:

Version 2.0 by Loïc Richard @@Gyakutsuki & Rainer Schmied @raiwa

You have 2 packages :
One for Developper, lite called MailchimpEverywhereDevelopper_20
One for OSC BS2.3.4, called MailchimpEverywhereFor23BS_2.0

Note :
The pack for 2.3.4 is designed for Oscommerce BS 2.3.4 and has some add on. The developper pack does'nt has these elements.

Changes for developper version:
- response messages fixed and localized
- added links to Privacy Page (footer module)

Changes for MailchimpEverywhereFor23BS_2.0:
- response messages fixed and localized
- modal header module added, will open:

1. By “Newsletter Subscribe” link from a navbar module

2. Automatically optional if:

a. Category is viewed for first time
b. Product page is viewed for first time
c. Configurable page count

- Added installation checks to all modules
- added links to Privacy Page (footer module)
- added colapsible with privacy text (header modal module)

 

rgds

Rainer

Share this post


Link to post
Share on other sites

@@crimble crumble,

 

This version:

Mailchimp Newsletter 2.02

and inside:

MailchimpEverywhereFor23BS_2.0

should work.

 

I didn't try yet the 2 latest versions.

 

rgds

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

I tested the latest and 2.02; it seems does'nt work for me.

Also, I noted a difference if the site is in SSL or Not. SSL certificate seems important to send the information

 

What is you consol resonse ?

looking

the  consol response  than I have :

type"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/"
title"Invalid Resource"
status 400
detail"The resource submitted could not be validated. For field-specific details, see the 'errors' array."
instance""
errors
[2]0
Object
field""message"Required fields were not provided: email_address"
1Object
field"email_address"
message"Schema describes string, NULL found instead"

{"type":"http:\/\/developer.mailchimp.com\/documentation\/mailchimp\/guides\/error-glossary\/","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.","instance":"","errors":[{"field":"","message":"Required fields were not provided: email_address"},{"field":"email_address","message":"Schema describes string, NULL found instead"}]}


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

I uploaded a new version

Api updated included a timeout and subscribe.php

I tested and works for me.

http://addons.oscommerce.com/info/9289

 

Could you test also on your website.

Thank you.



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

hi,

I installed the latest version of this addon on BS Edge and have not tested it just yet. Before I do, I have a question regarding the Anonymous List number and Customer List number by Mailchimp,.. from the installation document. I found the Unique ID number for the list I created, but other than that and the API number there seems to be no other list number.

I googled for it and search the mailchimp site for it but cannot find it. I used that unique ID number for both fields (Anonymous List number and Customer List number) in the osC admin panel, however, I am not sure if that is the right way to do this. Any help would be greatly appreciated. Thanks.

 

Share this post


Link to post
Share on other sites

Hello Demitry @Demitry,

If you have only one unique list in Mailchimp, use the same ID in both fields.

The second field is for the case you have 2 lists defined in mailchimp with different treatment, one for registered customers and another for guests(anonymous).

Share this post


Link to post
Share on other sites

hi Rainer, @raiwa

Thank you for the reply and the explanation. That makes sense, but how does the system determine what list to add the opt-in email to? Is there a script that identifies a registered customer vs. an unregistered customer and adds them to the right list?

Also, I found some errors via Dreamweaver. I'm not sure if these affect the performance of the addon, as I have not tested it yet.

For the BS version:

in /ext/api/mailchimp_v3/MailChimp.php line 88 (see attached screenshot)

in /ext/api/mailchimp_v3/subscribe.php lines 21-24, 29-32, 35-39 (see attached screenshot)

In that subscribe.php file, I assume all three of these are supposed to be arrays with different style brackets?

 

mailchimp-error-screenshot-1.png

mailchimp-error-screenshot-2.png

Share this post


Link to post
Share on other sites
7 hours ago, Demitry said:

Thank you for the reply and the explanation. That makes sense, but how does the system determine what list to add the opt-in email to? Is there a script that identifies a registered customer vs. an unregistered customer and adds them to the right list?

Helly Demitry @Demitry,

It's so long that I colaborated in the development, that I made a mess. Sorry, the anonymous option just means that the suscriber doesn't need to fill in Name, only mail address.

The last version I uploaded and I'm still using and is error free is Mailchimp Newsletter 2.02

I never used Dreamwaver for coding, so I can't say if the errors reported there are serious or not.

For the newer versions please address to @Gyakutsuki

Kind regards

Rainer

Share this post


Link to post
Share on other sites

@Demitry @raiwa

Hello,

Since the 2.02 just the Api has been updated. Nothing has changed in the integration and function.
Demitry, it's better for you to change your code editor, I recommend you Phpstorm or code.visualstudio.com if you want something very good. Dreamweaver is old age now.

Yesterday, I just updated the api.

?: is an operator



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

@raiwa@Gyakutsuki

Rainer:  thank you for following-up to clarify that,.. though I’m not sure why there needs to be two input-fields for the same list number, but that’s really not an issue.

Loic:  thank you for the API update and the development SW recommendations. I’m not a developer by trade and got quite comfortable with Dreamweaver over the years.

I just downloaded the VS Code for Windows and will install and check it out. I was a bit surprised that it’s free. I always appreciate a good recommendation from an expert in the field.

Demitry

 

Share this post


Link to post
Share on other sites

@Demitry

You must install now the plugin, there is some interesting can help you in your learning. I don"t use VS Code, but it's built on that.

Take time to understand the tool.



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×