2

I'm working on a customer database export, but can't find where the 'general subscription' newsletter subscription field is stored in the database. I imagine it is some EAV value, but in what table and with what attribute_id?

2

I figured it out. The table 'newsletter_subscriber' contains several fields, the ones most meaningful for my purpose are:

  • store_id
  • customer_id
    • the customer entity_id
  • subscriber_email
    • perhaps someone can subscribe with a different email than their customer email?
  • subscribe_status
    • 0 = Default ( can be seen in the table structure in database )
    • 1 = Subscribed
    • 2 = Not Active
    • 3 = Unsubscribed
    • 4 = Unconfirmed

Status 1 to 4 can be seen at /app/code/core/Mage/Newsletter/Model/Subscriber.php

Note: This is not a topical or 'typed' subscription, but a global opt-in newsletter field for a Magento customer record.

1

Just to clarify, there is no admin functionality that lets you add new subscription list in Magento out of the box. Thus there is no subscription type field stored anywhere.

If you check the app/design/frontend/base/default/template/customer/form/newsletter.phtml you can see that 'General Subscription' is only a label for the is_subscribed field:

<li class="control"><input type="checkbox" name="is_subscribed" id="subscription" value="1" title="<?php echo $this->__('General Subscription') ?>"<?php if($this->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="subscription"><?php echo $this->__('General Subscription') ?></label></li>

Then the controller only checks if is_subscribed is set to true and subscribes the customer to the newsletter if it is.

  • I don't think it is accurate that there is "no subscription type field stored anywhere." It is correct that the field isn't exposed on the admin side, but it is exposed to the customer so they can opt-in (or out) of newsletter communication. The field is populated in my implementation, and I know there weren't any special customization for newsletter subscription. The 'my account' template just has a 'newsletters' tab which only exposes the 'general subscription' field. – MarkE Mar 26 '16 at 20:12
  • @MarkE there is definitely no "subscription type" stored anywhere. What could look like a type is actually a yes no flag for the is_subscribed field it has nothing to do with a type of subscription – Raphael at Digital Pianism Mar 26 '16 at 20:25
  • Correct, no "subscription type" but there is a global opt-in field that is not a particular 'type' of subscription. That still has value to add people to a 3rd party permissions-based mailing service and send them an invite to select their subscription preferences. I will edit my answer to clarify. – MarkE Mar 26 '16 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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