Subscribe without registration

Open to all! Ask other shopowners for help.
Post Reply
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Subscribe without registration

Post by LeeFoster »

I am working on a footer module that will allow users to subscribe to a news letter without actually registering an account.

What I'm wondering is what is the best way to handle storing the email address? Do I put it in the customers table or create a table of its own? If I put it in the user table how do I handle it when a customer decides to register?

Any feedback is welcome.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4561
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 413 times

Re: Subscribe without registration

Post by burt »

Make a module that asks for the following;
- name
- email address

On submit, place this info into a NEW db table.

Caveat: You might check the email address to see if a customer already exists, if so, simply update customers.customers_newsletter to 1.

Either way, existing customer set to 1 or new non-customer, messagestack to let them know they have been signed up to newsletter.

In the admin side newsletter functionality, the newsletter "send to" list is built.
Where/when this is built add in the extra subscribers from the new table.

--

On creation of an account, check to see if the customers email address matches any in the NEW db table, and if so...delete it from the NEW db table.

Caveat: You might also then update the customers.customers_newsletter to 1 (even if they selected "no newsletter" and advise them of this via a messagestack.

As you can probably tell, this is something I have already done, but it was a long time ago, probably pre phoenix.
I am not here to build for you.
I am here to build with you. Let's help each other.
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: Subscribe without registration

Post by LeeFoster »

burt wrote: Tue Jun 14, 2022 9:20 am Make a module that asks for the following;
- name
- email address

On submit, place this info into a NEW db table.

Caveat: You might check the email address to see if a customer already exists, if so, simply update customers.customers_newsletter to 1.

Either way, existing customer set to 1 or new non-customer, messagestack to let them know they have been signed up to newsletter.

In the admin side newsletter functionality, the newsletter "send to" list is built.
Where/when this is built add in the extra subscribers from the new table.

--

On creation of an account, check to see if the customers email address matches any in the NEW db table, and if so...delete it from the NEW db table.

Caveat: You might also then update the customers.customers_newsletter to 1 (even if they selected "no newsletter" and advise them of this via a messagestack.

As you can probably tell, this is something I have already done, but it was a long time ago, probably pre phoenix.
It's good to hear you've done it before, means I'm not an idiot for trying to do it.
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Subscribe without registration

Post by Kofod95 »

I actually have something similar as well, but haven't released it yet, as it's tied in with a lot of other stuff:
Can be seen here: https://friiskaffeogte.dk/ny/news.php

I created a customer with an empty password and newsletter = 1, which works, but obviously have some flaws. I plan on improving it and releasing it, but exams takes most of my time right now, and afterwards I have a 1.0.4.0-shop with 62 add-ons to update, so it will be a while before I can move this further.

This is what is in use in the link above:
newsletter_page_1_0_0.zip
Hopefully that will provide some inspiration for you!

//Daniel
You do not have the required permissions to view the files attached to this post.
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: Subscribe without registration

Post by LeeFoster »

Thanks to @burt's advice and @Kofod95 for sharing his work. I was quickly able to come up with the attached.

Users will need to create a table called subscriber with the columns id & email_address.

The module displays an text box for entering an email address and a submit button. It then checks if the email exists in customers, updating it if it does, adding it to the new table if it does not.

That's as far as I have gotten for now but thought I'd share this in case people want to use and improve it.
footer newsletter.rar
You do not have the required permissions to view the files attached to this post.
Omar_one
Senior Contributor
Posts: 679
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Has thanked: 100 times
Been thanked: 56 times

Re: Subscribe without registration

Post by Omar_one »

@LeeFoster Maybe it's too late for my comment ,
I used on our frozen version an old module called Mailchimp newsletter Everywhere that module allow you to implement a newsletter subscription in the footer via mailchimp for your anonymous customers.
it will not sort anything in the databases..
lecarlb
Contributor
Posts: 316
Joined: Mon Oct 26, 2020 5:26 pm
Phoenix Version:
Has thanked: 48 times
Been thanked: 9 times

Re: Subscribe without registration

Post by lecarlb »

@LeeFoster or anyone,

How to create subscriber table using SQL? And are any of the tep queries deprecated?

Thank you.
LeeFoster
Contributor
Posts: 263
Joined: Sun Feb 28, 2021 9:41 pm
Phoenix Version: v1.0.8.20
Has thanked: 1 time
Been thanked: 5 times

Re: Subscribe without registration

Post by LeeFoster »

lecarlb wrote: Sat Nov 04, 2023 9:19 am @LeeFoster or anyone,

How to create subscriber table using SQL? And are any of the tep queries deprecated?

Thank you.
The table is just the 2 columns ID and Email. Something like this should do the trick-

Code: Select all

CREATE TABLE `subscriber` (
  `id` int(11) NOT NULL,
  `email_address` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply