I have previously made a module which would allow a user to sign up for newsletters and decide on which type of newsletters they would receive e.g. promotion, new lines etc. This module was my first one and only one so far.

It took no consideration of the magento database. Basically I created two tables one for the users names and one for the users preferences. customer_entity_varchar was not used as the user did not have to be a member of the site (so no password is needed) to receive a newsletter.

I would like to try and bring my module more into line with the Magento standard now so I have completed the Alan Storm tutorial, to see how the tables can be created in an EAV style and read this article to get a better understanding of how to extend it properly but i'm really confused as to what tables i should add and even if I should use the customer_entity_varchar table to enter a users name who is not a site member as one column requires a password.


  • allow users to sign up for newsletters without becoming a site member
  • allow users to decide on which newsletters they want to receive
  • allow admin to add new newsletter options on the frontend
  • allow admin to see what a user is wanting to receive

After downloading the database chart I can see newsletter_subscriber and customer_entity are linked. I have come up with thisdatabaseIdea

(the top two are current magento tables)

and would be interested in

  • advice on how to improve it
  • what considerations need to be taken into account when expanding the magento database?
  • can/should tables always follow the EAV structure when using Magento?

2 Answers 2


So I will add my thoughts here for you, but sorry if they are not a complete answer:

can/should tables always follow the EAV structure when using Magento?

Basically yes you can use EAV structure for this scenario, but no you should not always use EAV.

As with most things in Magento/general development/life there is a time and a place for it.

EAV has some situations that it is a real benifit but also has some situations that it frankly sucks. You need to decide based on your needs and see if EAV is a benefit, a hindrance or actually makes no difference at all. There are many good resources dicsussing this, a couple are:

  1. https://softwareengineering.stackexchange.com/q/93124
  2. http://www.dbforums.com/database-concepts-design/1619660-otlt-eav-design-why-do-people-hate.html

My favorite answer is:

In a nutshell, EAV is useful when your list of attributes is frequently growing, or when it's so large that most rows would be filled with mostly NULLs if you made every attribute a column. It becomes an anti-pattern when used outside of that context.

For your described scenario my opinion would be not to use EAV as it would complicate what should be a fairly simple table structure. Though saying that I do not think it would slow it down it just might make it harder to debug/read in 5 years time.


In order to achieve this, you dont need to go for any EAV type sturture. So these are my findings.

1. allow users to sign up for newsletters without becoming a site member

This is an in-built feature of magento. Yes Magento allow newsletter for guest. In order to activate it, you need to configure magento accordingly. You can do this through admin

 System  >  Configuration  > Customers   > Newsletter  >  Subscription Options

You can see an option Allow Guest Subscription there. Set it to yes. You are done.

2. For rest points

For other features, you really need to create a module for it. I suggest you following things in order to achieve it.

a) create a table that will store different types of newsletter

b) extend newsletter_subscriber table by adding a new column type and then save customer preffered types there. These types reference should be the unique id of newsletter type that you have set up via your module.

This way now you have full control over magento's default feature and make appropriate changes to default behaviour of magento by extending your module.

Good luck [This answer is a part of #mageStackDay. It is an event conducted by Magento Community members as part of increasing the question-answer ratio. For more information http://www.magestackday.com/]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.