3

I have a custom input field where customer is asked to add his/her birth date. That data will be saved along with customer account information.

What I need to develop is, to show admin a popup when he logs in backend. That popup will show list of customer(s) having birthday's. The Birthday list will be based on following criteria

  • If a customer has birthday today or in next 4 days.

For example if current date is 30th July it will show like:

Birthday(s) Today:
Customr 1, Customer 2

1st July:
Customer 3

2nd July:
Customer 4

I am not able to figure out,

  1. How to list birthdays of customers and show in popup when admin logs in backend
  2. Do not show the birthday notification popup if admin explicitly closes it.

This is for boosting the sales of our store. The customers having birthday will be given a special promo code.

Thanks

1 Answer 1

4

I would look for an usable event to hook into: admin_session_user_login_success.

In the observer you simply call a collection of customers and add the birthdate attribute to filter with the appropriate parameters to reduce the collection to those who you need displayed. Something like

$customer_collection()->addAttributeToFilter('birth_date', array('gteq' => $today, 'lteq' => $today_plus_4days))

On how to utilize a popup, this Inchoo blog article might be a good place to start looking.

p.s. Again, lacking reputation to make this a comment it turned out as answer.

Edit (explicitely closing the popup, too long for comment):

I am not completely sure what you are asking. If you want to automatically close the popup after certain time passes this surely is easier to simply hard code. OR if you want the admin to be able to configure that time, create a field in the system->configuration. That is a convenient place for such kind of configurations as all it needs to add fields is some xml. The Magento Wiki - XML for admin configuration covers most of that.

If you want Magento to remember whether or not a user has closed a popup to remind him in later sessions, you need your user model to save a date. Either when the popup was closed, or when the next popup shall appear. You can either add an attribute in the User model like I suggested in comment, or you create your own table, whatever suits you more. You just need a date to check whether or not to fire your popup from the observer.

6
  • 1
    You don't need to apologize...this is a valid answer and should not be a comment. +1 from me.
    – Marius
    Jul 30, 2014 at 11:00
  • Thanks for responding. I can manage on displaying the users list in popup using the Inchoo blog. But how to Do not show the birthday notification popup if admin explicitly closes it. and remind the admin again after 4 days when he logs in, with the same popup notification ?
    – Jordan
    Jul 30, 2014 at 11:05
  • You could add an attribute to the user, saving a next_reminder time stamp, check it in the observer before firing the popup and save it when the pop up is explicitely closed by the admin. Jul 30, 2014 at 13:03
  • Actually better use an attribute associated with the user, so that different admins can have different reminder dates. Jul 30, 2014 at 13:04
  • What to save in next_reminder time stamp when the popup is closed by admin explicitly or it closes after certain seconds ?
    – Jordan
    Jul 31, 2014 at 7:07

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.