Jump to content
sembrouille

Newsletters Subscribers Manager - Oscommerce 2.3 & 2.2

Recommended Posts

@frankl It was just an available field that I didn't otherwise use...what is posted to it is the customers first order date. I don't collect birth dates...I probably should have renamed it but was just too lazy.

Dan

Share this post


Link to post
Share on other sites

how about spelling out the where clause with numerics without the year and adding the specific year end and year begin as extra where or where statements besides the typical date ranage ? (%c and %d) not using any year reference in the where clause.

Sorry, I'm still pretty busy, might have some time tonight ...


KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Share this post


Link to post
Share on other sites
UNIX_TIMESTAMP(date(o.customers_dob))

I forgot to use direct calculations and start to use UNIX time format by this reason.

Here is a zero equal example code snipet with modulus calculation:

where MOD(UNIX_TIMESTAMP(CURDATE())-UNIX_TIMESTAMP(date(c.customers_dob)), " . (int)SETTING_DAYS*86400 . ") = 0

It could be very effective. For example: define('SETTING_DAYS', 365);

I use daily mail cron jobs for similar projects.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites
15 hours ago, bruyndoncx said:

Sorry, I'm still pretty busy, might have some time tonight ...

@bruyndoncx Thanks Carine...I'm in no hurry.   I think, as it is currently written, I have a whole year before I see the issue again. :biggrin:  I must say I'm curious about it though, since I tried a bunch of different options without success, so it's one of those things that bugs me.:sad:  

Dan

Share this post


Link to post
Share on other sites
8 hours ago, tgely said:

I forgot to use direct calculations and start to use UNIX time format by this reason.

@tgely Gergely that thought went through my head when I was messing around with this but I was starting to get a headache by that time and wondered if I was over thinking things.  :wacko:  When I get a bit more time I'll play around with the UNIX time format to see what I can come up with.....assuming that Carine doesn't pull some simple MySQL routine out of her bag of tricks.   It really shouldn't be this complicated.  Thanks for the input.

9 hours ago, tgely said:

I use daily mail cron jobs for similar projects.

This is exactly what I have in mind.  I want to come up with a variety of emails that can be sent automatically day in and day out.  Building or finding a useful fake cron job that can handle your HTML emails is on my list to do.  

Dan

 

Share this post


Link to post
Share on other sites

I spent a little more time looking at the query I posted above, probably way more time than I should have but what can I say I'm both curious and stubborn.  

To make a long story short I shorten the query to isolate the problem.  The short version goes like this.

SELECT `customers_dob` FROM `customers`
WHERE
concat(year(now()), '', date_format(customers_dob,'%m%d')) < date_format(DATE_ADD(now(), INTERVAL 7 DAY),'%Y%m%d') AND
concat(year(now()), '', date_format(customers_dob,'%m%d')) > date_format(SUBDATE(now(), INTERVAL 17 DAY),'%Y%m%d') AND
customers_dob != '0000-00-00 00:00:00'

This runs just fine but still falls to pick up any records prior to year end.  To see what data I was getting I copied the where conditions to the select portion of the query so I could see what output was generated each step of the way.  Here is what that query looks like.

SELECT `customers_dob`,
concat(year(now()), '', date_format(customers_dob,'%m%d')) AS FIRST_AHEAD,
date_format(DATE_ADD(now(), INTERVAL 7 DAY),'%Y%m%d') AS SECOND_AHEAD,
concat(year(now()), '', date_format(customers_dob,'%m%d')) AS FIRST_BEHIND, date_format(SUBDATE(now(), INTERVAL 17 DAY),'%Y%m%d') AS SECOND_BEHIND
FROM `customers`
WHERE
concat(year(now()), '', date_format(customers_dob,'%m%d')) < date_format(DATE_ADD(now(), INTERVAL 7 DAY),'%Y%m%d') AND
concat(year(now()), '', date_format(customers_dob,'%m%d')) > date_format(SUBDATE(now(), INTERVAL 17 DAY),'%Y%m%d') AND
customers_dob != '0000-00-00 00:00:00'

 This products the following output.


+ Options
customers_dob 	FIRST_AHEAD 	SECOND_AHEAD 	FIRST_BEHIND 	SECOND_BEHIND 	
2009-01-06 00:00:00 	20180106 	20180118 	20180106 	20171225
2010-01-04 00:00:00 	20180104 	20180118 	20180104 	20171225
2006-01-12 00:00:00 	20180112 	20180118 	20180112 	20171225
2009-01-03 00:00:00 	20180103 	20180118 	20180103 	20171225
2008-01-05 00:00:00 	20180105 	20180118 	20180105 	20171225
2008-01-09 00:00:00 	20180109 	20180118 	20180109 	20171225
2008-01-11 00:00:00 	20180111 	20180118 	20180111 	20171225
2002-01-01 00:00:00 	20180101 	20180118 	20180101 	20171225
1999-01-15 00:00:00 	20180115 	20180118 	20180115 	20171225
2006-01-12 00:00:00 	20180112 	20180118 	20180112 	20171225
2005-01-01 00:00:00 	20180101 	20180118 	20180101 	20171225
2006-01-03 00:00:00 	20180103 	20180118 	20180103 	20171225
2013-01-07 00:00:00 	20180107 	20180118 	20180107 	20171225
2002-01-06 00:00:00 	20180106 	20180118 	20180106 	20171225
2008-01-16 00:00:00 	20180116 	20180118 	20180116 	20171225

 It still doesn't catch any records in the previous year.   Can anyone see what it is that I'm doing wrong or have any suggestion on how I can test this further to determine what the issue is?

At this point this is not terribly important to me but I'm very curious as to why it doesn't work.

Dan - The Stubborn one!

PS: There are indeed records that the query should select.

 

Edited by Dan Cole

Share this post


Link to post
Share on other sites

Hi there.

I'm using this addon in a couple of stores and it seemed to be working fine. Very easy and simple, that's why I picked this one:
https://apps.oscommerce.com/UQxeo&amp;newletters-subscribers-manager

But recently these stores have been receiving a huge volume of subscription that is clearly spam! Dozens a day every single day, which is not normal for stores that don't have that amount of traffic!

I'm not a programmer, so I don't know how to adapt the code to maybe insert a captcha or something like that to prevent spam.

Can anybody help me find a solution for this problem? TIA! :)


Patty

Share this post


Link to post
Share on other sites

In catalog/create_account.php

 

find :

if ($error == false) {

 

replace :

if ($error == false) {

 

// addon subscribe newsletter by brouillard s'embrouille

$sql_subscribe_newsletter = array('abonnement_addresse_email' => $email_address,

'abonnement_date_creation' => 'now()',

'abonnement_newsletter' => $newsletter);

 

tep_db_perform(TABLE_CUSTOMERS, $sql_subscribe_newsletter);

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

×