Robin Somes Posted September 16, 2015 Share Posted September 16, 2015 CC 6.06Appears to be a slight issue with subscription to the mailing list, which I'm keen to get sorted before I start annoying actual paying customers with it I've sent a couple of test newsletters, with the standard footer telling those who wish to unsubscribe to go to:http://www.piscesconservation.com/cube/index.php?_a=unsubscribeHowever, entering my regular email address - which is in the mailing list - only produces the message that "Email address already subscribed".Entering a variety of other addresses either produces "Email address already subscribed" (which it isn't), "Please enter a valid email address" (It IS a valid email address!), or an annoying state of pressing the button and nothing at all happening.Nowhere does an email address actually get unsubscribed.Any suggestions?TIA, Robin Quote Link to comment Share on other sites More sharing options...
bsmither Posted September 17, 2015 Share Posted September 17, 2015 In my opinion, there is an incredible amount of irrelevant, possibly misleading, work going on 'validating' this form. The evidence of this bad work is the smaller red block of text below the text entry field as opposed to CubeCart's red-ish banner at the top. We can try to remove it from being 'validated'.Other than that, from the Newsletter page... There are two ways to get an address into the Newsletter Subscribe/Unsubscribe process: in the form POST, or in the web address URL (GET).By POST:First, CubeCart will try to subscribe the email. If that fails for whatever reason, CubeCart then determines if the visitor is logged in.If logged in, and because subscribing had failed, then CubeCart says, "Please enter a valid email address." Which is very misleading because the major way subscribing fails is if the email address already exists. So, 'valid' probably means to want you to enter an address that doesn't already exist.If not logged in, and because subscribing had failed, then CubeCart tries to unsubscribe that address.By GET:This method requires a web address such as: [email protected]This is easy to program into the newsletter content.There is something not happening correctly. Still tracing it out. Cubecart's banner saying "You have been..." is missing and the resulting URL in the browser's address bar is wrong. My bad. Quote Link to comment Share on other sites More sharing options...
bsmither Posted September 17, 2015 Share Posted September 17, 2015 The Validator is blocking the form's submission because when having entered the email address of an email that exists, the ajax call received a false from CubeCart. What the validator does with this false, I cannot yet determine, but the form will not submit. Quote Link to comment Share on other sites More sharing options...
Robin Somes Posted September 21, 2015 Author Share Posted September 21, 2015 Many thanks. For now we'll go with our existing mailing arrangement outside of CubeCart. Looking forward to a fix as and when, because in the long term the newsletter facility in CC is superior.Robin Quote Link to comment Share on other sites More sharing options...
ayz1 Posted September 21, 2015 Share Posted September 21, 2015 Have you looked at Mailchimp? Quote Link to comment Share on other sites More sharing options...
Robin Somes Posted September 22, 2015 Author Share Posted September 22, 2015 We haven't, but thanks for the suggestion. For the moment, our existing arrangement works (and is free); in the long run it would be nice if mailing could be integrated into the shop via CC. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted September 22, 2015 Share Posted September 22, 2015 Unless you send large numbers of emails, MailChimp is free. But it does not integrate with CC as well as it did before the double opt-in started. I've tried to use MC code and integrate it with CC, and it works up to a point, but it takes the customer to a confirmation page off CC (with a link back to the store). Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted November 17, 2015 Share Posted November 17, 2015 I have a raised a request for the GET method to be fixed in Github (https://github.com/cubecart/v6/issues/913). Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted November 25, 2015 Share Posted November 25, 2015 This method requires a web address such as: [email protected]Does anybody know of a GET URL that works?I have tried the following, none of which appear to work:mywebsiteURL/Store/index.php?_a=newsletter&[email protected] mywebsiteURL/Store/index.php?_a=unsubscribe&emailmywebsiteURL/Store/[email protected]mywebsiteURL/Store/[email protected]mywebsiteURL/Store/index.php?_a=unsubscribe&[email protected]mywebsiteURL/Store/index.php?_a=newsletter&action=unsubscribe&[email protected] Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 25, 2015 Share Posted November 25, 2015 For the moment, try:mywebsiteURL/Store/index.php?_a=unsubscribe&[email protected] Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted December 1, 2015 Share Posted December 1, 2015 Well I tried Brian's example, using the CCV6.0.8 version of cubecart.class.php, and got the empty Newsletters/Subscription screen, as if I had enteredmywebsiteURL/Store/index.php?_a=unsubscribe without the additional GET variable. If I then enter the [email protected] email address into the form, I get the message "your email address has been added to our list", even though I was already a subscriber. If I look at the CubeCart_newsletter_subscriber table, I can see that the email address now has a new subscriber_id, as if it had unsubscribed and then subscribed again all in the same transaction! Most odd.I have also tried a code change as recommended by SemperFiWS in the Github issue that I raised. The only difference is that Semper's code issues an error message on the first screen, "The following errors were detected: Please enter a valid email address". If I then enter [email protected] as before, I get the same result as before. Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 1, 2015 Share Posted December 1, 2015 Several things are interfering. (I haven't looked at the Github comments yet.)This is what I did:In cubecart.class.php, near lines 2150-2151: if (isset($_GET['unsubscribe']) && filter_var($_GET['unsubscribe'], FILTER_VALIDATE_EMAIL)) { if ($newsletter->unsubscribe($_GET['unsubscribe'])) { Change to: if (isset($_GET['unsubscribe']) && filter_var($_GET['unsubscribe'], FILTER_SANITIZE_EMAIL, FILTER_VALIDATE_EMAIL)) { if ($newsletter->unsubscribe(filter_var($_GET['unsubscribe'], FILTER_SANITIZE_EMAIL))) { Then, the link URL to put in emails, etc, is:mywebsiteURL/Store/index.php?_a=unsubscribe&unsubscribe="[email protected]"Note the quotes around the address. This is necessary to prevent CubeCart's SEO class from misinterpreting the URL as an SEOable() URL.I have a few ideas on a better fix. I'll post them in the Github soon.Also be aware that CubeCart should show the "You have been unsubscribed" banner. But this will be confusing to the logged in customer in a certain scenario. If a customer is logged in, but manually enters the URL above, and the email address is not the customer's logged-in email address, CubeCart will still delete the address, show the banner, but then also show the "You are subscribed" message (if in fact the customer is) with an unsubscribe button. But this button is for the customer's logged-in email address. Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted December 3, 2015 Share Posted December 3, 2015 Excellent work Brian - I have tested the above on two test accounts, one accessing from a link within an e-mail, and one from tapping the URL into the browser address bar, and they both work successfully. Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted December 10, 2015 Share Posted December 10, 2015 For reference, since Brian's fix requires the use of quotation marks around the email address, if you create your unsubscribe link in a html form (in for example phpList), you will probably need to use the html entity " rather than just typing the quotes around the address. Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted December 12, 2015 Share Posted December 12, 2015 We still seem to have an intermittent problem with this whilst using phpList.We have testing this for the last few days, and find that occasionally the link from an email, when clicked, seems to lose the quotes around the email address.For example, the link mywebsiteURL/Store/index.php?_a=unsubscribe&unsubscribe="[email protected]" becomes mywebsiteURL/Store/index.php?_a=unsubscribe&[email protected]and what you see in the browser address bar is mywebsiteURL/Store/index.php?_a=unsubscribe&unsubscribe=abcI can't see any consistency in why it happens - my only thought is maybe it's session or cookie related as it has just been the three of us testing it.As a result we don't think we can use this just yet. I will have to watch out for Brian's other ideas. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.