1

I am trying to add my Newsletter Subscribers' First Name into the newsletter template in order to personalise it. (By default Magento doesn't have space for a subscriber to insert his/her name, in the front end but I installed an extension that adds this functionality, so I have all the subscribers' firt and last names in the back-end at Newsletter->Newsletter Subscribers)

The newsletter's subscriber info definitely works separately from the registered users side of Magento and the keywords used for customer first name in transactional emails don't work for adding a subscriber's first name into the newsletter.

Does anyone know the keyword I need to use for this?

  • is it magento default newsletter html template ? is it use magento default newsletter model? – Amit Bera Sep 25 '14 at 15:23
  • Yes it is the default newsletter model, default magento newsletter template – user14427 Sep 25 '14 at 18:34
3

Try {{var subscriber.customer_firstname}}

Take a look at

/app/code/core/Mage/Newsletter/Model/Queue.php

/**
 * Send messages to subscribers for this queue
 *
 * @param   int     $count
 * @param   array   $additionalVariables
 * @return Mage_Newsletter_Model_Queue
 */
public function sendPerSubscriber($count=20, array $additionalVariables=array())
{
    ....

    $collection = $this->getSubscribersCollection()
        ->useOnlyUnsent()
        ->showCustomerInfo()
        ->setPageSize($count)
        ->setCurPage(1)
        ->load();

    ....

    foreach($collection->getItems() as $item) {
        $email = $item->getSubscriberEmail();
        $name = $item->getSubscriberFullName();

        $sender->emulateDesign($item->getStoreId());
        $successSend = $sender->send($email, $name, array('subscriber' => $item));

Then take a look at /app/code/core/Mage/Newsletter/Model/Resource/Subscriber/Collection.php

  • Great, halfway there! – user14427 Sep 25 '14 at 19:33
  • I used {{var subscriber.customer_firstname}} like you suggested, now 2 of the 4 the test subscribers have their own names appear in the greeting. I have 4 test subscribers of which 2 are also registered customers. The names of these 2 are now pulled into the newsletter. The other 2 which are guests (not registered customers), but also registered for the newsletter are receiving the newsletter, but their name doesn't appear in the greeting. I tried adding {{var subscriber.guest_firstname}} just as a test, but no luck. Not sure if I should edit anything in Collection.php and Queue.php – user14427 Sep 25 '14 at 19:49
  • When you sign up for a news letter what fields are required? I dont think guess customer will have name. You can try {{if subscriber.customer_firstname}} Dear {{subscriber.customer_firstname}} {{else}} Dear Valid Customer{{/if}} – Renon Stewart Sep 25 '14 at 21:25
  • I have installed an extension that changes the sign up box so that they enter email, firstname, lastname, salutation. This means I have the firstname even of guest subscriber. However, guest subscriber's name doesn't show up in newsletter...only the customer subscriber. – user14427 Sep 26 '14 at 8:32
  • 1
    Solved: The working keyword for guest's firstname seems to be {{var subscriber.getSubscriberFirstname()}}. I tried your "if" equation above to include the registered subscriber, but it shows the keyword in the newsletter instead of the client's name. So for now I just put the 2 keywords next to each other and it seems to work perfectly. (Only one name is pulled into the newsletter, so it seems like it does not mistakenly duplicate the name) eg: "Hi there {{var subscriber.getSubscriberFirstname()}}{{var subscriber.customer_firstname}}" Thanks alot for all your effort in helping me! – user14427 Sep 26 '14 at 9:59

protected by Community Apr 1 '18 at 21:33

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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